fix(ship): foreground-flag + deadline + scope guard on all four dispatch sites (#497/#2440 class, 3rd recurrence)

Steps 7/8/10/18 dispatch subagents whose LAST-line JSON the parent
consumes, but none passed run_in_background: false — since Claude Code
v2.1.198 subagents background by default, so /ship stranded at Step 18
waiting on output that never arrives. Every site now renders the shared
{{FOREGROUND_DISPATCH_NOTE}} resolver constant, carries a ~10-minute
deadline with an explicit recovery branch (stop the runaway task,
reconcile against pre-dispatch HEAD, surface stray state, never
re-dispatch), and Step 18's prompt gains a docs-sync-only scope guard
(no VERSION changes, no base-branch merges, push-rejection reported as
pushed:false with parent-side reconciliation and a second-failure
branch). Greptile failures now record as UNAVAILABLE, not zero comments.

GENERATED_WITH_GUIDANCE pins all five ship dispatch carriers; a new test
pins the deadline recovery + scope guard phrases in pr-body (.md and
.tmpl). Codex/factory ship goldens re-rendered.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Garry Tan
2026-09-01 17:20:56 +00:00
co-authored by Claude Fable 5
parent e76f65a8da
commit 95b502bd3a
13 changed files with 117 additions and 17 deletions
+11
View File
@@ -146,3 +146,14 @@ Branch on the echoed \`CODEX_MODE\`:
- **\`model_unusable\`** — authed but the account cannot use its configured model (#2477: HTTP 400 on every call, usually a stale \`model =\` pin in \`~/.codex/config.toml\`). Relay the probe's HINT lines, tell the user the one-line fix (update the pin; \`[notice.model_migrations]\` names the replacement), and fall back to the Claude subagent path. The ~10s round trip is cached for 1h; timeouts fail open to \`ready\`.
- **\`ready\`** — run the Codex pass below.`;
}
/**
* Canonical foreground-dispatch guidance (#497 → #2440 → third recurrence at
* /ship Step 18). Claude Code v2.1.198 made Agent-tool subagents run in the
* BACKGROUND by default; a synchronous dispatch site must pass the flag
* explicitly or the parent waits on output that never arrives. Rendered via
* {{FOREGROUND_DISPATCH_NOTE}} in section templates; resolver sites may
* interpolate it directly. Same name as the placeholder for grep-ability.
*/
export const FOREGROUND_DISPATCH_NOTE =
'**Foreground required:** pass `run_in_background: false` on the Agent call — subagents run in the BACKGROUND by default since Claude Code v2.1.198. (Merely omitting the flag no longer produces a foreground run; it must be explicitly false.)';
+2
View File
@@ -33,6 +33,7 @@ import { generateGBrainContextLoad, generateGBrainSaveResults, generateBrainPref
import { generateTasksSectionEmit, generateTasksSectionAggregate } from './tasks-section';
import { SECTION, SECTION_INDEX } from './sections';
import { generateRedactInvocationBlock } from './redact-doc';
import { FOREGROUND_DISPATCH_NOTE } from './constants';
import { generateThirdPartyActions } from './third-party-actions';
import { generateDesignDocDiscovery } from './design-doc-discovery';
@@ -90,6 +91,7 @@ export const RESOLVERS: Record<string, ResolverFn> = {
DX_FRAMEWORK: generateDxFramework,
TASTE_PROFILE: generateTasteProfile,
BIN_DIR: (ctx) => ctx.paths.binDir,
FOREGROUND_DISPATCH_NOTE: () => FOREGROUND_DISPATCH_NOTE,
GBRAIN_CONTEXT_LOAD: generateGBrainContextLoad,
GBRAIN_SAVE_RESULTS: generateGBrainSaveResults,
BRAIN_PREFLIGHT: generateBrainPreflight,