GeezerVison is showing github.com — feat(web): session import keeps going past the 100-conversation batch limit by mthsmb · Pull Request #32128 · pingdotgg/t3code
Conversation
mthsmb
commented
Nov 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
Each agentSessions.import call imports at most 100 conversation files and 4 GiB per project (MAX_IMPORT_TRANSCRIPTS, MAX_IMPORT_BYTES). The Welcome page makes one call per project. Everything past that budget is counted in skippedCount, and the page reports it the same way as unreadable files: "Imported 100 threads. 153 threads could not be imported."
Nothing is wrong with those conversations, and importing again does bring them in. The only way to get there, though, is the one the docs describe: open the Welcome page again from Settings → About and pick the project in Review all, once per 100 conversations.
Repro on main:
- Have a project with more than 100 Claude Code or Codex conversations from the last 30 days.
- Import it from the Welcome page.
Expected: every conversation is imported, or the page clearly says which ones are left and how to continue.
Actual: the first 100 are imported, and the rest are reported as "could not be imported".
Context: #17484 asked for this ("Import all selected, valid conversations, or clearly identify which hit the limit and offer a way to continue"). #23192 closed it by making the 100,000-record limit apply per transcript, but the per-run transcript and byte budgets still behave as described above. This comment on #17484 describes a project with 308 sessions that needed three manual runs, plus a fourth to confirm nothing was left. Every run ended with a message that read like a failure.
Change
Contract (packages/contracts/src/agentSessions.ts)
AgentSessionImportResult gains an optional deferredCount: the part of skippedCount that the per-attempt budget left for a later attempt.
skippedCount keeps its meaning, the total not imported. An older client talking to a newer server therefore behaves exactly as today.
- A newer client talking to an older server, which omits
deferredCount, runs a single batch as today.
Server (AgentSessionScanner.ts, AgentSessionImporter.ts)
recentThreads emits a new Deferred outcome when the transcript-count or byte budget is exhausted, or when a file does not fit the bytes left in this attempt.
- Real failures stay
Skipped: files over 4 GiB, unreadable files, files without a matching cwd, and unparseable files. The importer counts Deferred in both skippedCount and deferredCount.
- Transcripts that would only use up the budget again are remembered in memory by file identity, so later attempts skip them for free:
- Failures an unchanged file repeats: the per-transcript record limit, the 32 MiB kept-history limit and other parse errors, no cwd, and
parseAgentSessionRecords returning null. readTranscript returns "unimportable" for these.
- Transcripts whose native session already belongs to a T3 thread. The importer has nothing to import for them, so it now passes them to the scanner, which drops them before spending budget. This matters when an existing project is imported again from Settings → About.
- Without these, 100 newer failing or T3-owned sessions would fill every batch, and the conversations behind them would never be reached.
- Failures worth retrying are not remembered: read errors, a file that changes while it is read, and a Codex rollout whose inherited history could not be read.
readTranscript returns null for these.
- A changed file has a new identity and is read again.
Welcome page (WelcomePage.tsx, projectImport.logic.ts)
- For each project, the page calls import again while the previous batch left fewer deferred threads. The strict decrease guarantees the loop ends.
- If a batch makes no progress, the loop stops, and the threads still deferred count as not imported. Another run would stall the same way.
importedCount already includes threads imported by earlier batches, so only each project's last batch is counted. This also stops main's double count when Start imports the same project again on one visit, for example after setup failed to save.
- While batches run:
- a status line under the Projects row shows "Importing (2 of 3)… 100 threads imported, 153 left";
- "Stop importing" takes the bottom-left slot. Stopping takes effect between batches, because an in-flight call cannot be cancelled;
- the "leave the page" notice explains that Stop importing ends the import.
- The summary toast separates threads that "could not be imported" from threads "not imported yet".
- When work is left, after a stop or a failed batch, the page stores the unfinished projects as its saved selection, the same per-computer selection it already keeps until setup finishes. The toast then offers "Continue import", which reopens
/welcome with those projects checked, including projects picked by hand outside the defaults. Opening the page from Settings → About resumes the same way.
Docs: docs/user/welcome-page.md replaces "To continue a large batch, open the Welcome page again and pick the project in Review all" with the new behavior.
Mobile has no session import UI, and no MCP tool exposes this RPC, so there is nothing to change there. Desktop uses the web Welcome page.
Scope and approval
This changes product behavior: import now continues automatically, the Welcome page gains Stop and Continue controls, and the summary wording changes. Under CONTRIBUTING.md that needs explicit maintainer approval of the direction and scope, and this PR does not have it yet.
Please treat this as a proposal until the direction is approved there.
Related open PRs:
Verification
Focused tests:
apps/server/src/project/AgentSessionScanner.test.ts:
- New case "defers transcripts past the per-attempt budget and skips known failures for free". It uses 100 unparseable newest rollouts and 101 valid older ones:
- attempt 1: 100 Skipped and 101 Deferred;
- attempt 2: the failures are skipped for free, then 100 Importable and 1 Deferred;
- attempt 3: a rewritten failure is read again, then AlreadyImported for the rest and the last one Importable;
- attempt 4: the 100 imported transcripts passed as T3-owned are dropped without using the budget.
- The case fails on main, and it fails if either memo is disabled.
- Extended case "skips excessive records without blocking an older valid transcript". The budget is filled ahead of two valid transcripts by one transcript with 100,001 records and 99 rollouts that fail on every attempt (missing inherited history). The second attempt imports the next valid one. It fails if read-limit failures are not remembered, or if the missing-history rollouts are remembered.
- New case "retries a transcript after a read error": a failed open is not remembered, so the next attempt imports the transcript.
apps/server/src/project/AgentSessionImporter.test.ts:
- The counts case now mixes Deferred and Skipped outcomes and expects
deferredCount.
- A second run passes the T3-owned sources to the scanner.
- The exact result assertions include
deferredCount: 0.
apps/web/src/onboarding/projectImport.logic.test.ts: table cases for shouldImportNextBatch (old server, first batch, shrinking, unchanged, done), the progress label and the summary text.
apps/web/src/components/onboarding/WelcomePage.import.browser.test.tsx, new cases:
- batching plus Stop: the second project is not started, and "Continue import" is offered;
- a batch with no progress;
- a failed batch after a successful one, which keeps the counted threads;
- two projects where one server omits
deferredCount;
- Continue import for a project outside the defaults: the action navigates to
/welcome, the reopened page has that project checked, and the next import reuses the existing project;
- Start importing the same project again on one visit does not count its threads twice;
- Start without projects after a failed save does not reuse the earlier summary or resume selection.
Results: scanner 69/69, importer 8/8, web logic 33/33, Welcome page browser 24/24. vp run check:changed passes: format, lint, knip, typecheck (37 packages), tests beside changes (136), and the React compiler check.
Manual: isolated dev servers for main and this branch, each with a temporary base dir, temporary HOME/CODEX_HOME/CLAUDE_CONFIG_DIR, and 253 synthetic Codex sessions in one project (3 of them unparseable). Captured headless with Playwright:
Welcome page, before (main)

