Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Mergedt3dotgg(GitHub profile, opens in a new tab)merged 7 commits intot3code/overhaul-onboarding-flow fromrefs/pull/8066/headmerged by t3dotgg(GitHub profile, opens in a new tab) View on GitHub

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](https://cursor.com/bugbot) for commit 52aeac1a90eb7a512d5ebf880fdf856e43d130fc. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

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.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    3. github-actions[bot](GitHub profile, opens in a new tab)commented

      Thread transfer impact

      ✅ Thread transfer remains within every enforced ceiling.

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

      ProviderMetricMain baselineThis PRImpactPR ceiling
      CodexTotal thread wire—13.3 KiB—15.1 KiB✅
      CodexThread snapshot wire—6.9 KiB—7.3 KiB✅
      CodexLive turn WebSocket wire—6.4 KiB—7.8 KiB✅
      CodexLive turn WebSocket decoded—55.6 KiB—66.4 KiB✅
      CodexLive turn messages—11—21✅
      ClaudeTotal thread wire—13.4 KiB—15.1 KiB✅
      ClaudeThread snapshot wire—6.9 KiB—7.3 KiB✅
      ClaudeLive turn WebSocket wire—6.5 KiB—7.8 KiB✅
      ClaudeLive turn WebSocket decoded—56.4 KiB—66.4 KiB✅
      ClaudeLive 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.

    4. 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
    5. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      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](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    6. 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
    7. macroscopeapp[bot](GitHub profile, opens in a new tab)replied on packages/contracts/src/agentSessions.ts line 43

      Verified: import now derives the root from the stored project, and recentThreads checks both it and its realpath. This resolves the bypass.

    8. 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](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 7d8de88fe833cc902a313d440725195827845795. Configure [here](https://www.cursor.com/dashboard/bugbot).

Sign in to join this conversation.