Repository navigation
fix(gateway): clean up aborted queued turns - #103194
Merged
Merged
Conversation
Co-authored-by: Ted Li <[email protected]>
Contributor
Author
|
Land-ready proof for exact head
Known proof gap: the live provider was deterministic/local rather than a paid external model. The changed contract is Gateway/TUI cancellation ownership, so this directly exercises the race without adding provider variability. Ready to merge. |
Contributor
Author
|
Merged via squash.
|
3 tasks
github-actions Bot
pushed a commit
to Desicool/openclaw
that referenced
this pull request
Jul 10, 2026
Co-authored-by: Ted Li <[email protected]>
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.
Closes #102914
Supersedes #102995 and #102935.
What Problem This Solves
Fixes an issue where queued chat followup turns could remain in Gateway memory after their owner aborted. A delayed lifecycle callback could also mutate a newer queued turn if the protocol run ID had been reused.
Why This Change Was Made
Queued-turn registration now owns a once-only abort listener, and every completion, retirement, and abort cleanup mutation verifies the exact entry/controller identity before changing the map. This keeps retired collect identities as idempotency guards while preventing stale callbacks from deleting or retiring replacement turns.
This is a clean current-main rebuild of #102995 by @MonkeyLeeT. The commit preserves Ted Li's coauthor credit.
User Impact
Queued turns are removed promptly after cancellation without allowing stale queue state or reused run IDs to interfere with later chat turns. Followup and collect behavior otherwise remains unchanged.
Evidence
tbx_01kx4qhk8g3h74438h2d9dq1yx: 160 focused Gateway tests passed.pnpm check:changedpassed for core production and core-test lanes.git diff --checkpassed.