Skip to content

fix(chat): follow Claude continued transcripts - #779

Merged
devswha merged 5 commits into
devswha:mainfrom
vibewriter-hand:fix/claude-follow-continued-in
Oct 11, 2026
Merged

devswha merged 5 commits into
devswha:mainfrom
vibewriter-hand:fix/claude-follow-continued-in

Conversation

@vibewriter-hand

Copy link
Copy Markdown
Contributor

Summary

  • follow Claude Code continued-in transcript records until the active session file
  • keep the existing project scan and reject malformed or cyclic continuation ids
  • add a two-hop continuation regression fixture

Evidence

The affected session file contained seven metadata records, including continued-in, and no user or assistant turns. The active transcript is stored under the continued session id.

Tests

  • bun test ./server/claude-store.test.ts
  • bun test ./server/conversation.test.ts ./server/claude-session.contract.test.ts
  • bun run typecheck

@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c53d32fa-0103-42c3-a15c-d7251b1004df

📥 Commits

Reviewing files that changed from the base of the PR and between 6c6820f and 8e4b042.


You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d9fef0b1-646d-4259-9db4-aec680e2dfd7


📥 Commits

Reviewing files that changed from the base of the PR and between d8da207 and 6c6820f.



📒 Files selected for processing (3)
  • CHANGELOG.md
  • server/claude-store.test.ts
  • server/claude-store.ts


Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.




📝 Summary

Summary by CodeRabbit

  • New Features
    • Transcript lookup follows session continuations to the active transcript, including across multiple links.
  • Bug Fixes
    • Lookup keeps the original transcript when newer turns follow a continuation record or the referenced transcript is missing. It also stops safely if a continuation cycle is detected.
    • Unreadable transcripts remain available to the reader to report, while malformed or incomplete continuation records are ignored.
📝 Summary

Walkthrough

claudeTranscriptFile now follows valid continuation IDs to locate the continued transcript. It retains the current transcript if the continuation is missing, forms a cycle, or later turns clear the continuation record. Tests cover these cases and unreadable transcripts.

Changes

Claude transcript continuation lookup

Layer / File(s) Summary
Validate and parse continuation records
server/claude-store.ts
A case-insensitive UUID pattern validates session IDs. The continuation reader examines up to 64 KiB from the transcript end, ignores an initial partial line and malformed entries, and clears a continuation candidate when later user or assistant entries appear.
Resolve continued transcripts
server/claude-store.ts, server/claude-store.test.ts, CHANGELOG.md
claudeTranscriptFile reuses session-file lookup and follows continuation IDs. It returns the current transcript when no continuation is available, the next file is missing, or a cycle would form. Tests cover multi-step chains, newer turns, missing files, and unreadable transcripts. The changelog records the continuation behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Bug fix · Severity of issue fixed: Low

Suggested reviewers: devswha



Merge Risk: ⚪ Minimal · up to 6c682

No actionable merge-blocking risk is established for the continued-transcript change; it is mergeable after normal checks.

Security Architecture Review

Security architecture risk: 🟡 Moderate · up to cb2ed

The new lookup reads and scans entire conversation files on every refresh, before page limits or caching apply. Large sessions or repeated requests could consume substantial memory and affect other server activity. No new account-boundary bypass was established.

Retained concerns

  • Medium · reliability · inferred: Continuation discovery loads and splits every visited transcript without a byte or hop budget, including ordinary active transcripts with no continuation. Repeated conversation reads therefore perform session-sized allocations before pagination and caching can contain the work. Large transcript content can impose memory and synchronous scanning costs on the shared backend.
Security review details

Security Blast Radius

  • inferred — The introduced resource risk is not limited to sessions containing continuation metadata: every resolved Claude transcript is fully scanned. Its potential impact is shared-backend availability rather than demonstrated privilege gain or cross-account disclosure. Repeated requests multiply the work before unchanged responses can return 304.

Security Findings and Attack Paths

  • inferred — A requester able to reach conversation reads for a large Claude transcript can trigger repeated whole-file allocation and scanning without forging continuation metadata. The cost follows transcript size and chain length. The read remains behind the existing request-access decision; unauthenticated exploitation and production resource-exhaustion thresholds were not established.

Trust Boundaries and Controls

  • observed — The initial session is obtained from the pane's reported agent identity or a live-process fallback and must be UUID-shaped. Store selection prefers the Claude process's configuration, and ambiguous store selection fails rather than guessing. Continuation values cannot directly replace configDir or inject path separators.
  • inferred — Forged top-level metadata could redirect lookup to another project in the selected store, but this requires control over transcript records, not merely message text. Project scanning and symlink-following file checks predate the PR. Without a project-isolation contract or evidence of a lower-trust transcript writer, this is not retained as an introduced authorization vulnerability.

