Skip to content

fix(server): find Claude session directories after large images - #42640

Open
StiensWout wants to merge 8 commits into
pingdotgg:mainfrom
StiensWout:wf/find-0127c20e9d674d422ccc62b8
Open

StiensWout wants to merge 8 commits into
pingdotgg:mainfrom
StiensWout:wf/find-0127c20e9d674d422ccc62b8

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

Recent Claude sessions could be missing from import when a large inline image pushed the working directory beyond the first 1 MiB of the transcript. The scanner gives every candidate its initial scan, then resumes deferred Claude transcripts in bounded rounds from where it left off. This preserves older sessions found in the initial scan and gives smaller deferred sessions a chance to finish alongside oversized files.

Related: #40549, #23727, #40192, #21598, #27656, #42613, #25923, #34542, #23214

Reproduction on main

Commit 03fa7cfc10 (main). The session is absent from the imported history. Expected: The session imports with the rest of the workspace’s recent Claude history.

The cause is at apps/server/src/project/AgentSessionScanner.ts:1309. Ran cd apps/server && pnpm exec vp test run src/project/AgentSessionScanner.test.ts with the repro test added: it failed in 2 of 2 runs on a clean checkout, with expected [] to deeply equal [ 'large-image-session' ] in the output.

Evidence

Environment: Linux x64, the repository's own tests.

Proven: the repro fails at the test commit 593e9c4c3b and passes on the head 5474f721f5, both on main c925b9ab19.

Before After
Commit 593e9c4c3b 5474f721f5
Result failed with "expected [] to deeply equal [ 'large-image-session' ]" passed

Outside view: not shown in the running app. It fails “The app gets there by itself.” The session is dropped only when its working directory sits past the first 1 MiB of the session file. The repro builds that by writing the directory after the screenshot. Claude writes the directory before the message, and a first screenshot larger than 1 MiB in that layout is still imported, so sending one never puts the file in the missing state.

Tests

  • 593e9c4c3b adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed c925b9ab198099f67de862ed01701bd1d8809f2b passed on head.

Not in this change

  • Claude metadata reads still share a fixed per-source budget. A transcript can be skipped if the budget runs out before its working directory is found.
  • The scanner uses the working directory recorded in each transcript because a sibling transcript’s directory does not establish where the session ran.
  • The field-order cases use transcript fixtures. Whether current Claude Code writes the working directory after an inline image remains unverified.

Who did the work

  • Repro written by GPT 6.2 Sol, in Codex
  • Outside view by Grok 4.7, in Grok
  • Duplicate check judged by Claude Opus 5.5, in Claude Code
  • Written by GPT 6.2 Sol, in Codex
  • Trimmed by Claude Opus 5.5, in Claude Code
  • Reviewed by Claude Opus 5.5, in Claude Code, and by GPT 6.2 Sol, in Codex, and by Gemini 4 Neon, in Antigravity
  • Reproduction, checks and proof run by a program on base and head, not by an agent

Made in T3 Code by GPT 6.2 Sol, Claude Opus 5.5, Grok 4.7 and Gemini 4 Neon

StiensWout and others added 6 commits November 25, 2026 06:29
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Drops the separate pending index list; each round walks the scan results
and resumes the ones still deferred.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L 100-499 changed lines (additions + deletions). labels Nov 25, 2026
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The scanner now reads transcript cwd data in resumable slices. It applies metadata budgets, checks transcript identity when resuming, and processes deferred scans in rounds. Tests cover large Claude images and shared metadata-budget cases.

Changes: Claude transcript scanning

Layer / File(s) Summary
Resumable cwd scanning and coverage
apps/server/src/project/AgentSessionScanner.ts, apps/server/src/project/AgentSessionScanner.test.ts
readCwd resumes Claude scans across slices and marks other sources truncated when they reach the byte limit. Cwd grouping resumes deferred scans in rounds and reuses imported cwd only when the non-Codex provider and transcript identity match. Tests cover 1,100 KiB images, cwd placement, and shared metadata budgets.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to f0211

This change lets recent Claude sessions be found when their working directory appears after a large image in the transcript. No actionable merge-blocking risk was identified in the supplied context.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its trigger: Claude session directories not found after large images. The changeset adds incremental, round-based resumption of deferred Claude transcripts in AgentSessionS…
Description check Passed The description follows the template sections. It states the problem, the change, the reproduction and evidence, and the verification steps. It also lists limits and open items. The Scope section give…
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: Title check

Explanation

The title names the fix and its trigger: Claude session directories not found after large images. The changeset adds incremental, round-based resumption of deferred Claude transcripts in AgentSessionScanner, which addresses this. The title follows the conventional commit format and fits the change.

Full details: Description check

Explanation

The description follows the template sections. It states the problem, the change, the reproduction and evidence, and the verification steps. It also lists limits and open items. The Scope section gives no linked issue that shows the bug. It lists several related issue numbers, but none is marked as the bug report, and it does not say why a small fix needs no issue. The Problem section describes the symptom and the cause, but it does not give a clear expected-versus-actual summary for end users. The description also contains a long attribution block that the template does not require. These gaps are minor, so the check passes.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 5474f72 and f0211e2.

Files selected for processing: 1

  • apps/server/src/project/AgentSessionScanner.test.ts

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

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 25, 2026
juliusmarminge and others added 2 commits November 25, 2026 05:48
…d422ccc62b8

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Moves the budget cases into AgentSessionScanner.test.ts on its existing helpers and drops the eight-transcript case, which a sequential reader also passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

The automated pipeline stopped on this pull request and will not merge it:

the fix is written and reviewed, but proving it needs something no worker has:

  • Permanent blocker: the reproduction requires authenticated real Claude Code to create the text-only, one-image, and six-image transcripts. First-party Claude OAuth is explicitly unavailable on these workers, and the isolated CLI confirmed it was not logged in. Discovery and import on both base and head remain unverified.

It stays open for a person to finish or close.

@juliusmarminge juliusmarminge added takeover:blocked Takeover blocked; reason in the PR body and removed takeover:in-progress A takeover lead is working on this PR labels Nov 25, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). takeover:blocked Takeover blocked; reason in the PR body vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants