Repository navigation
fix(server): share provider update locks, bound peer calls, mark lost child work interrupted - #172
Open
nullStack65 wants to merge 1 commit into
Open
nullStack65 wants to merge 1 commit into
nullStack65 wants to merge 1 commit into
Conversation
… child work interrupted - Build one ProviderMaintenanceRunner for the server and hand it to every WebSocket connection, so two clients share the provider update locks. - Time out a forwarded peer tool call after two minutes, so a half-open linked environment cannot hang task_cancel or task_status. - When a provider process is released with awaited background work still on its roster, record that work on the run as restart recovery does, so a delegated child settles as interrupted instead of completed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Owner
Author
|
Frozen 2026-11-22 CEO portfolio audit — cash-path priority; can reopen at the Dec 18 runway check. |
This branch has not been deployed
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.
Three medium-severity findings from the November 21 server audit, each with a regression test that fails on the release branch and passes here.
1. Provider updates shared no lock across clients (audit A-P2-01)
Every WebSocket connection built its own
ProviderMaintenanceRunner, and the runner holds the lock that keeps one provider update from running twice. Two clients (or one client reconnecting) could each start the same update at once.Fix: the server builds one runner when the route layer builds (
server.ts), the same way it already sharesPullRequestService, andws.tshands that instance to every connection.Test:
ws.test.ts, "every WebSocket connection updates providers through the server's one runner". It opens two real WebSocket connections and checks that both updates reach the server's runner. On the base branch each connection uses its own real runner instead, and the test fails.The audit also named
AgentSessionScanner, but the release branch already builds that once at server level (runtimeLayer.ts). The audit read an older commit, so nothing changes for the scanner here.2. A half-open linked environment could hang cancel and status forever (audit A-P2-03)
PeerMcpClientbounded only the MCP handshake. A forwardedtools/callhad no ceiling, so a peer that accepted the connection and then went silent lefttask_cancel,task_statusand the result follower waiting with no end.Fix: a forwarded call now times out after 2 minutes. Forwarded waits already stop at 45 s, so only a dead peer reaches the limit. The timeout goes through the existing
TimeoutErrormapping, so the caller sees "The linked environment stopped answering."Test: the existing handshake case in
PeerMcpClient.test.tsnow also sends a call that never answers and advances the test clock 2 minutes. On the base branch the call hangs until vitest's own timeout.3. A delegated child that lost background work settled as completed (audit A-P2-02)
When a provider process ended for a reason other than a server restart (idle release, runtime error, detach),
ProviderSessionManagercleared the dead process's background tasks from the roster but recorded them nowhere.runOutcome()then reported the child ascompleted, even though a reviewer subagent or background task it was waiting on had been killed. Restart recovery already handles the same loss correctly.Fix: the release roster write now also emits
run.background-work-cancelledfor the latest started run on that provider thread, in the same conditional write, using the same rules as restart recovery: root provider threads only, and a subagent covers the shells it started.latestStartedRunmoved intoRestartBackgroundNote.tsso both paths pick the same run.Test:
ProviderSessionManager.test.ts, "records the background work a released process lost". It seeds a run whose process holds a dev server and an awaited subagent, closes the session, and checks that the run records both and thatrunOutcomeisinterrupted. On the base branch the recorded list is empty.Follow-up, not in this PR: the note the agent later sees says "the T3 server restarted…". That wording is now slightly off for an idle or crash release. It is model-facing text, so changing it needs the evals in
evals/README.md. I left it alone.Verification
ProviderSessionManager.test.ts(74),PeerMcpClient.test.ts(7).check:changedagainst the release branch: format and lint pass. The other failures are outside this diff:evalstypecheck: missingProviderRegistryinmcp-tool-use/run.ts. Reproduced on the clean base.AgentContextBudget.test.ts: MCP tool list bytes. This diff changes no MCP tool text.--no-verify). CI runs knip in full.Deploy: fleet
Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code