Skip to content

fix(server): keep the first request title in long Claude imports - #42679

Closed
StiensWout wants to merge 4 commits into
pingdotgg:mainfrom
StiensWout:wf/find-9cca73964a78360ec3b0c1e4
Closed

StiensWout wants to merge 4 commits into
pingdotgg:mainfrom
StiensWout:wf/find-9cca73964a78360ec3b0c1e4

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

Long Claude sessions without a usable saved title could be imported under a later topic when they opened with a bare command. The importer now captures the first usable request before trimming the message history. It stores a copy of the shortened title so that the title cannot keep an otherwise discarded prompt in memory.

Related: #41878, #25923

Reproduction on main

Commit ca81b7b97a (main). The title comes from a later request about deployment checks. Expected: The imported thread is titled after the first request about the login redirect.

The cause is at apps/server/src/project/AgentSessionScanner.ts:812. 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 'Review deployment check 1' to be 'Fix the login redirect' // Object.is equality in the output.

Evidence

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

Proven: the repro fails at the test commit 97c4f55bcf and passes on the head c661896cdf, both on main d8354f83e4.

Before After
Commit 97c4f55bcf c661896cdf
Result failed with "expected 'Review deployment check 1' to be 'Fix the login redirect' // Object.is equality" passed

Outside view: not shown in the running app. It fails the rule that the app gets there by itself. The later topic becomes the title only when the session has no usable saved title, a state the repro builds by writing the transcript without one; a person who starts Claude with a bare command, sends the login-redirect request, and continues for more than 200 messages leaves a saved title, and the imported thread shows that title.

Tests

  • 97c4f55bcf adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed d8354f83e4ea21edcf40f36eef67266e7c77da71 passed on head.

Not in this change

  • Saved Claude titles and user renames retain precedence over the fallback title.
  • Message retention limits and title truncation rules are unchanged.
  • Codex and Pi title derivation are outside this Claude import fix.

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 4 commits November 25, 2026 08:26
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
…changed

The fold already supplies the first request title, so the retainMessage
rewrite and the dropped titleText argument were not needed.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: GPT 6.2 Sol <codex@openai.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 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 Claude transcript scanner now retains the first visible user request as the derived thread title. A test covers a transcript that begins with a bare /effort command.

Changes: Claude transcript title derivation

Layer / File(s) Summary
Capture and use the first request title
apps/server/src/project/AgentSessionScanner.ts, apps/server/src/project/AgentSessionScanner.test.ts
The scanner stores the first visible user title and uses it to initialize the derived title. The test checks that a bare /effort command does not become the imported thread title.

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

Change: Bug fix

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · up to c6618

This change makes long Claude imports use the first real request as the thread title instead of a later request. Saved titles and renames keep precedence. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(server): keep the first request title in long Claude imports" matches the main change. The diff keeps the first usable Claude request as the imported thread title, so the title is relat…
Description check Passed The description covers the Problem, Change, Scope, and Verification sections. It explains the bug, the cause at AgentSessionScanner.ts, the fix, and the failing-then-passing repro test with commit ref…
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 "fix(server): keep the first request title in long Claude imports" matches the main change. The diff keeps the first usable Claude request as the imported thread title, so the title is related to the changeset. It follows the conventional commit style used by the repository template.

Full details: Description check

Explanation

The description covers the Problem, Change, Scope, and Verification sections. It explains the bug, the cause at AgentSessionScanner.ts, the fix, and the failing-then-passing repro test with commit references and the test command. It links related issues #41878 and #25923 and explains the scope as a bug fix. It also lists tools and models used, which the template requests. It does not include a separate Scope rationale for why no issue is needed beyond the related links, and the Verification section is detailed. Overall the description is mostly complete.

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 024da4f and c661896.

Files selected for processing: 2

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

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

@juliusmarminge

Copy link
Copy Markdown
Member

Thanks for this. #42681 makes the same change and is the one being kept.

#42681 also captures the first usable prompt before trimming Claude history, covering this fallback-title case. It additionally handles shell-only sessions and tests prompt-title preservation beyond the retained history, so it is the more complete change to keep.

Your explicit copy of the shortened title remains useful: it prevents a discarded prompt's backing string from staying in memory. That safeguard could be carried into the kept PR.

Closing as a duplicate.

@StiensWout
StiensWout deleted the wf/find-9cca73964a78360ec3b0c1e4 branch November 25, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). 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