Release persistent writers when session startup is cancelled (#44183)

## Why

Cancelling a session after persistence opens but while MCP startup is still pending can leave its writer held, blocking a subsequent resume.

## What changed

Create `LiveThreadInitGuard` inside the persistence startup future so it protects the live thread while `tokio::join!` waits for other startup work. Dropping the startup future then schedules writer cleanup.

## Testing

Add a regression test that cancels a resume while MCP startup is blocked, verifies the local writer is released, and resumes the same thread successfully.

GitOrigin-RevId: 57d8624e783a7b993579a6386aea35ba845da0e3
This commit is contained in:
jif authored and copyberry committed 2026-09-09 15:54:07 +00:00
1 parent 2bba3a29a0
commit ce2c2759eb
3 files changed
+123 -7

No files matched your search

+1
View File
@@ -165,6 +165,7 @@ mod skills;
mod skills_extension;
mod spawn_agent_description;
mod sqlite_state;
mod startup_cancellation;
mod step_settings;
mod step_settings_snapshots;
mod stream_error_allows_next_turn;