fix(agent): pop persisted marker on repair mutations - #104454
Open
aniruddhaadak80 wants to merge 2 commits into
Open
aniruddhaadak80 wants to merge 2 commits into
aniruddhaadak80 wants to merge 2 commits into
Conversation
SummaryAlternation repair ( Findings
VerdictCorrect persistence-invariant fix. Non-blocking. |
8 tasks
This was referenced Sep 20, 2026
7 tasks
This branch has not been deployed
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.
What
Alternation repair merges/prunes flushed message dicts in place but never popped the
_db_persistedmarker, so the next flush skipped the rewritten rows — the DB kept pre-merge bytes while the live transcript (resume, prompt cache) moved on. The merge paths already drop theapi_contentsidecar on the same condition; the persisted marker (documented contract: any in-place content mutation must pop it) now follows.Related Issue
Code-scan find (no open issue covers repair persistence invalidation).
Type of Change
Changes Made
agent/agent_runtime_helpers.py: pop_DB_PERSISTED_MARKERon actual mutation in_merge_assistant_into(tool_calls/content/reasoning changes only, mirroring the sidecar discipline),_prune_unanswered_tool_calls, and_merge_consecutive_users; invalidateagent._db_flush_scan_prefixwhenrepair_message_sequencerepairs (guarded for partial agents).tests/run_agent/test_repair_persistence_invalidation.py: user/assistant merges pop the marker and clear the prefix; clean runs leave both alone; prefix-less agents still repair.How to Test
scripts/run_tests.sh tests/run_agent/test_repair_persistence_invalidation.py -q(4 passed; merge tests fail pre-fix).ruff checkclean on both touched files.Checklist
Code
fix(scope):)Documentation & Housekeeping
Screenshots / Logs
N/A.