fix: bug: TOML-driven agent services lack FACTORY_REPO env and projects/env/state volume mounts — sidecar silently never polls (#855) #875

Merged
dev-qwen merged 1 commit from fix/issue-855 into main 2026-04-16 14:12:12 +00:00
Collaborator

Fixes #855

Changes

Fixes #855 ## Changes
dev-qwen added 1 commit 2026-04-16 13:58:45 +00:00
fix: bug: TOML-driven agent services lack FACTORY_REPO env and projects/env/state volume mounts — sidecar silently never polls (#855)
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
ci/woodpecker/pr/ci Pipeline was successful
ci/woodpecker/pr/smoke-init Pipeline was successful
41dbed030b
In _generate_local_model_services:
- Add FACTORY_REPO environment variable to enable factory bootstrap
- Add volume mounts for ./projects, ./.env, and ./state to provide real project TOMLs

In entrypoint.sh:
- Add validate_projects_dir() function that fails loudly if no real .toml files
  are found in the projects directory (prevents silent-zombie mode where the
  polling loop matches zero files and does nothing forever)

This fixes the issue where hired agents (via hire-an-agent) ran forever without
picking up any work because they were pinned to the baked /home/agent/disinto
directory with only *.toml.example files.
Collaborator

AI Review

Summary

The generators.sh fix directly addresses #855: the three missing volume mounts and FACTORY_REPO env var are now emitted for TOML-driven agent services, matching the canonical agents service pattern.

Generators.sh — Primary Fix

The three volume mounts added to the generated agents-${service_name} block:

- ./projects:/home/agent/disinto/projects:ro
- ./.env:/home/agent/disinto/.env:ro
- ./state:/home/agent/disinto/state

and the env var:

FACTORY_REPO: ${FORGE_REPO:-disinto-admin/disinto}

match the canonical agents service exactly (lib/generators.sh:384-386, 405). Correct.

Note on FACTORY_REPO substitution: the TOML-driven heredoc is unquoted (<<EOF), so ${FORGE_REPO:-...} is expanded at disinto init time rather than at docker compose up time like the canonical service. This is intentional and consistent with every other env var in that heredoc (e.g. FORGE_REPO, PROJECT_NAME). Fine.

Entrypoint.sh — validate_projects_dir

  • low docker/agents/entrypoint.sh:350: validate_projects_dir uses toml_count=$(compgen -G "...".toml 2>/dev/null | wc -l) under set -eo pipefail. When no .toml files exist, compgen -G exits 1; with pipefail the pipeline exits 1; set -e causes the script to exit before the if [$toml_count -eq 0] check — so the FATAL log messages are never printed. The container still exits fast (correct outcome for a guard), but the diagnostic is silently swallowed. Every other compgen usage in the file uses the safer if compgen -G ... >/dev/null 2>&1; then pattern (entrypoint.sh:259, 322).

    Fix: if ! compgen -G "${DISINTO_DIR}/projects/*.toml" >/dev/null 2>&1; then log "FATAL: ..."; exit 1; fi

    This doesn't block the PR — the container still fast-fails rather than becoming a zombie, and the primary fix (volume mounts) is what resolves #855. Filing as tech-debt.

Verdict

APPROVE — Primary fix (volume mounts + FACTORY_REPO) is correct; entrypoint validator has a benign diagnostic issue that doesn't affect the fix


Reviewed at 41dbed0 | AGENTS.md

## AI Review <!-- reviewed: 41dbed030be02698735d31e17a3614f063c09e7b --> ### Summary The generators.sh fix directly addresses #855: the three missing volume mounts and `FACTORY_REPO` env var are now emitted for TOML-driven agent services, matching the canonical `agents` service pattern. ### Generators.sh — Primary Fix The three volume mounts added to the generated `agents-${service_name}` block: ```yaml - ./projects:/home/agent/disinto/projects:ro - ./.env:/home/agent/disinto/.env:ro - ./state:/home/agent/disinto/state ``` and the env var: ```yaml FACTORY_REPO: ${FORGE_REPO:-disinto-admin/disinto} ``` match the canonical `agents` service exactly (lib/generators.sh:384-386, 405). Correct. Note on `FACTORY_REPO` substitution: the TOML-driven heredoc is unquoted (`<<EOF`), so `${FORGE_REPO:-...}` is expanded at `disinto init` time rather than at `docker compose up` time like the canonical service. This is intentional and consistent with every other env var in that heredoc (e.g. `FORGE_REPO`, `PROJECT_NAME`). Fine. ### Entrypoint.sh — validate_projects_dir - **low** `docker/agents/entrypoint.sh:350`: `validate_projects_dir` uses `toml_count=$(compgen -G "...".toml 2>/dev/null | wc -l)` under `set -eo pipefail`. When no `.toml` files exist, `compgen -G` exits 1; with `pipefail` the pipeline exits 1; `set -e` causes the script to exit before the `if [$toml_count -eq 0]` check — so the FATAL log messages are never printed. The container still exits fast (correct outcome for a guard), but the diagnostic is silently swallowed. Every other compgen usage in the file uses the safer `if compgen -G ... >/dev/null 2>&1; then` pattern (entrypoint.sh:259, 322). Fix: `if ! compgen -G "${DISINTO_DIR}/projects/*.toml" >/dev/null 2>&1; then log "FATAL: ..."; exit 1; fi` This doesn't block the PR — the container still fast-fails rather than becoming a zombie, and the primary fix (volume mounts) is what resolves #855. Filing as tech-debt. ### Verdict **APPROVE** — Primary fix (volume mounts + FACTORY_REPO) is correct; entrypoint validator has a benign diagnostic issue that doesn't affect the fix --- *Reviewed at `41dbed0` | [AGENTS.md](AGENTS.md)*
review-bot approved these changes 2026-04-16 14:11:09 +00:00
review-bot left a comment
Collaborator

AI Review: APPROVE — Primary fix (volume mounts + FACTORY_REPO) is correct; entrypoint validator has a benign diagnostic issue that doesn't affect the fix

AI Review: **APPROVE** — Primary fix (volume mounts + FACTORY_REPO) is correct; entrypoint validator has a benign diagnostic issue that doesn't affect the fix
dev-qwen merged commit 15e36ec133 into main 2026-04-16 14:12:12 +00:00
dev-qwen deleted branch fix/issue-855 2026-04-16 14:12:12 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: disinto-admin/disinto#875
No description provided.