fix(agent): invalidate flush-scan cursor when finalizer pops db marker
The bounded flush-scan in _flush_messages_to_session_db_unlocked skips the identity-matched prefix of its previous snapshot, on the documented assumption that no code path pops _DB_PERSISTED_MARKER from a live dict in place. finalize_turn's pure-tool-call-tail fill is exactly that path: it pops the marker so the filled content gets re-persisted — but the cursor then skips the row anyway, so the delivered final response never reaches state.db and /resume replays content="" (the #43849/#44100 class resurfacing via the perf cursor). Invalidate the cursor at the pop site so the filled row is re-examined.
This commit is contained in:
@@ -339,6 +339,12 @@ def finalize_turn(
|
||||
# otherwise ``/resume`` reloads ``content=""`` and the bug
|
||||
# resurfaces cross-session.
|
||||
_tail.pop("_db_persisted", None)
|
||||
# The bounded flush-scan cursor (run_agent.py) skips the
|
||||
# identity-matched prefix of its previous snapshot on the
|
||||
# assumption that no live dict loses the marker in place —
|
||||
# this pop is the one place that does. Invalidate it so the
|
||||
# filled row is re-examined instead of skipped.
|
||||
agent._db_flush_scan_prefix = None
|
||||
|
||||
# The model has completed its request, so replace API-local
|
||||
# voice/model/skill guidance with the clean user input before writing the
|
||||
|
||||
Reference in New Issue
Block a user