Repository navigation
fix(server): a wait follows a queued message promoted into the active run - #196
Conversation
… run `t3 thread send --mode auto --wait` sent while a turn is starting queues the message, and the promotion that then steers it into the running turn cancels the queued run before it starts. `waitForThread` ended on that cancelled run, so the command exited 1 although the agent answered the message in the run it joined. A run cancelled before it started whose message now belongs to another run is followed into that run, and the wait settles when that run does. The stream filter lets every terminal run event through, so the joined run's settle is seen even when it arrives in the same chunk as the cancellation. The test fails without the fix (the wait settles on the cancelled queued run) and hangs without the filter line. Row 30 of the fork runbook, the allowlist and the release contract test now own ThreadManagementService.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Review request: head What changed: Please check first:
Not verified: a run against a live provider. Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e |
agentrozjedemeai
left a comment
There was a problem hiding this comment.
Approved. No blocking findings.
Non-blocking: check:changed fails on the existing context-budget mismatch; I reproduced the same values on the unchanged main files. The focused server tests (31/31) and release contract (51/51) passed, as did the required CI checks. A live provider run was not verified.
— Pablo
Status: ready for review
Problem
t3 thread send --mode auto --wait(andt3_thread_waiton such a message) sent while a turn is starting exits 1 although the agent answers the message. The send queues the message behind the starting turn; the promotion that then steers it into that turn (row 30, #139) cancels the queued run before it starts and re-emits the message under the active run.waitForThreadstopped on the cancelled queued run. Found by the independent v0.1.9 check in #185 (point 1). Blocks stable0.1.9-lazurio.1.Fix
apps/server/src/orchestration-v2/ThreadManagementService.ts:joinedRun: a run cancelled withstartedAt === nullwhose user message now carries anotherrunIdresolves to that run;outcomefollows such hops (bounded by the run count) and then the latest restart continuation as before.Row 30 of
docs/operations/lazurio-fork-release.md, the Fork CI allowlist andscripts/lazurio-release-contract.test.mjsnow ownThreadManagementService.tsand pin the guard, the follow loop and the filter line.docs/user/agent-cli.mdsays--waitwaits for the run the message starts or steers.Verification
waitForThread follows a queued message promoted into the active runinThreadManagementService.test.ts; the file passes 31/31.cancelledoutcome; without the filter line it never settles (vitest 120 s timeout, the wait runs onTestClock).vp run check:changed: format, lint, knip, graphql and typecheck (41 packages) pass.src/provider/AgentContextBudget.test.tsfails locally with the same numbers on cleanmain59dab4e0: it measures the overlay's row 22 context against upstream's budget file (8838 against 7327 bytes for Codex), and Fork CI does not run it; recorded under point 5 in Přestavba na upstream T3 Code v0.1.9 #185.vp fmt --checkon the whole repo passes;node --test scripts/lazurio-release-contract.test.mjspasses.ThreadManagementService.tsreported without it.Agent: environment a480495c-25e0-4e51-828b-1dbf1b77d62f · bot c59bfd74-62a6-4eaa-88dd-5e19f1b3032e
🤖 Generated with Claude Code