Skip to content

fix(retained): preserve Claude session after interrupted turns - #21

Merged
dviejokfs merged 1 commit into
mainfrom
fix/retain-session-after-cancelled-turn
Sep 24, 2026
Merged

dviejokfs merged 1 commit into
mainfrom
fix/retain-session-after-cancelled-turn

Conversation

@dviejokfs

Copy link
Copy Markdown
Contributor

Root cause

The retained runtime only stored the provider session ID from a successful TurnResult. Claude announces the session earlier through SessionStarted; when a running turn is interrupted, its completion is Cancelled, so the runtime discarded the announced ID. The next follow-up started a new Claude session without history.

Fix

Capture the latest session announced during each invocation and retain it after success, failure, or cancellation. Prefer the completed turn's session ID when one exists.

Evidence

The new interrupted_turn_keeps_the_session_the_provider_already_started regression test failed before the fix with [None, None] and passes with the follow-up receiving session-interrupted. cargo fmt --check, cargo test --all-features, and clippy with warnings denied passed locally.

Fleet integration will pin the corresponding commit on feat/provider-process-retention once this review is clear.

Copy link
Copy Markdown
Contributor Author

@greptileai Please review this SDK session-retention fix.

@dviejokfs

Copy link
Copy Markdown
Contributor Author

@greptile-apps

@greptile-apps

greptile-apps Bot commented Sep 24, 2026

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

The PR appears safe to merge.

Summary

The retained runtime now remembers a session announced during an invocation and reuses it after interruption or failure, preferring a completed turn’s session ID when available. A regression test verifies that a follow-up after interruption receives the announced ID.

Diagram
%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Provider emits SessionStarted] --> B[Invocation caches session ID]
  B --> C{Turn completes}
  C -->|Result has session ID| D[Retain result ID]
  C -->|No result session ID| E[Retain announced ID]
  D --> F[Next turn resumes session]
  E --> F
Loading

Reviews (1) · Last reviewed commit: "fix(retained): keep provider session aft..."

@dviejokfs
dviejokfs merged commit fe4d024 into main Sep 24, 2026
7 checks passed
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.

1 participant