Skip to content

fix: Stale previous_response_id is accepted after runtime eviction, branching the wrong conversation#389

Closed
sam-saffron-jarvis wants to merge 1 commit intoSamSaffron:mainfrom
sam-saffron-jarvis:feat/codereview-0d5c1b6d
Closed

fix: Stale previous_response_id is accepted after runtime eviction, branching the wrong conversation#389
sam-saffron-jarvis wants to merge 1 commit intoSamSaffron:mainfrom
sam-saffron-jarvis:feat/codereview-0d5c1b6d

Conversation

@sam-saffron-jarvis
Copy link
Copy Markdown
Contributor

What

  • track the latest response ID per session outside the runtime so chaining validation survives runtime recreation
  • use that server-wide latest response ID as a fallback when a recreated runtime has no in-memory lastResponseID yet
  • clear the cached latest response ID when starting a fresh conversation and add a regression test covering stale previous_response_id after runtime recreation

Why

The stale-chain guard only worked when the live runtime still had lastResponseID in memory. After a runtime was evicted and recreated, older previous_response_id values could still resolve through responseToSession but would skip the stale check, causing the request to run against the wrong conversation state. Persisting the latest response ID at the server level preserves the latest-only chaining check across runtime recreation and prevents silent conversation branching.

@SamSaffron
Copy link
Copy Markdown
Owner

Closing in favor of consolidated local changeset on branch pr-consolidation. The change from this PR was folded in along with: #387, #389, #390, #391, #400, #401, #402, #403, #404. Build and full test suite pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants