fix(gateway): remove hidden incomplete reasoning from replay recovery - #67786
Closed
KKamJi98 wants to merge 1 commit into
Closed
fix(gateway): remove hidden incomplete reasoning from replay recovery#67786KKamJi98 wants to merge 1 commit into
KKamJi98 wants to merge 1 commit into
Conversation
…ive history A retry-exhausted Codex turn ends as an assistant message with finish_reason=incomplete, hidden reasoning only, and no visible answer or tool call. The gateway keeps that turn out of the persisted transcript, but the cached agent still holds it in live _session_messages. When the FTS write-corruption guard (#50502) resurrects the live transcript because disk persistence lagged, the poisoned tail is replayed to the provider and seeds another incomplete continuation loop. Add agent/replay_cleanup.strip_incomplete_reasoning_tail to drop that tail (plus interleaved _CODEX_INCOMPLETE_NUDGE user messages) and apply it in the gateway's FTS-lag reconciliation path before the stale-confirmation expiry. Visible partial answers, completed turns, and tool-call turns are never stripped, so genuine FTS-corruption recovery is preserved. The nudge is matched by prefix to avoid a conversation_loop import cycle; a regression test guards against drift.
Collaborator
Related to merged #65062: that change suppresses the incomplete gateway result, while this patch removes the lingering hidden-reasoning tail only when FTS-lag recovery resurrects cached live history. |
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
Validation
Scope is limited to the FTS-lag recovery path; normal replay behavior is unchanged.