chore(agent): tripwire — warn when a turn starts before the previous turn's persist - #64936
Closed
Rival wants to merge 1 commit into
Closed
chore(agent): tripwire — warn when a turn starts before the previous turn's persist#64936Rival wants to merge 1 commit into
Rival wants to merge 1 commit into
Conversation
…turn's persist Two turns interleaving on one session corrupt the durable transcript: flushes race (user rows persist out of arrival order), the identity-marker dedup over shared history dicts can swallow a row, and the second turn runs on a history base that never saw the first turn's exchange. The dispatch route that lets the second turn through the busy guard is not yet identified. Add note_turn_start (build_turn_context) / note_turn_persisted (_persist_session funnel): one WARNING naming both turn_ids when a turn starts before the previous turn's turn-end persist. Ownership transfer keeps a crashed turn from warning more than once; the unconditional clear makes the tripwire under-report rather than double-report under a real overlap. Log-only, no behavior change. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
|
Thanks for adding a focused diagnostic for the concurrency report. The current implementation needs a lifecycle correction before it can reliably identify the bypass route. Problems
Suggested changes
Automated hermes-sweeper review. |
teknium1
added a commit
that referenced
this pull request
Jul 16, 2026
This was referenced Jul 16, 2026
Contributor
|
Merged via PR #65499 — your commit was cherry-picked onto current main with authorship preserved. The noise-tuning semantics (ownership transfer on crashed turns, unconditional clear so overlaps under-report, silent same-turn re-entry) survived review intact; we E2E-verified the persist-funnel clear in both lock branches. Next occurrence of the #64934 overlap in any deployment should now name both turn_ids in the WARNING — please share the correlated dispatch log lines on the issue when it fires. |
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.
#64934 documents two turns running concurrently on one gateway session
(busy-guard miss, route unidentified): interleaved flushes persisted user
rows out of arrival order and swallowed an assistant row, leaving a
permanent alternation wedge.
This adds a log-only tripwire:
note_turn_startinbuild_turn_contextwarns — naming both turn_ids, the session, and the previous turn's age —
when a turn starts before the previous turn's
_persist_sessioncompleted;note_turn_persistedclears the slot in the persist funnel (both lockbranches). The WARNING's two turn_ids correlate with dispatch logs, so the
next occurrence in any deployment identifies the route that bypassed the
busy guard.
Semantics tuned against noise: ownership transfer keeps a turn that crashed
before its persist from warning more than once; the unconditional clear
makes the tripwire under-report rather than double-report under a real
overlap; same-turn_id re-entry (retry paths) is silent. No behavior change.
4 unit tests (
tests/agent/test_turn_overlap_tripwire.py); fulltests/agent/suite green (5723 tests).🤖 Generated with Claude Code