Welcome page, after

During import, before (main)

During import, after: progress line and Stop importing

Summary, before (main): "Imported 100 threads. 153 threads could not be imported."

Summary, after: "Imported 250 threads. 3 threads could not be imported."

Stop, after: stopping between batches

Stop, after: "Import stopped. Imported 200 threads. 53 threads were not imported yet." with Continue import

Continue import, after: the page reopened with the unfinished, non-default project checked

Recording of the automatic batches
after-batching.webm
Stopping after the first batch still finishes the batch already in flight, which is why the Stop scenario ends at 200 threads.
Not verified:
- The byte-budget branches (
size > bytesRemaining, an exhausted byte budget, files over 4 GiB). The limits are fixed at 4 GiB, so only the transcript-count budget is covered by tests. Both budgets share the same Deferred path.
Known limits and follow-ups (not in this PR):
- Each batch is a separate
agentSessions.import request, so the agent_session.import feature-usage event fires once per batch.
- Some failures are retried on every attempt and still use budget: importer-side rejections (such as a Claude session ID that cannot be resumed), read errors, and Codex rollouts whose inherited history is missing. If at least 100 of them are newer than the remaining conversations, the page stops and reports the rest as not imported.
- The summary after Continue import counts the project's threads from the earlier visit too, because
importedCount is cumulative (see fix(server): count only newly imported agent threads #31641).
- Pre-existing: a rewound Codex rollout whose inherited history does not fit the remaining byte budget is imported without that history, rather than deferred.
Built with Claude Code using Claude Opus 5.5 and Claude Sonnet 5.5; screenshots captured with Codex using GPT-6.1 Sol.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Approvability
Verdict: Needs Human Approval
Macroscope's review found this PR requires human approval — Import now continues automatically beyond the first batch, with progress and Stop/Continue controls. A maintainer needs to confirm this new default, which can import substantially more history and extend processing after a single user action.
You can add or adjust custom eligibility rules. Learn more.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Walkthrough
-
Agent-session imports now distinguish budget-deferred transcripts from other skipped transcripts. The onboarding wizard imports repeated batches, displays progress, supports stopping, and provides a continuation action when deferred work remains or the import was stopped.
Changes: Agent-session import batching
| Layer / File(s) |
Summary |
Scanner budgets and deferred results packages/contracts/src/agentSessions.ts, apps/server/src/project/AgentSessionScanner.ts, apps/server/src/project/AgentSessionImporter.ts, apps/server/src/project/AgentSessionScanner.test.ts, apps/server/src/project/AgentSessionImporter.test.ts |
The scanner returns Deferred when transcript or byte budgets are exhausted. It caches certain unimportable transcript identities. The importer includes deferredCount in its result and counts deferred outcomes as skipped. |
Batch decisions and import messages apps/web/src/onboarding/projectImport.logic.ts, apps/web/src/onboarding/projectImport.logic.test.ts |
Helpers decide whether to request another batch and format progress and warning messages. Tests cover continuation decisions and message content. |
Onboarding batch flow and controls apps/web/src/components/onboarding/WelcomeWizard.tsx, apps/web/src/components/onboarding/WelcomeWizard.import.browser.test.tsx, docs/user/welcome-wizard.md |
The wizard imports batches, displays progress, supports stopping, and offers continuation when applicable. Browser tests cover batch outcomes. The guide describes import limits and continuation. |
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant WelcomeWizard
participant AgentSessionImporter
participant AgentSessionScanner
WelcomeWizard->>AgentSessionImporter: Import a project batch
AgentSessionImporter->>AgentSessionScanner: Request recent thread outcomes
AgentSessionScanner-->>AgentSessionImporter: Return candidates, skipped outcomes, and deferred outcomes
AgentSessionImporter-->>WelcomeWizard: Return import counts
WelcomeWizard->>AgentSessionImporter: Request another batch when deferred work decreases
Loading
Possibly related issues
- Issue 17484 — The change adds repeated batches and distinguishes budget-deferred conversations from other skipped conversations.
- Issue 24067 — The change reports batch progress and deferred counts, but does not establish the cause of every missing conversation.
- Issue 31677 — The change documents the 100,000-record limit and adds tests for oversized transcripts; it does not provide a per-conversation explanation for that limit.
Possibly related PRs
- PR 31641 — It changes
importedCount, which this PR uses to report import progress and batch totals.
- PR 27215 — Both changes affect whether repeated scans can reach older transcripts.
- PR 28842 — It changes the
/welcome flow and adds a progress stream returning AgentSessionImportResult, which this PR extends.
Suggested reviewers: juliusmarminge
Merge Risk: Low · up to af79b
-
Imports now continue across batches and can be stopped and resumed. Minor edge cases remain, such as Continue import reselecting projects that failed outright. These are bounded and do not block merging, though the maintainer's product approval is still pending.
Pre-merge checks: 3 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Description check |
 |
The description fully covers the problem, change, verification, manual evidence, limitations, and UI screenshots. However, the Scope and approval section states that this product-behavior change has n… |
Obtain and link explicit maintainer approval for the proposed direction and scope, including the approval comment, or narrow the change to an approved scope and update the description accordingly. |
Passed checks: 3 passed
-
| Check name |
Status |
Explanation |
| Title check |
 |
The title clearly describes the main change: continuing session imports beyond one batch. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Description check
-
Explanation
The description fully covers the problem, change, verification, manual evidence, limitations, and UI screenshots. However, the Scope and approval section states that this product-behavior change has no explicit maintainer approval yet, which the repository template requires.
Resolution
Obtain and link explicit maintainer approval for the proposed direction and scope, including the approval comment, or narrow the change to an approved scope and update the description accordingly.
Finishing Touches
-
Generate unit tests (beta)
-
- 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 9fe2ada48b6e25fe3f9afe42ef64510612652c73 and af79b67b6a5aa289d77d17c2b07eda0a981e4bb5.
Files selected for processing: 5
-
apps/server/src/project/AgentSessionScanner.test.ts
apps/server/src/project/AgentSessionScanner.ts
apps/web/src/components/onboarding/WelcomeWizard.import.browser.test.tsx
apps/web/src/components/onboarding/WelcomeWizard.tsx
docs/user/welcome-wizard.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Action performed
-
Review finished.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This PR conflicts with main. Rebase it or merge main into it. If it still conflicts after 7 days with no activity, it will be closed automatically.
See the conflict window.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
This has been a draft with no activity for more than three days, so it is being closed: the open pull requests are kept to work that is ready to be looked at.
Nothing is lost, the branch stays. When the work is ready, open a new pull request for it; this one will not be reopened.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
needs-rebase
Conflicts with its base branch. Closes after 7 days with no activity.
size:L
100-499 changed lines (additions + deletions).
vouch:unvouched
Author is not yet trusted in the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|