Resilience and Maintainability Implications

  • observed — The existing conversation reader scans history controls in bounded chunks and retains incremental offsets. Page reads are also bounded, but continuation discovery precedes these protections and does not reuse their resource controls.

Hardening Proposals

  • proposed — Use bounded-memory continuation scanning with file-identity-aware incremental state, rescan torn tails on append, and invalidate on replacement or truncation. Add an explicit traversal-work budget whose exhaustion reports unresolved history rather than guessing an active transcript.









Pre-merge checks | Passed 4 | Failed 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: following Claude continued transcripts.
Description check Passed The description explains the problem and resulting behavior, and it lists relevant test commands and results. It uses Summary and Tests instead of the template headings Change and Validation, but it p…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


Full details: Docstring Coverage

Explanation

Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 unsupported.)




✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR



  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vibewriter-hand
vibewriter-hand force-pushed the fix/claude-follow-continued-in branch from cb2ed4f to 16e5434 Compare October 11, 2026 03:32
@vibewriter-hand
vibewriter-hand force-pushed the fix/claude-follow-continued-in branch from 16e5434 to d8da207 Compare October 11, 2026 03:35
@vibewriter-hand

Copy link
Copy Markdown
Contributor Author

Thanks for the CodeRabbit scan-cost note. A bounded rework follows.

…ewer turns

Codex review on devswha#779: the whole active transcript was reread on every
lookup, a continued-in record followed by newer turns still redirected,
an unreadable transcript threw instead of reaching its reader, and a
continuation whose file is missing dropped the transcript that named it.
@devswha
devswha merged commit 476ee17 into devswha:main Oct 11, 2026
13 checks passed
devswha added a commit that referenced this pull request Oct 14, 2026
… transcript (#1057)

Fixes #1021

## Root cause
`claudeTranscriptFile` in `server/claude-store.ts` (the continued-in
loop, ~L350 on main) follows a `continued-in` record only when the named
session has a transcript; otherwise it "keeps the transcript that named
it". A `/resume` of a Claude Code session that runs in the background
parks the pane on a continuation id (`parkedJobId`) that never gets a
transcript, so the pane stayed on its near-empty interactive transcript
(just `/resume`, its output and the record), and Chat was empty while
the terminal showed the whole conversation. The gap came in with #779,
which only follows continued-in ids whose file exists.

## What changed
- `server/claude-store.ts`: the 64 KiB tail read is factored into
`transcriptTail`; a new `backgroundJobTranscript` runs only when the
continuation names no file. It reads the last `running in the background
(<8 hex>)` from the same tail, takes the single `<8 hex>-*.jsonl` in the
same project folder (none or more than one: no change), and, when
`<config dir>/jobs/<8 hex>/state.json` names a `linkScanPath`, requires
it to be that file. Any miss keeps today's behavior (the current
transcript).
- `server/claude-store.test.ts`: three cases with the issue's fixture,
each labelled: following the job id (regression: fails on main), no or
ambiguous prefix match keeps the current transcript (control), and the
state.json cross-check (regression for the match; the mismatch is a
control).
- `changelog.d/claude-resume-background-session.md`: Fixed entry.

## Before / after
- The new tests against main's `claude-store.ts`: 2 fail (both
regression-labelled cases resolve the pane's own `a21fe37a-…` transcript
instead of the job's `8b80137e-…`). On this branch: 42 pass, 0 fail.
- A standalone script with a temp `HOME` built from the issue (pane
transcript ending in the `/resume` output and a `continued-in` record to
a missing id, plus the job's `8b80137e-…jsonl`) calling the exported
`claudeTranscriptFile`: main resolves the near-empty pane transcript;
the branch resolves `8b80137e-…jsonl`. Edge cases on the branch: two
`8b80137e-*` files, no job file, no continued-in record, a mismatched
`linkScanPath` and an unknown job id all keep the current transcript; a
continuation whose file exists is still followed as before; a matching,
absent-field or malformed `state.json` follows the job.

## Checks
- `bun run typecheck`: pass
- `HERDR_TEST_MODE=unit bun test ./server/claude-store.test.ts`: 42
pass, 1 skip (platform), 0 fail
- `bun run test:unit`: 3518 pass, 0 fail, 8 skip in 285 files
- `bun test ./server/claude-session.contract.test.ts` on an isolated
herdr session: 10 pass, 0 fail

Not covered: opening a background session from the agent view with
Enter, which may leave no record in the pane's transcript (called out in
the issue as a separate case). No live Claude Code background session
was driven; fixtures follow the issue's file shapes.
@vibewriter-hand
vibewriter-hand deleted the fix/claude-follow-continued-in branch November 7, 2026 07:54
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