fix: bug: TOML [agents.X] section name with dash crashes load-project.sh (#862) #865
No reviewers
Labels
No labels
action
backlog
blocked
bug-report
cannot-reproduce
in-progress
in-triage
needs-triage
prediction/actioned
prediction/dismissed
prediction/unreviewed
priority
rejected
reproduced
tech-debt
underspecified
vision
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: disinto-admin/disinto#865
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/issue-862"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes #862
Changes
TOML allows dashes in bare keys, so `[agents.dev-qwen2]` is a valid section. Before this fix, load-project.sh derived bash var names via Python `.upper()` alone, which kept the dash and produced `AGENT_DEV-QWEN2_BASE_URL` — an invalid shell identifier. Under `set -euo pipefail` the subsequent `export` aborted the whole file, silently taking the factory down on the N+1 run after a dashed agent was hired via `disinto hire-an-agent`. Normalize via `.upper().replace('-', '_')` to match the `tr 'a-z-' 'A-Z_'` convention already used by hire-agent.sh (#834) and generators.sh (#852). Also harden hire-agent.sh to reject invalid agent names at hire time (before any Forgejo side effects), so unparseable TOML sections never land on disk. - `lib/load-project.sh` — dash-to-underscore in emitted shell var names - `lib/hire-agent.sh` — validate agent name against `^[a-z]([a-z0-9]|-[a-z0-9])*$` up front - `tests/lib-load-project.bats` — regression guard covering the parse path and the hire-time reject path Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>AI Review
Summary
Fixes #862 with two complementary changes:
load-project.sh (
lib/load-project.sh:137):safe = name.upper().replace('-', '_')produces a valid shell identifier before theexportloop. Applied consistently across all 6 field emissions. The root cause wasexport "AGENT_DEV-QWEN2_BASE_URL=..."being rejected by bash as "not a valid identifier" underset -e.hire-agent.sh (
lib/hire-agent.sh:48): Regex^[a-z]([a-z0-9]|-[a-z0-9])*$placed before any side effects (Forgejo user creation, TOML write, token issuance). Allowsdev-qwen2, rejects trailing/consecutive/leading dashes, uppercase, underscores.Test Coverage
All 7 tests exercise real failure modes:
load-project.shwithset -euo pipefailand verifiesAGENT_DEV_QWEN2_BASE_URLis populated; the old export would abort.review-qwen-3b.No issues found.
Verdict
APPROVE — Both fix axes correct: load-project.sh normalizes dashes to underscores before export; hire-agent.sh gates invalid names before side effects. Tests exercise the exact failure mode.
Reviewed at
721d7a6| AGENTS.mdAI Review: APPROVE — Both fix axes correct: load-project.sh normalizes dashes to underscores before export; hire-agent.sh gates invalid names before side effects. Tests exercise the exact failure mode.