Skip to content

fix(web): import sessions from connected non-primary environments - #35131

Open
ahmetaydin35 wants to merge 5 commits into
pingdotgg:mainfrom
ahmetaydin35:fix/import-sessions-non-primary-environments
Open

ahmetaydin35 wants to merge 5 commits into
pingdotgg:mainfrom
ahmetaydin35:fix/import-sessions-non-primary-environments

Conversation

@ahmetaydin35

@ahmetaydin35 ahmetaydin35 commented Nov 12, 2026 •

Copy link
Copy Markdown

Reopens #22411 from current main, as asked when it was closed for being open over 3 weeks. @juliusmarminge asked for this scope in his review, and the review changes were already pushed there. The code is the same, rebased onto current main as one commit.

Problem

#33209 lets users reopen the Welcome page from Settings → About and re-import sessions on the primary environment. The page only scans the primary environment, so Claude Code, Codex and Pi sessions on a connected non-primary environment still cannot be imported.

Change

  • /welcome accepts an environmentId search param. The Welcome page already works on one environment at a time and opens for a non-primary environment after a ChatGPT sign-in, so this only lets Settings ask for one. An id the catalog does not know falls back to the primary environment, as the sign-in hash already did. resolveWelcomeEnvironmentId holds that choice.
  • Settings → Environments adds Import sessions… to the ⋯ menu of each saved environment. It shows only when the environment is on and connected and the connection has orchestration:operate, the scope the import needs.
  • docs/user/welcome-page.md says where to find it.

The Welcome page's scan, import and eligibility rules are reused as they are. No server or contract changes.

Scope

Requested by a maintainer in review on #22411: "Please cut this down to the remaining separate gap: importing sessions from connected non-primary environments, which the Welcome page does not scan." Follow-up to #10961.

Verification

Run on this branch, on top of current main:

  • vp test run src/onboarding/welcomePage.logic.test.ts: 14 tests pass, 5 of them new for resolveWelcomeEnvironmentId (default, requested environment, sign-in return wins, unknown id falls back, no primary environment as in the hosted app).
  • vp test run --project browser on WelcomePage.import, AddEnvironmentDialog and EnvironmentRoutesList: 20 existing tests pass.
  • effect-tsgo tsrs --noEmit for apps/web reports no errors. vp fmt, vp lint and knip pass.
  • CI: Test Web 2 fails on CommandPalette.browser.test.tsx:113, which this PR does not touch. The same test fails on main at ee90bdc. It passes locally on this branch (3/3 runs).

Manual check on #22411 with the same code, in the dev web app with isolated state. A second server on the same Mac, with its own --base-dir and synthetic Claude Code and Codex transcripts, was paired as a remote environment named "Build Server". Its menu showed Import sessions…, which opened /welcome?environmentId=…. The page read "Setting up Build Server" and listed that server's 5 projects, with the 3 recent git repositories checked.

Not checked: running the import itself from that page (the test server had no signed-in agent), an environment connected over SSH or T3 Connect, and the packaged desktop app. No browser test covers the environment row menu.

Before

Settings → Environments, menu of a connected environment: no way to import its sessions.

Environments menu before: Icon, Routes, Copy MCP URL, Remove

After

Environments menu after: Import sessions… between Routes and Copy MCP URL Welcome page setting up Build Server, offering to import 3 of 5 projects

Claude Opus 5.5 in Claude Code, run through T3 Code.

🤖 Generated with Claude Code

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 12, 2026
@macroscopeapp

macroscopeapp Bot commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved at e570d43

Macroscope's review found this PR approvable — Adds an explicit way to import session history from another connected environment. It reuses the existing environment-scoped import flow and permission checks without changing the default environment.

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

@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Settings now provides an “Import sessions…” action for eligible connected environments. The action opens the Welcome page with the selected environment ID. The Welcome page validates and resolves that ID against the available environments.

Changes: Environment session import

