Startup recovery could leave approval or question transcript records waiting after retiring their process-bound request. Detaching a thread from a shared provider session could also accept queued request artifacts after cleanup.
Select and cancel linked stale artifacts during recovery. Serialize detach cleanup with request-event ingestion, reject late request artifacts for removed attachments, and preserve sibling requests, the shared process and its credential. Detach now persists an explicit cancellation explanation without adding a session-release enum value. Requests remain not_resumable; preserving old native approvals after interrupt and thread unload remains a maintainer lifecycle decision.
Verification:
- Five focused persistence/recovery/session suites passed 117 tests after the first upstream merge.
- With dependencies aligned, the session suite passed 47 tests. After merging captured main
4ee6bfd50e, both affected recovery suites passed 21 tests.
- Real SQLite and Deferred cases cover failed detach commits and retry, late runless and turn-scoped artifacts, and sibling preservation. The late-artifact test fails on the previous published implementation.
- Scoped server typecheck and changed-file lint/format passed. No live-client verification was performed.
Draft for maintainer scope review. No prior maintainer approval is claimed.
Implemented with GPT-6.1 Sol through Codex. Audited with Ling 3.1 Flash Free and Space Bunny through OpenCode, plus Codex integration reviews.
Replaced by https://github.com/pingdotgg/t3code/pull/15778 under the requested eight-PR split. The existing implementation was reused on clean independent branches against main; the original branch and commits are retained for provenance.