fix(#921,#922): orchestrators must not fork; plan-phase Agent gate is attempt-based (#926)

`context: fork` strips the `Agent` tool from a subagent's environment.
Spawning orchestrators (`/gsd-autonomous`, `/gsd-execute-phase`,
`/gsd-plan-phase`) depend on `Agent` to dispatch sub-agents; running
them forked silently disables the core capability they exist to provide
(#921). Remove `context: fork` from all three command frontmatter files.
`effort: xhigh` (introduced by #769) is preserved.

The `<runtime_compatibility>` Agent-availability guard added by #913 was
checking whether `Agent` was present *before* attempting the call. On
runtimes where the tool list is dynamically resolved this produced
false-negative aborts in sessions that have the tool (#922). Replace
the introspection-based pattern with an attempt-based gate: always
attempt the `Agent()` call; stop only if a real tool-unavailable error
is returned. This preserves #853's backgrounded-session close-off and
false negatives.

Tests updated: enh-769-context-fork-effort.install.test.cjs asserts the
three orchestrators lack `context: fork` and that the converter still
passes the field through for non-orchestrator commands; plan-phase-drift-
guard.test.cjs adds four assertions for the attempt-based gate language;
workflow-size-budget unchanged (budgets not exceeded).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
(cherry picked from commit b866b95296)
This commit is contained in:
Tom Boucher
2026-06-09 08:42:25 -04:00
committed by github-actions[bot]
parent 27af818312
commit a6229ec123
9 changed files with 124 additions and 38 deletions

View File

@@ -39,10 +39,13 @@ discuss-phase early-exit path. It does NOT authorize inline role performance for
plan-phase agents.
**Other runtimes:**
If the Agent tool is genuinely absent (e.g. a backgrounded Claude Code agent per
#853, or a non-Claude runtime that does not expose Agent/agent), log the gap and
stop — do NOT perform researcher/planner/checker roles inline. Independent agent
contexts are required for the plan-checker gate to be meaningful.
Do not pre-judge Agent availability by introspection. Always attempt the actual
Agent() call for gsd-phase-researcher, gsd-planner, and gsd-plan-checker. Only
a real tool-unavailable error returned by Agent() is a reliable absence signal —
never stop based on a self-assessed "I think Agent is unavailable." If the call
fails with a tool-unavailable error, log the gap and stop — do NOT collapse
researcher/planner/checker roles inline. Independent agent contexts are required
for the plan-checker gate to be meaningful.
</runtime_compatibility>
<process>