feat: add AGENT_DEV_LAUNCHER / AGENT_REVIEW_LAUNCHER per-side overrides (INV-38)#158
Merged
Conversation
Spec for AGENT_DEV_LAUNCHER / AGENT_REVIEW_LAUNCHER operator knobs that let dev and review wrappers each have their own launcher prefix. Pairs with INV-37 (per-side AGENT_CMD): the launcher's claude-specific env (Bedrock, AWS profile, ANTHROPIC_DEFAULT_*) doesn't fit non-claude review CLIs, so the existing single AGENT_LAUNCHER blocks the natural mixed-CLI deployment. Per-side guard splits the [INV-37] form: each side's launcher is checked against THAT side's AGENT_CMD. Strictly more permissive — no existing config goes from passing to failing. Default fallback to AGENT_LAUNCHER preserves byte-for-byte back-compat. INV-38 (the precedence rule) is referenced in the spec but lands in invariants.md as part of the implementation PR.
Bite-sized TDD plan, six tasks with red-green-commit cadence:
T1 — lib-agent init (2 vars + per-side argv tokenization + guard
rewrite) + PSL-S1..S8 + update PSC-S7/S8/S11 needles
T2 — autonomous-dev.sh AGENT_LAUNCHER_ARGV rebind + PSL-S9
T3 — autonomous-review.sh AGENT_LAUNCHER_ARGV rebind + PSL-S10
T4 — autonomous.conf.example operator block
T5 — INV-38 in invariants.md
T6 — final regression + push + PR
Self-review confirms full spec coverage, no placeholders, type
consistency across tasks.
Adds per-side AGENT_LAUNCHER overrides. Both default to AGENT_LAUNCHER
so existing deployments are byte-for-byte unchanged. The single
'both sides claude' guard from INV-37 is replaced by two independent
per-side guards: each side's launcher is gated on THAT side's
AGENT_CMD. Strictly more permissive than the INV-37 form.
Tokenization mirrors the existing AGENT_LAUNCHER eval block (same
trust model, same WARN-on-empty-tokenize, same ERROR-on-parse-failure).
Tests:
- new test-lib-agent-per-side-launcher.sh — PSL-S1..S8 (resolution
+ per-side guard pass/fail).
- update test-lib-agent-per-side-cmd.sh PSC-S7/S8/S11 needles to
match the new per-side error messages.
PSL-S9/S10 (wrapper structural placement) land in Tasks 2 and 3.
INV-38 entry lands in Task 5.
…b-agent source
Adds AGENT_LAUNCHER_ARGV=("${AGENT_DEV_LAUNCHER_ARGV[@]}") immediately
after the existing AGENT_CMD=$AGENT_DEV_CMD line so _run_with_timeout
picks up the dev-side launcher when the operator has set per-side
overrides.
Default behavior unchanged because AGENT_DEV_LAUNCHER defaults to
AGENT_LAUNCHER inside lib-agent.sh.
Test: PSL-S9 asserts the rebind line lands within 9 lines of source
lib-agent.sh (3-line WHY + AGENT_CMD rebind from INV-37 + 4-line WHY
+ new LAUNCHER rebind = 9 lines).
…ter lib-agent source
Mirrors the dev-side change. Adds AGENT_LAUNCHER_ARGV=("${AGENT_REVIEW_LAUNCHER_ARGV[@]}")
immediately after the existing AGENT_CMD=$AGENT_REVIEW_CMD line so
_run_with_timeout picks up the review-side launcher when the operator
has set per-side overrides.
Test: PSL-S10 asserts the rebind line lands within 9 lines of source
lib-agent.sh (4-line WHY + AGENT_CMD rebind from INV-37 + 3-line WHY
+ new LAUNCHER rebind = 9 lines).
Adds an operator-facing comment block above the per-side AGENT_CMD block. Includes a worked example for the 'claude-dev with cc bridge / kiro-review without launcher' deployment pattern (the motivating use case) and the per-side guard reminder. Updates the AGENT_LAUNCHER hint in the AGENT_DEV_CMD block to point operators at the new per-side launcher escape (INV-38 lifts the old INV-37 'both sides claude' restriction).
INV-38 documents the AGENT_DEV_LAUNCHER / AGENT_REVIEW_LAUNCHER precedence rule that pairs with INV-37 to allow mixed-CLI deployments where only one side has a launcher (e.g. claude dev with cc bridge, kiro review without launcher). INV-37 cross-references list updated to include INV-38. Anchored to docs/pipeline/per-side-launcher.md (already on this branch with cross-reference [INV-38] resolved by this commit).
PR-review fixes: H1 (comment-analyzer Critical-grade for operators): the worked example in autonomous.conf.example for 'claude-dev + kiro-review' set AGENT_DEV_EXTRA_ARGS="--trust-all-tools". But due to the pre-existing stage-vs-side EXTRA_ARGS mapping bug (agy review Finding 1: run_agent reads AGENT_DEV_EXTRA_ARGS regardless of caller side), the claude DEV invocation would pick up --trust-all-tools (an invalid claude flag) and fail at every dispatch. Drop the line; add an operator caveat explaining that kiro-side trust-all-tools should be configured via ~/.kiro/agents/<name>.json until the side mapping bug is fixed in a follow-up. M1 (comment-analyzer): spec doc PSL-S9/S10 said 'within 5/6 lines'; actual test windows are +9/+9. Update spec to match. M2 (comment-analyzer): spec doc placement description for the conf- example block was stale (said 'before AGENT_DEV_EXTRA_ARGS'; actual landing is between AGENT_*_EXTRA_ARGS and AGENT_DEV_CMD). Update. #3 (pr-test-analyzer): PSL-S7/S8 didn't assert RC=1 on guard failure — a regression that drops 'return 1' would leave the error message intact and the test would still pass. Add 'RC=1' assertions. Tests: PASS=14 FAIL=0 (12 + 2 RC=1 assertions). Full regression clean. shellcheck clean. conf-syntax OK.
Owner
Author
agy review (Antigravity 2.0 v1.0.2) — CLEAREDRe-ran the local agy CLI on this PR (resumed prior conversation Verified
Out of scope (acknowledged from #156's review)
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two operator knobs to
lib-agent.shthat let dev and review wrappers each have their own launcher prefix:AGENT_DEV_LAUNCHER— defaults to${AGENT_LAUNCHER:-}AGENT_REVIEW_LAUNCHER— defaults to${AGENT_LAUNCHER:-}The single [INV-37] "both sides claude" launcher guard is replaced by two independent per-side guards:
AGENT_DEV_LAUNCHERnon-empty requiresAGENT_DEV_CMD=claude;AGENT_REVIEW_LAUNCHERnon-empty requiresAGENT_REVIEW_CMD=claude. Strictly more permissive — every operator config that passed before still passes.The motivating use case: a project that wants
AGENT_CMD="claude"+AGENT_DEV_LAUNCHER='cc...'(Bedrock bridge for dev) +AGENT_REVIEW_CMD="kiro"(no launcher needed for review). Pre-INV-38: blocked by [INV-37]. Post-INV-38: works.What's in the PR
skills/autonomous-dispatcher/scripts/lib-agent.sh— init + per-side argv tokenization (mirrors existing AGENT_LAUNCHER eval); two per-side guards replace the single guardskills/autonomous-dispatcher/scripts/autonomous-dev.sh— 4-line WHY + 1-lineAGENT_LAUNCHER_ARGVrebind after the existing AGENT_CMD rebind from feat: add AGENT_DEV_CMD / AGENT_REVIEW_CMD per-side overrides (INV-37) #156skills/autonomous-dispatcher/scripts/autonomous-review.sh— symmetric rebind for review sideskills/autonomous-dispatcher/scripts/autonomous.conf.example— operator-facing comment block with worked example + caveat about the kiro--trust-all-toolsstage-vs-side gotchatests/unit/test-lib-agent-per-side-launcher.sh— 14 assertions (PSL-S1..S10): defaults, fallback, per-side override, per-side guard pass/fail with RC=1, structural placementtests/unit/test-lib-agent-per-side-cmd.sh— PSC-S7/S8/S11 assertion needles updated to match the new per-side error messagesdocs/pipeline/per-side-launcher.md— specdocs/pipeline/invariants.md— INV-38docs/pipeline/README.md— index entrydocs/superpowers/plans/2026-05-26-per-side-launcher.md— implementation planBackwards compatibility
Existing deployments don't set the new vars. Defaults make both per-side ARGVs equal to the existing
AGENT_LAUNCHER_ARGV. The wrapper rebinds copy into the same variable. Result: byte-for-byte identical pre/post.Spec & invariant
docs/pipeline/per-side-launcher.mdPipeline-docs gate
Touches
lib-agent.sh(watched path), sodocs/pipeline/must also change. Satisfied:docs/pipeline/per-side-launcher.md(new spec)docs/pipeline/invariants.md(INV-38)docs/pipeline/README.md(index entry)Test plan
bash tests/unit/test-lib-agent-per-side-launcher.sh— 14/14 PASSbash tests/unit/test-lib-agent-per-side-cmd.sh— 15/15 PASS (PSC-S7/S8/S11 needles updated)tests/unit/test-lib-agent-*.shregression tests PASSshellcheck -S errorclean on lib-agent.sh + both wrappers + new testbash -n autonomous.conf.examplesyntax OKunit-tests+shellcheck+pipeline-docs-gategreenReview process
The PR went through
/pr-review-toolkit:review-prwith four specialized agents (code-reviewer, pr-test-analyzer, silent-failure-hunter, comment-analyzer). All Critical/High/Medium findings addressed inline:AGENT_DEV_EXTRA_ARGS="--trust-all-tools"from the worked example (the stage-vs-side EXTRA_ARGS gap from agy-Finding-1 means it would have been forwarded to claude DEV and broken every dispatch). Added an operator caveat pointing kiro-side trust-all-tools at~/.kiro/agents/<name>.jsoninstead.RC=1on guard failure, locking in thereturn 1behavior so a future refactor can't silently drop it.silent-failure-hunter found 0 critical issues (per-side guards correctly fail loud at source time; wrapper rebind is byte-identical to AGENT_LAUNCHER under default config). code-reviewer noted only an SC2034 informational warning that's consistent with existing patterns in the project.
Known limitations (out of scope, deferred)
AGENT_*_EXTRA_ARGSstage-vs-side mapping (agy review Finding 1, pre-existing on origin/main):run_agentreadsAGENT_DEV_EXTRA_ARGSregardless of which wrapper called it, andresume_agentreadsAGENT_REVIEW_EXTRA_ARGS. This meansAGENT_DEV_EXTRA_ARGS=--trust-all-tools(intended for kiro review side) would be forwarded to both wrappers. Fix shape is different from this PR — likely anAGENT_SIDEparameter torun_agent/resume_agent. Tracked separately. Operators wanting--trust-all-toolson kiro review side should use~/.kiro/agents/<name>.jsonfor now; the conf example documents this caveat.