fix(ship): agent-mode qa-verify no longer runs the host test suite; arch debate runs serial - #44
Merged
teragrid merged 1 commit intoSep 6, 2026
Conversation
…rch debate runs serial Two agent-mode hang contributors, both surfacing as "forge ship --agent-mode hangs for minutes with zero output" (FORGE_SHIP_ISSUES_2026-09-04 ISSUE 5, still reproducible on 1.10.4 after the mutex fix): - qa-verify Phase 2 called runQATestSuite unconditionally, shelling out to `npm test` / `go test ./...` / `pytest` on the host repo with no agent-mode guard. On a large project that is a multi-minute blocking run with its own output stream, and procspawn's timeout does not reliably reap orphaned jest/vitest workers on Windows (they keep the stdout pipe open past the parent kill, so the read never sees EOF). When the pipeline reached qa-verify without pausing — e.g. checkArch short-circuiting on an already-present arch.md from an earlier answered turn — `forge ship --agent-mode` silently ran the caller's whole suite. In agent mode the host agent is the QA agent, so qa-verify now emits an advisory and lets the host run + report the suite. Non-agent-mode behaviour is unchanged. - runParallelArchDebate still fanned out one goroutine per reviewer role against the bridge. The bridge can only surface one pending turn per run, so the other five do throwaway work (redone on replay) while serialising behind Bridge.mu as the first holds it across savePending's file I/O. Agent mode now runs the debate sequentially, stopping at the first owed turn, matching RunWithOptions's existing `serial` intent. Parallel path kept for real-provider runs. New test TestRunParallelArchDebate_AgentModeSerialNoFanOut. Full `go test ./...` green; gofmt + go vet clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
teragrid
deleted the
fix/agent-mode-qa-verify-native-suite-and-arch-debate-serial
branch
September 6, 2026 15:13
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.
Problem
forge ship --agent-modestill hangs for many minutes with zero output on1.10.4 — the mutex added in 1.10.4 stopped the arch-debate data race but not
the two contributors below. Observed dogfooding on
ai-marketing-platfrom:after answering an
arch-parallel-debateturn, the nextforge ship --agent-modeproduced no output for ~15 min with the process alive.1.
qa-verifyruns the caller's entire native test suite (main cause)checkQAVerifyPhase 2 callsrunQATestSuite, which shells out tonpm test/
go test ./.../pyteston the host repo — with no agent-mode guard.On a large project that's a multi-minute blocking run with its own stdout
stream.
procspawn's timeout also doesn't reliably reap orphaned jest/vitestworkers on Windows: killing the parent
npm/nodeleaves workers holding thestdout pipe open, so the pipe read never sees EOF. When the pipeline reaches
qa-verifywithout pausing first — e.g.checkArchshort-circuiting on analready-present
arch.mdfrom an earlier answered turn —forge ship --agent-modesilently executes the caller's whole suite and appears hung.In agent mode the host agent is the QA agent (the checkpoint's own
description: "QA agent: probe MCP server tools or run native test suite"), so
qa-verifynow emits an advisory and lets the host run + report the suite.Non-agent-mode runs are unchanged.
2.
runParallelArchDebatestill fans out against the bridgeThe bridge can only surface one pending turn per run, so 5 of the 6 role
goroutines do throwaway work (redone on the next replay) while serialising
behind
Bridge.muas the first holds it acrosssavePending's file I/O.Agent mode now runs the debate sequentially, stopping at the first owed
turn — matching
RunWithOptions's existingserialintent. The parallelpath is kept for real-provider runs.
Changes
internal/cli/cmdship/ship.gocheckQAVerifyPhase 2: skiprunQATestSuitewhenpipe.Bridge() != nil; emit an advisory insteadinternal/cli/cmdship/arch.gorunParallelArchDebate: sequential + early-exit when a bridge is active; parallel path retained otherwiseinternal/cli/cmdship/rfc005_p1p2_test.goTestRunParallelArchDebate_AgentModeSerialNoFanOut— asserts no hang, one pending turn, coherent bridge stateCHANGELOG.md[Unreleased]entriesTesting
go test ./...— all greengofmt -lclean,go vet ./internal/cli/cmdship/...clean🤖 Generated with Claude Code