GeezerVison is showing github.com — fix(server): background work an agent waits on survives settles, crashes and failed wakes by tebiggs · Pull Request #14 · tebiggs/t3code
Conversation
tebiggs
commented
Oct 28, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
A background job the agent was waiting on, such as a deploy, a test run or a deploy's waiter, could be lost:
- A merged pull request auto-settled the thread, which detached the provider and killed the job.
- An agent that settled its own thread mid-turn did the same once the turn ended.
- A failed follow-up dispatch was only logged.
- A provider session or Claude process that died left no trace of the jobs it took down.
- The thread could also read Done between the job ending and the follow-up turn starting.
This keeps upstream's opt-in: work holds the thread only when the agent marks it with t3_background_wait. Evals (below) show current Claude models mark deploys and waiters reliably under upstream's instructions. The fixes:
-
thread.auto-settle rechecks for held work and queued continuations under the thread lock. The sweep's snapshot misses roster changes, because they don't move updatedAt.
-
An agent's own mid-turn settle is skipped at turn end while the thread still waits on work.
-
A finished job the agent waits on stays listed until the turn that reports it starts, so the thread never reads Done in between.
-
A failed follow-up dispatch retries up to 6 times under one command id, so the agent gets one follow-up.
-
Two kinds of loss now record what was lost and wake the agent with the restart note:
- a session released by a crash or idle timeout;
- a Claude process that dies on its own while idle.
The note now tells the agent to check results before rerunning anything with side effects.
Validation
-
New regression tests cover each fix, and they fail without it.
-
Typecheck, lint, format and knip pass, as do the 14 test files beside the changes (492 tests).
-
Evals, evals/mcp-tool-use/cases/background-work.ndjson, run on Sonnet 5.5 and Opus 5.5 with 3 samples each. The agent:
- marks a background deploy: 6 of 6 samples;
- marks a detached deploy's
tail --pid waiter: 6 of 6;
- leaves a dev server unmarked: 6 of 6.
Total cost was about $4.
-
A live run against a dev server with Claude Sonnet 5.5 checked these fixes:
- a failing job's result reaching the agent with no Done in between;
- a killed Claude process waking the agent with the note;
- a self-settle skipped while work runs;
- Stop never resuming.
That run used an earlier revision that held every job without a mark. The same code paths now apply to jobs the agent marks.
The merged-PR auto-settle and the dispatch retry are covered by tests only.
Claude Opus 5.5 in Claude Code, running in T3 Code.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Finished jobs awaiting delivery keep their buffered result. Also satisfies
the catchCauseIf and hoisted mapError lint rules upstream added.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d-status
# Conflicts:
# apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
# apps/server/src/orchestration-v2/ThreadManagementService.ts
A dev server the agent leaves running must be marked with waiting: false,
and a background deploy it will report on must keep holding the thread.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Evals showed Claude marks the deploys and waiters it waits on under
upstream's instructions, so the fork default bought no protection and cost
sync conflicts. The settlement, delivery, retry and loss fixes stay, and
the eval cases now guard upstream's behavior.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
tebiggs
changed the title
fix(server): background jobs keep threads Working until their result reaches the agent
fix(server): background work an agent waits on survives settles, crashes and failed wakes
Oct 29, 2026
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 30, 2026
This was referenced Nov 6, 2026
This was referenced Nov 15, 2026
This was referenced Nov 23, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|