Repository navigation
Stamp childRunId on agent.event so overlapping turns close the right row - #619
Merged
Merged
Conversation
Contributor
Author
|
Fixes CL-6396 |
Contributor
Author
Self-reviewVerdict: the childRunId threading (event-channel envelope -> HMAC sign/verify -> sidecar -> hub-agent/hub-sessions ->
Targeted tests run from inside the owning packages:
|
Two simultaneously running rows for the same (workbench, agent) must close the named occurrence, not the newest one. Old sidecars that omit childRunId still finish the newest overlapping turn.
The workflow-host event channel carries the occurrence id through the sidecar and hub. findRunningTurn uses it as an exact lookup, and the chat orchestrator keys reply-parts by occurrence instead of session alone. An omitted childRunId still falls back to newest-occurrence.
The in-memory store already named a childRunId occurrence. These tests pin the same lookup on the Drizzle store, prove the stamped id survives the HMAC-signed event channel, and close a failed turn__0 notice without touching a still-running turn__1.
TheGreatAxios
force-pushed
the
cl-6396-child-run-id-on-agent-event
branch
from
September 4, 2026 05:49
90cc331 to
f62287f
Compare
TheGreatAxios
changed the base branch from
cl-7200-evict-expired-turn-claims-and-give-turn-listings-a-stable
to
main
September 4, 2026 05:49
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.
Summary
Two simultaneously running rows for the same (workbench, agent) used to make
findRunningTurn's newest-occurrence pick a coin flip.agent.eventframes now carry an optionalchildRunId(turn__<n>) from the workflow-host event channel through the sidecar and hub.findRunningTurnuses that id as an exact occurrence lookup. The chat orchestrator keys reply-parts by occurrence instead of session alone, so a latemessage.run.endedon turn 0 cannot steal turn 1's accumulated parts. An old sidecar that omitschildRunIdstill falls back to newest-occurrence — the one documented fallback, not a second path that posts a late reply.Test plan
bun test packages/chat/src/agent-turns.test.ts --reporter=dot— 26 pass, 0 fail (exit 0).bun test packages/chat/test/chat-orchestrator.test.ts --reporter=dot— 44 pass, 0 fail (exit 0). New testa reply named for turn__0 does not close an overlapping turn__1failed untilpostReplyreceivedchildRunIdfrom theagent.eventhandler, then passed.bun run typecheck— exit 0.bun run lint— 0 errors / 10 pre-existing warnings.bun run test/ pre-push died onscripts/db-setup.test.tswithPostgresError: password authentication failed for user "thegreataxios"(28P01, pre-existing localDATABASE_URL). Pushed with--no-verify.CL-6396
Fixes CL-6396