Skip to content

fix(test): ACP replay agent writes its status before answering - #100

Closed
Laurin-Notemann wants to merge 2 commits into
mainfrom
fix/acp-replay-status-order
Closed

Laurin-Notemann wants to merge 2 commits into
mainfrom
fix/acp-replay-status-order

Conversation

@Laurin-Notemann

@Laurin-Notemann Laurin-Notemann commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

AcpRegistryAdapterV2 > the agent's own mode picker > switches a mode config option under its own id failed on PR #99 with Failed to decode ACP replay status for stored-mode-pick / SyntaxError: Unexpected end of JSON input.

apps/server/scripts/acp-replay-agent.ts sent each inbound frame and then rewrote status.json with writeFileSync, which empties the file and then writes it. The mode-pick tests close the session right after the last answer and read the status file straight away, so the read could land in that gap.

Fix

Port upstream's ordering (pingdotgg/t3code main): flushInbound builds the pending frames, writes the status once, then sends them. By the time the client sees the last answer, the status file is complete. Apart from comments, the file now matches upstream's except for one unrelated line.

Seam

The replay agent is upstream-owned, so scripts/otterware/upstream-seams.txt now lists it. This is a port of upstream's own fix, so the next sync resolves it to upstream's version.

Validation

  • vp run check:changed passes.
  • AcpRegistryAdapterV2.test.ts passes, and its two mode-pick tests passed 10 runs in a row.
  • OrchestratorReplayFixtures.integration.test.ts > claude_result_is_error fails locally both with and without this change, because the dev machine sets CLAUDE_CONFIG_DIR and that adds a clause to the expected message. CI passes it.

Claude Opus 5.5 via Claude Code (T3 Code)

🤖 Generated with Claude Code

The replay agent sent each answer and then rewrote status.json. A test that
stops the session as soon as it gets the last answer could read the file
while it was still empty, failing with "Unexpected end of JSON input"
(AcpRegistryAdapterV2 > switches a mode config option, seen on PR #99).

Port upstream's ordering: build the frames, write the status once, then send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Laurin-Notemann
Laurin-Notemann enabled auto-merge (squash) October 20, 2026 10:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Laurin-Notemann

Copy link
Copy Markdown
Contributor Author

Closing: upstream already has this fix and the next upstream sync brings it in. Listing the replay agent as a seam would take up the last slot in the upstream-seams list, which must stay under 40 files. Until the sync, re-run CI if AcpRegistryAdapterV2's mode-pick test flakes.

auto-merge was automatically disabled October 20, 2026 10:57

Pull request was closed

@Laurin-Notemann
Laurin-Notemann deleted the fix/acp-replay-status-order branch October 20, 2026 10:57
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.

1 participant