fix(claude): explain missing-transcript resume failures; add t3 session audit|reset - #52
Open
DanielGGordon wants to merge 1 commit into
Open
fix(claude): explain missing-transcript resume failures; add t3 session audit|reset#52DanielGGordon wants to merge 1 commit into
t3 session audit|reset#52DanielGGordon wants to merge 1 commit into
Conversation
…ion audit|reset` Sending in a Claude thread whose persisted resume cursor points at a transcript that no longer exists on this host (imported from another machine, host reprovisioned) failed with the generic "Claude runtime stream failed." The actual cause — the CLI's `No conversation found with session ID: <id>` — was emitted one event earlier and then overwritten, so the thread gave no hint at what was missing or how to recover. Adapter: recognise the CLI's missing-transcript result, emit a runtime error that names the session id and the expected `~/.claude/projects/<cwd>/<id>.jsonl` path plus the two ways out (restore the file, or `t3 session reset`), and keep that message through the subsequent stream exit instead of replacing it. The resume cursor is deliberately left intact so the transcript can still be restored from wherever the conversation ran. CLI: `t3 session audit` lists every Claude thread whose transcript is missing (or relocated) with the path to restore; `t3 session reset <threadId>` prints the current cursor and, only with `--yes`, clears it so the thread starts a fresh Claude session. Both run offline against the state DB and are safe while the server is serving (WAL; bindings are re-read on every session start). The offline CLI runtime layer previously private to `t3 import` is shared. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
Test deploymentThis branch is running on test slot 7448 with a copy of the prod threads (so the stale-cursor threads are there to try). Pairing link: https://15.204.108.12:7448/pair#token=9DHXVHVUCX8R To see the change: open a Claude thread whose transcript is missing (e.g. "Install Cursor CLI" or any CLI, from the worktree on the server: node apps/server/src/bin.ts session audit # read-only list of affected threads + paths to restore
node apps/server/src/bin.ts session reset <threadId> # dry run; add --yes to actually clear the cursorSlot: external 7448 ⇄ loopback 3778. |
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.
Problem
Sending in a Claude thread whose persisted resume cursor points at a transcript that no longer exists on this host failed with only "Claude runtime stream failed." The real cause — Claude Code's
No conversation found with session ID: <id>— was emitted one event earlier and then overwritten by the generic stream-exit error, so the thread gave no hint at what was missing or how to recover. Found on prod thread89de3af4…("Second Brain Architecture Review"); an audit of the prod DB shows 72 non-deleted Claude threads (43 unarchived, mostlyclaude-import-*from another machine) in the same state.Changes
Adapter (
ClaudeAdapter.ts,claudeSessionTranscript.ts)resulterror and emit a runtime error that names the session id, the expected~/.claude/projects/<encoded cwd>/<id>.jsonlpath, and the two ways out (restore the file and resend, ort3 session reset <threadId>). Detail payload carriesreason: "resume_transcript_missing".CLI (
cli/session.ts, sharedcli/offlineRuntime.ts)t3 session audit [--json] [--include-deleted] [--all] [--projects-dir]— lists every Claude thread whose transcript is missing (or relocated under a different project folder) with lifecycle, title, cwd, session id and the exact path to restore. Read-only.t3 session reset <threadId> [--yes]— prints the current cursor (so it can be restored by hand) and only clears it with--yes.t3 importis now shared.Docs: README feature bullet, AGENTS.md ops section.
Verification
tsgo --noEmitclean;vp lintclean;vp fmt --checkclean.claudeSessionTranscript.test.ts(encoding, error parsing, message),cli/session.test.ts(binding → target, lifecycle, row formatting),ClaudeAdapter.test.ts("explains a resume whose transcript is missing and keeps that explanation on stream exit").apps/serversuite: 1777 passed; the single failure (server.test.ts > preserves structured workspace rpc failures) is pre-existing and fails identically onmain.t3 session auditagainst the live prod DB: 137 Claude threads with cursors → 65 present, 0 relocated, 72 missing, ~4s.t3 session resetdry run verified to leave the row untouched; on a thread with no cursor it reports "nothing to reset".🤖 Generated with Claude Code