Skip to content

feat(web): import recent Codex and Claude threads during onboarding - #8066

Merged
t3dotgg merged 7 commits into
t3code/overhaul-onboarding-flowfrom
t3code/import-recent-agent-thread-history
Aug 31, 2026
Merged

feat(web): import recent Codex and Claude threads during onboarding#8066
t3dotgg merged 7 commits into
t3code/overhaul-onboarding-flowfrom
t3code/import-recent-agent-thread-history

Conversation

@t3dotgg

@t3dotgg t3dotgg commented Aug 24, 2026

Copy link
Copy Markdown
Member

Project onboarding discovers existing Codex and Claude projects, but leaves their conversations behind.

Import threads active within the last 30 days with their visible messages and provider resume state. Malformed or oversized sessions are skipped, custom provider accounts stay matched, and imported history does not create Git checkpoints.

Focused scanner, importer, orchestration, projection, relay, onboarding, and server RPC tests passed. Scoped type checks also passed for server, web, desktop, mobile, contracts, and client-runtime. No browser or native-client verification was run.

Made by GPT-5.6 Sol using Codex in T3 Code.


Note

Medium Risk
Touches orchestration commands, projections, provider runtime persistence, and onboarding import retries; mistakes could corrupt thread state or clobber live provider bindings, though idempotency and on-conflict-ignore paths are heavily tested.

Overview
Onboarding and a new agentSessionsImport RPC now pull in Codex and Claude conversations from the last 30 days, not just project roots. The server scans JSONL transcripts (size-capped, parsed for visible user/assistant text), then importRecentAgentThreads creates or reuses threads, dispatches thread.history.import, and stores provider resume bindings without overwriting an active session.

Imported history is modeled as thread.message-sent events tagged with historyImport, followed by thread.settled. That path skips Git checkpoints, does not mark threads as queued work in projections, and is excluded from agent-awareness “settled” notifications. isImportedAgentSessionMessageId keeps imported messages across reverts and out of live turn/queue logic on server and client.

The welcome wizard creates projects idempotently (stable command IDs and path resolution) and runs thread import after each project; scan candidates can include projectId for already-imported workspaces so history can still be backfilled.

Reviewed by Cursor Bugbot for commit 52aeac1. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Import recent Codex and Claude threads during onboarding

  • Scanner discovers transcripts from Claude and Codex home directories within a 30-day window, parses JSONL into normalized threads, and deduplicates by provider instance and session ID
  • importRecentAgentThreads creates missing orchestration threads, imports historical messages, and persists provider-session bindings; per-thread failures are logged and skipped
  • New thread.history.import orchestration command emits thread.message-sent events with metadata.historyImport=true then a thread.settled event; only allowed on active, empty threads
  • Imported messages are excluded from queued-turn detection, checkpoint creation, agent awareness relay publishing, and turn-count balancing during reverts
  • Risk: partitionOnboardingProjects in projectImport.logic.ts no longer returns alreadyImportedCount and includes already-imported projects in available/recent sets; ProviderSessionDirectory.upsert and ProviderSessionRuntimeRepository.upsert gain an optional options parameter

Macroscope summarized 52aeac1.

@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: ea1d009b-29f9-4179-964a-5fbd7691ab25

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

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

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Aug 24, 2026
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.3 KiB 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.4 KiB 7.8 KiB
Codex Live turn WebSocket decoded 55.6 KiB 66.4 KiB
Codex Live turn messages 11 21
Claude Total thread wire 13.4 KiB 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 7.8 KiB
Claude Live turn WebSocket decoded 56.4 KiB 66.4 KiB
Claude Live turn messages 11 21

Baseline: unavailable · PR result: 52aeac1 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Comment thread apps/server/src/project/AgentSessionScanner.ts
Comment thread apps/server/src/orchestration/decider.ts
Comment thread apps/server/src/ws.ts Outdated
Comment thread apps/web/src/components/onboarding/WelcomeWizard.tsx Outdated
Comment thread apps/server/src/orchestration/decider.ts
Comment thread apps/server/src/project/AgentSessionScanner.ts Outdated

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One finding: the new agentSessions.import handler treats ProviderSessionDirectory as an optional service and fabricates an AgentSessionScanError when it is absent, even though that service is provided in the same context as ProviderService. See the inline comment.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/ws.ts Outdated
Comment thread apps/server/src/project/AgentSessionImporter.ts Outdated
Comment thread apps/web/src/components/onboarding/WelcomeWizard.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR introduces a substantial onboarding capability that reads and persists recent Claude and Codex conversation history, then reconnects those threads to provider sessions. Its cross-layer orchestration, persistence, resume behavior, and sensitive transcript handling warrant human review.

You can add or adjust custom eligibility rules. Learn more.

Comment thread apps/server/src/project/AgentSessionImporter.ts Outdated
@t3dotgg
t3dotgg force-pushed the t3code/overhaul-onboarding-flow branch from d6a53bc to d02d817 Compare August 25, 2026 08:55
Comment thread apps/server/src/project/AgentSessionScanner.ts Outdated
Comment thread apps/server/src/project/AgentSessionScanner.ts Outdated
@t3dotgg
t3dotgg force-pushed the t3code/overhaul-onboarding-flow branch from d02d817 to 8468b95 Compare August 25, 2026 09:56
@t3dotgg
t3dotgg force-pushed the t3code/import-recent-agent-thread-history branch from 3d037e6 to e2725bb Compare August 25, 2026 10:56
Comment thread apps/web/src/components/onboarding/WelcomeWizard.tsx
Comment thread apps/web/src/components/onboarding/WelcomeWizard.tsx
Comment thread apps/server/src/project/AgentSessionImporter.ts Outdated
Comment thread apps/server/src/orchestration/decider.ts
Comment thread packages/contracts/src/agentSessions.ts Outdated
Comment thread apps/server/src/project/AgentSessionScanner.ts Outdated
Comment thread apps/server/src/project/AgentSessionScanner.ts Outdated
Comment thread apps/server/src/orchestration/decider.ts
@github-actions github-actions Bot added size:XXL 1,000+ changed lines (additions + deletions). and removed size:XL 500-999 changed lines (additions + deletions). labels Aug 29, 2026

@macroscopeapp macroscopeapp Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the new/changed Effect service code (AgentSessionImporter.ts, AgentSessionScanner.ts, ws.ts wiring, contracts errors). Dependency acquisition now happens through the environment (yield* Foo.Foo) and the RPC handler provides the services at the boundary, which matches the conventions. One error-modeling issue below.

Posted via Macroscope — Effect Service Conventions

Comment thread apps/server/src/project/AgentSessionImporter.ts Outdated
Comment thread packages/contracts/src/agentSessions.ts Outdated
Comment thread apps/server/src/project/AgentSessionImporter.ts Outdated
Comment thread apps/server/src/project/AgentSessionScanner.ts Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 7d8de88. Configure here.

Comment thread apps/web/src/components/onboarding/WelcomeWizard.tsx
Comment thread apps/server/src/project/AgentSessionImporter.ts
@t3dotgg
t3dotgg merged commit 5047c7b into t3code/overhaul-onboarding-flow Aug 31, 2026
26 checks passed
@t3dotgg
t3dotgg deleted the t3code/import-recent-agent-thread-history branch August 31, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR 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