Skip to content

fix(server): import Claude sessions with only shell commands - #42681

Open
StiensWout wants to merge 7 commits into
pingdotgg:mainfrom
StiensWout:wf/find-3eefd6662213fa21af73d8c4
Open

StiensWout wants to merge 7 commits into
pingdotgg:mainfrom
StiensWout:wf/find-3eefd6662213fa21af73d8c4

Conversation

@StiensWout

Copy link
Copy Markdown
Contributor

T3 Code skipped Claude Code sessions that ran local shell commands without a model reply. The importer now captures the first title-bearing prompt and the first nonblank shell command before limiting message history. Saved titles and prompt-derived titles take precedence, and the shell command can name a shell-only session.

Related: #23727, #41878, #34043, #25923

Reproduction on main

Commit ca81b7b97a (main), in the running web app:

  1. In Claude Code settings, turn off respond to bash commands so a shell command gets no model reply.
  2. In a new folder that has no earlier Claude sessions, start a new Claude Code session.
  3. Type !pwd, run it, and wait until the working directory prints and Claude stays silent.
  4. Quit Claude Code.
  5. Start T3 Code and wait until the Welcome page is showing.
  6. Select that folder and start the import.
  7. When setup finishes, open the project and look at its threads.

A warning titled Some history was not imported says that one thread could not be imported. The project has no thread for that session, and !pwd is not in any history. Expected: The project has a thread titled !pwd, and opening it shows !pwd in its history.

The cause is at apps/server/src/project/AgentSessionScanner.ts:745. 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 null to deeply equal { title: '!pwd', texts: [ '!pwd' ] } in the output.

Evidence

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

Proven: the repro fails at the test commit fcf9d96d32 and passes on the head c1b01235e5, both on main 024da4f7bf.

Before After
Commit fcf9d96d32 c1b01235e5
Result failed with "expected null to deeply equal { title: '!pwd', texts: [ '!pwd' ] }" passed

Outside view: a person sees it in the running web app by following the steps under Reproduction on main.

Tests

  • fcf9d96d32 adds the failing test, alone, before the fix.
  • pnpm exec vp run check:changed 024da4f7bfa49973baddb35f39aa95f4ec20222c passed on head.

Not in this change

  • The existing history limit still applies to prompt and command messages, and shell output remains filtered.
  • Bare slash commands and sessions with only synthetic replies keep their existing handling.

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 7 commits November 25, 2026 08:33
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>
The gate requires the repro test file to stay as the test commit left it,
so the shell cases stay in their own file.

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:M 30-99 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

Claude transcript parsing now derives titles from prompt and shell-command text. Shell-only sessions can import with the shell command as the thread title. Tests cover imported titles and omitted-message counts.

Changes: Claude shell-history import

Layer / File(s) Summary
Parse Claude prompt and shell text
apps/server/src/project/AgentSessionScanner.ts
Claude parsing extracts prompt and shell-command titles. Shell input retains its !-prefixed display text, and Claude message handling uses the visible text directly.
Select imported thread title and eligibility
apps/server/src/project/AgentSessionScanner.ts, apps/server/src/project/AgentSessionScanner.test.ts, apps/server/src/project/AgentSessionScanner.claudeShell.test.ts
Claude shell-command titles are a fallback for imported-thread titles and prevent shell-only sessions from being rejected for having no assistant message. Tests cover shell-only imports, title selection, and omitted-message counts.

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

Change: Bug fix

Possibly related PRs

  • pingdotgg/t3code#39527: Changes how synthetic error replies affect session reply classification, which relates to importing sessions without a model reply.
  • pingdotgg/t3code#42674: Changes Claude shell-command and output detection in transcript parsing.
  • pingdotgg/t3code#33403: Changes title selection and bare-command handling in Claude transcript imports.

Suggested labels: bugfix

Suggested reviewers: dominikzabcik, macroscopeapp, juliusmarminge

Merge Risk: Minimal · up to c1b01

This change lets Claude sessions that contain only local shell commands import, using the first command as the thread title. It has a narrow scope, existing title precedence is preserved, and tests cover the new cases. No actionable merge risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and the affected area: the server now imports Claude sessions that contain only shell commands. The raw summary confirms the change adds shell-command title derivation and a sh…
Description check Passed The description covers the problem, the change, the reproduction steps, the scope (linked related issues and a bug-fix framing), and verification with focused test results, and it names the models and…
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 the affected area: the server now imports Claude sessions that contain only shell commands. The raw summary confirms the change adds shell-command title derivation and a shell-only import path in AgentSessionScanner.ts, with tests for the case. The title is specific and matches the main change, and it uses a conventional commit prefix.

Full details: Description check

Explanation

The description covers the problem, the change, the reproduction steps, the scope (linked related issues and a bug-fix framing), and verification with focused test results, and it names the models and harness used. It follows the template's section structure in substance. It has no explicit statement on why no issue is linked beyond the 'Related' list, but the related issues are given, so the template's scope requirement is met in substance. The description is detailed and 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 c1b0123.

Files selected for processing: 3

  • apps/server/src/project/AgentSessionScanner.claudeShell.test.ts
  • 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; 1 remain after this review.

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:M 30-99 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.

1 participant