Skip to content

fix(ship): agent-mode qa-verify no longer runs the host test suite; arch debate runs serial - #44

Merged
teragrid merged 1 commit into
mainfrom
fix/agent-mode-qa-verify-native-suite-and-arch-debate-serial
Sep 6, 2026
Merged

teragrid merged 1 commit into
mainfrom
fix/agent-mode-qa-verify-native-suite-and-arch-debate-serial

Conversation

@teragrid

@teragrid teragrid commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Problem

forge ship --agent-mode still hangs for many minutes with zero output on
1.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-debate turn, the next forge ship --agent-mode produced no output for ~15 min with the process alive.

1. qa-verify runs the caller's entire native test suite (main cause)

checkQAVerify Phase 2 calls runQATestSuite, which shells out to npm test
/ go test ./... / pytest on 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/vitest
workers on Windows: killing the parent npm/node leaves workers holding the
stdout pipe open, so the pipe read never sees EOF. When the pipeline reaches
qa-verify without pausing first — e.g. checkArch short-circuiting on an
already-present arch.md from an earlier answered turn — forge ship --agent-mode silently 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-verify now emits an advisory and lets the host run + report the suite.
Non-agent-mode runs are unchanged.

2. runParallelArchDebate still fans out against the bridge

The 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.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. The parallel
path is kept for real-provider runs.

Changes

File Change
internal/cli/cmdship/ship.go checkQAVerify Phase 2: skip runQATestSuite when pipe.Bridge() != nil; emit an advisory instead
internal/cli/cmdship/arch.go runParallelArchDebate: sequential + early-exit when a bridge is active; parallel path retained otherwise
internal/cli/cmdship/rfc005_p1p2_test.go New TestRunParallelArchDebate_AgentModeSerialNoFanOut — asserts no hang, one pending turn, coherent bridge state
CHANGELOG.md [Unreleased] entries

Testing

  • go test ./... — all green
  • gofmt -l clean, go vet ./internal/cli/cmdship/... clean
  • New regression test passes in 0.01s (vs. the hang it guards against)

🤖 Generated with Claude Code

…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
teragrid merged commit bcba3d6 into main Sep 6, 2026
26 checks passed
@teragrid
teragrid deleted the fix/agent-mode-qa-verify-native-suite-and-arch-debate-serial branch September 6, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants