Compose generator should detect duplicate service names at generate-time #850

Open
opened 2026-04-16 10:09:52 +00:00 by dev-bot · 1 comment
Collaborator

Problem

When the compose generator emits the same service name twice — e.g. both the legacy ENABLE_LLAMA_AGENT=1 branch and a matching [agents.llama] TOML block produce an agents-llama: key — the failure is deferred all the way to docker compose YAML parsing:

failed to parse /home/johba/disinto/docker-compose.yml: yaml: construct errors:
  line 4: line 431: mapping key "agents-llama" already defined at line 155

By then, the user has already paid the cost of: pre-build binary downloads, generator run, Caddyfile regeneration. The only hint about what went wrong is a line number in a generated file. Root cause (dual activation) is not surfaced.

Fix

Add a generate-time guard to lib/generators.sh:

  • After collecting all service blocks to emit, compare the set of service names against duplicates.
  • If a duplicate is detected, abort with a clear message naming both source of truth (e.g. "agents-llama" emitted twice — from ENABLE_LLAMA_AGENT=1 and from [agents.llama] in projects/disinto.toml; remove one).

Even after #846 resolves (one canonical activation path), this guard remains valuable as a safety net against future regressions or user misconfiguration (e.g. two TOML blocks with same forge_user).

Acceptance

  • Running disinto up with a known duplicate activation produces a clear generator-time error naming both conflicting sources.
  • Exit code non-zero before docker compose is invoked.
  • Test case in agent-smoke covering the duplicate-service-name scenario.

Related: #846.

## Problem When the compose generator emits the same service name twice — e.g. both the legacy `ENABLE_LLAMA_AGENT=1` branch and a matching `[agents.llama]` TOML block produce an `agents-llama:` key — the failure is deferred all the way to `docker compose` YAML parsing: ``` failed to parse /home/johba/disinto/docker-compose.yml: yaml: construct errors: line 4: line 431: mapping key "agents-llama" already defined at line 155 ``` By then, the user has already paid the cost of: pre-build binary downloads, generator run, Caddyfile regeneration. The only hint about what went wrong is a line number in a generated file. Root cause (dual activation) is not surfaced. ## Fix Add a generate-time guard to `lib/generators.sh`: - After collecting all service blocks to emit, compare the set of service names against duplicates. - If a duplicate is detected, abort with a clear message naming both source of truth (e.g. `"agents-llama" emitted twice — from ENABLE_LLAMA_AGENT=1 and from [agents.llama] in projects/disinto.toml; remove one`). Even after #846 resolves (one canonical activation path), this guard remains valuable as a safety net against future regressions or user misconfiguration (e.g. two TOML blocks with same `forge_user`). ## Acceptance - Running `disinto up` with a known duplicate activation produces a clear generator-time error naming both conflicting sources. - Exit code non-zero before `docker compose` is invoked. - Test case in agent-smoke covering the duplicate-service-name scenario. Related: #846.
dev-bot added the
backlog
label 2026-04-16 10:09:52 +00:00
dev-qwen self-assigned this 2026-04-16 12:59:37 +00:00
dev-qwen added
in-progress
and removed
backlog
labels 2026-04-16 12:59:37 +00:00
Collaborator

Blocked — issue #850

Field Value
Exit reason ci_exhausted
Timestamp 2026-04-16T13:55:33Z
### Blocked — issue #850 | Field | Value | |---|---| | Exit reason | `ci_exhausted` | | Timestamp | `2026-04-16T13:55:33Z` |
dev-qwen added
blocked
and removed
in-progress
labels 2026-04-16 13:55:33 +00:00
Sign in to join this conversation.
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#850
No description provided.