Layer / File(s) Summary
Environment selection logic
apps/web/src/onboarding/welcomePage.logic.ts, apps/web/src/onboarding/welcomePage.logic.test.ts
The resolver prefers a known resume environment, then a known requested environment, and otherwise returns the primary environment ID. Tests cover these selection cases.
Welcome route selection
apps/web/src/routes/welcome.tsx
The route validates the requested environment ID, waits for the catalog when required, and uses the resolver to select an environment.
Settings navigation and Welcome page guidance
apps/web/src/components/settings/SavedEnvironmentRows.tsx, docs/user/welcome-page.md, apps/web/src/i18n/translations/*.json
Eligible connected environments gain an “Import sessions…” action that navigates to /welcome with the environment ID. The documentation describes importing projects and sessions from another connected computer. Translation files add localized action labels.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  actor User
  participant SavedBackendListRow
  participant WelcomeRouteView
  participant resolveWelcomeEnvironmentId
  User->>SavedBackendListRow: Select “Import sessions…” for an eligible environment
  SavedBackendListRow->>WelcomeRouteView: Navigate to /welcome with environmentId
  WelcomeRouteView->>resolveWelcomeEnvironmentId: Resolve requested ID against resume ID and catalog IDs
Loading

Suggested reviewers: juliusmarminge, t3dotgg

Merge Risk: Minimal · up to 656a3

This adds an Import sessions action for eligible connected environments and opens Welcome scoped to that environment. It falls back to the primary environment when the ID is unknown. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(web): import sessions from connected non-primary environments" matches the main change. The PR adds an Import sessions… action for saved environments in Settings → Environments, and a /…
Description check Passed The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section states the gap: the Welcome page scans only the primary environment, so s…
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(web): import sessions from connected non-primary environments" matches the main change. The PR adds an Import sessions… action for saved environments in Settings → Environments, and a /welcome environmentId search param that lets the Welcome page scan a non-primary environment. The title uses a conventional commit prefix and names the scope and the affected behavior. It is specific and does not use vague terms.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, Change, Scope, and Verification sections. The Problem section states the gap: the Welcome page scans only the primary environment, so sessions on connected non-primary environments cannot be imported. The Change section explains the /welcome environmentId param, the resolver fallback, the Settings menu item, and the docs update. The Scope section links the original issue #22411 and quotes the maintainer request. The Verification section lists the focused tests, browser tests, type checks, a manual check with screenshots, and what was not checked. The description states that the CI failure in CommandPalette.browser.test.tsx also occurs on main. The template asks for a model and harness note when an agent was used, and the description includes one (Claude Opus 5.5 in Claude Code). The before and after screenshots are embedded.

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 3f04012 and 656a3e1.

Files selected for processing: 12

  • apps/web/src/components/settings/SavedEnvironmentRows.tsx
  • apps/web/src/i18n/translations/de.json
  • apps/web/src/i18n/translations/en.json
  • apps/web/src/i18n/translations/es.json
  • apps/web/src/i18n/translations/fr.json
  • apps/web/src/i18n/translations/ja.json
  • apps/web/src/i18n/translations/ko.json
  • apps/web/src/i18n/translations/pt-BR.json
  • apps/web/src/i18n/translations/ru.json
  • apps/web/src/i18n/translations/sv.json
  • apps/web/src/i18n/translations/zh.json
  • apps/web/src/onboarding/welcomePage.logic.test.ts

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

The Welcome page only scans the primary environment, so sessions on a
connected non-primary environment could not be imported. Settings →
Environments now has Import sessions… in each connected environment's menu,
which opens the Welcome page for that environment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ahmetaydin35
ahmetaydin35 force-pushed the fix/import-sessions-non-primary-environments branch from e570d43 to cea6dee Compare November 12, 2026 10:33
@maria-rcks

maria-rcks commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Note

Written by gpt-6.1-sol on behalf of Maria

Verified in a real dev environment

verified unchanged head 3f040126df23aefc6d2767f124e09cabcfd102c4 in linux chrome through the dev web app, using playwright and real codex gpt-6.1-sol turns through the local proxy. no mocks or seeded transcripts.

on github/main (eebb6bccdf), the connected environment's menu has no import action. opening /welcome?environmentId=<remote> still sends the scan to the primary environment. main was stopped before starting the pr dev server.

on the pr, settings → environments → import sessions opens welcome for the saved non-primary environment. a real codex session was created through the app in remote-history-repo. importing it created the project and one thread on the selected environment, with the original user and assistant messages. both environments used separate task-owned server state on this vm and a direct connection.

the first continuation correctly reported codex's active-writer lock because the source client still held the session. after releasing it with the source thread's "restart agent session" action, the imported thread resumed and recalled ORCHID-35131-IMPORT without the marker being repeated in the follow-up prompt.

nearby checks passed: repeating the import added no duplicate; /welcome and an unknown environment id scanned primary; switching the saved environment off hid the import action, and switching it on restored it.

runtime transcript from the browser's real websocket traffic:

main /welcome?environmentId=<remote>:
  ws://localhost:8693/ws → agentSessions.scan {}
pr settings → remote → import sessions:
  ws://127.0.0.1:17631/ws → agentSessions.scan {}
  ws://127.0.0.1:17631/ws → agentSessions.import
    expectedWorkspaceRoot: /home/user/remote-history-repo
  result: { importedCount: 1, skippedCount: 0 }
repeat import:
  result: { importedCount: 0, skippedCount: 1 }
imported thread continuation, codex gpt-6.1-sol:
  assistant: ORCHID-35131-IMPORT
blacksmith: vp test run apps/web/src/onboarding/welcomePage.logic.test.ts
  14 passed

before, on main:

main connected environment menu without an import action

after, on the pr:

pr connected environment menu with import sessions

import interaction and imported history, with idle time removed:

real remote codex session import recording

successful continuation after releasing the source writer:

imported codex session recalls its original marker

Not verified

packaged electron, native ios/android, macos/windows, ssh or t3 connect routes, claude/pi imports, restricted-scope connections, and the chatgpt sign-in return. this pass exercised the linux web client and codex over a direct connection. no source changes were needed.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 19, 2026
juliusmarminge and others added 3 commits November 19, 2026 18:54
…on-primary-environments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Wraps the new menu label for main's i18n catalogs, translates it in every web
locale, and drops a resolver test the fallback case already covers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@juliusmarminge

Copy link
Copy Markdown
Member

Evidence

Steps on both commits: connect History server; inspect its menu; Settings → About → Welcome page → Open → Review all; open /welcome#agents:<History server ID> → Review all; open /welcome?environmentId=<History server ID> → Review all. On head, select Import sessions… from History server’s menu, import build-api, and open all three imported transcripts.

Chromium, 1280×800, light theme; fresh isolated servers with identical synthetic native histories. Primary server contains primary-notes. History server contains build-api with one Claude Code, one Codex and one Pi session.

Proven: scenarios:prove exited 0; base failed and head passed.

Step Before — 9246c3235e After — 656a3e174f
Connected environment menu Before: no Import sessions action After: Import sessions action
About → Welcome → Review all Before: Primary server history After: Primary server history
Existing secondary hash route Before: History server with three sessions After: History server with three sessions
Same secondary query URL Before: query incorrectly opens Primary server After: query opens History server
Runner failure capture Before: secondary environment assertion fails Passed
New menu action → Review all Unavailable After: secondary history includes Claude Code, Codex and Pi
Imported Claude Code transcript After: imported Claude Code prompt and answer on History server
Imported Codex transcript After: imported Codex prompt and answer on History server
Imported Pi transcript After: imported Pi prompt and answer on History server

Before navigation recording · After matching navigation recording · After complete import recording.

Pairing setup is trimmed. Fixture paths and transient sign-in details are redacted. Fixture-only sign-in banners were dismissed through the UI before transcript stills. All published captures were inspected.

Scenario source · Reproduction bundle with seed/helpers and commands · Runner verdict and steps.

@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 19, 2026

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). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants