Skip to content

[replay] t3code#24079: fix(server): phones get the approval push when a subagent waits - #3

Open
csdev19 wants to merge 1 commit into
replay/pr-24079/basefrom
replay/pr-24079/head
Open

csdev19 wants to merge 1 commit into
replay/pr-24079/basefrom
replay/pr-24079/head

Conversation

@csdev19

@csdev19 csdev19 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Replay of pingdotgg/t3code#24079, merged 2026-11-09.

This is a replay for a code-review benchmark, not a contribution. The code is from pingdotgg/t3code (MIT License; LICENSE is in the tree).

The diff of this PR equals the original base..head diff. Reference bot threads: https://github.com/niway-dev/wachiman-benchmarks/blob/docs/t3code-replays/t3code/replays/24079/bot-threads.md

🤖 Generated with Claude Code

Tree of pingdotgg/t3code@69a7f1c, the earliest commit a review bot commented on (MIT).

@csdev19 csdev19 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wachiman 1.12.0, local run (wachiman local --commit HEAD, Claude Opus 5.5, effort high, isolated profile). Coverage: 5 of 5 changed files. 1 finding, posted inline. No findings outside the diff.

Summary: The change moves the subagent pending-request logic into @t3tools/shared and has the relay republish a top-level thread when one of its subagents waits on the user, so the parent's row shows "Approval needed" or "Waiting for input". The client refactor changes no behaviour, and the tests assert the right things. One fix: the server's in-memory subagentRequests map is only updated while publishing is enabled and linked, and nothing clears or rebuilds it. If publishing is turned off and back on, a parent can stay stuck on "Approval needed" after its child's request has resolved.

// domain event, so materializing the full shell here would make the cost
// of one thread's activity proportional to how many threads exist.
const threadShell = yield* threads.getThreadShell(threadId);
yield* trackSubagentRequest(threadId, threadShell);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Severity: fix (bug, confidence medium)

Claim: Subagent request map goes stale while publishing is disabled or unlinked, so the parent can stay stuck on "Approval needed"

Reasoning: trackSubagentRequest only runs after the publication-disabled and missing-relay-config early returns (lines 466-483), but subagentRequests (line 401) is never cleared or rebuilt. Here is a sequence that breaks it. A child raises an approval while publishing is on, so its entry is stored and the parent is published as waiting_for_approval. Then publishing is turned off, for example with t3 connect publish from another process. While it is off, the child's request resolves and its run ends. Those events return before line 546, so the entry stays. When publishing is turned back on, nothing rebuilds the map: the startup snapshot runs only once, because activeSnapshotPublishedRef is never reset (lines 806-811). The parent's next event then publishes the stale "approval" from pendingSubagentRequestFor at line 568. The child has finished and sends no more events, so nothing corrects the parent's row, and the user's activity card keeps showing "Approval needed" with no error. resetPublishedConnection clears publishedStateByThreadRef but not this map. One fix: run trackSubagentRequest (it already has the shell) before the gates, but only for subagent shells, so the disabled path doesn't get a shell read on every event. Another: clear subagentRequests in resetPublishedConnection and reset activeSnapshotPublishedRef so a catch-up rebuilds the map from the shell snapshot.

Wachiman 1.12.0, local run

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