Skip to content

fix(import): continue imported codex sessions on canopy's connection - #351

Merged
nixuuu merged 1 commit into
devfrom
fix/codex-import-provider
Nov 7, 2026
Merged

nixuuu merged 1 commit into
devfrom
fix/codex-import-provider

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 7, 2026

Copy link
Copy Markdown
Member

Imported Codex threads can fail on their first Canopy turn because their rollout names a custom CLI provider that does not exist in Canopy's private CODEX_HOME.

Fixes: #312
Related: #345

Cause and fix

  • Keep the explicit modelProvider override from fix(codex): keep threads working after switching the connection #345. Codex 0.164 accepts it, but 0.166 validates the saved provider before applying it. The real 0.166 binary reproduces the reported “which is no longer configured” refusal against a local fake API.
  • Before cold resume, normalize only the manifest-owned private rollout's session provider and its own settings snapshots to the thread's Canopy connection (openai or canopy_<instance id>). Use the existing staged, identity-checked copy writer and update the manifest, preserving Undo. Session ID, history, messages and turn references stay intact.
  • Paginated Codex sessions also read their saved provider from SQLite, including on path-based resume. Update only threads.model_provider in the private index, matching both session ID and verified rollout path. Do not create a database or change its schema; leave unknown schemas alone. Reject symbolic/hard links and special files in the index and SQLite companions. Source CLI files, configuration and databases remain untouched. Codex still enforces managed requirements on the selected connection.
  • Classify the missing-provider refusal as connection_changed, reusing the specific explanation and Open provider settings action from fix(codex): keep threads working after switching the connection #345. Retain the native harness error under Show details.
  • Claude already receives the instance endpoint and selected model on resume; Grok loads the copied history and explicitly selects the thread model. Extend their real-CLI regressions with a conflicting source endpoint/model and a retired source model respectively.

Already-imported threads

The next cold resume repairs the existing private copy and its matching index entry, including copies that already failed with 0.166. No re-import, new conversation, history summary or gateway migration is needed. Copies without valid ownership evidence are not rewritten; harness refusals retain their specific classification.

Validation

  • Passed: bun install, bun run gen:check, bun run typecheck, bun run lint, bun run format:check, and bun run --cwd apps/web build.
  • Real Codex 0.166 against a local fake API plus copy/index security regressions: 9 passed, including native and proxy connections, failed old-copy recovery, a second cold resume, complete history, unchanged source and Undo. The standard installed Codex 0.164, Claude and Grok adapters also pass against local fake APIs.
  • Gateway↔worker import integration covers native continuation with the same session ID/history and an impossible override classified as connection_changed, retaining the native error and provider-settings recovery.
  • Full bun run check:tmp: 1772 passed, 161 skipped, 0 failed (1933 tests across 317 files); no test temp-directory leaks. Its PostgreSQL container and volume were removed. CANOPY_LIVE stayed unset; no paid API calls or UI/E2E tests.
  • Final self-review and git diff --check passed. CI and external review are pending.

Copy audit — docs/copy.md §8

Effective message before → after: “Canopy had an internal error. Retry. If it happens again, copy the details and report them.” → “Codex could not use this thread with the current connection. Restore its previous connection in provider settings, then retry.” The missing-provider variant now uses the existing actionable connection explanation; no new UI string or layout is introduced.

Checks Result
1–2: wording and glossary Reuses #345's two short sentences, sentence case, punctuation, thread and provider-settings terminology. No native provider ID appears on the surface.
3–4: actions and errors Existing Open provider settings and Retry actions; integration test verifies harness source, native code/message and connection_changed. Technical details use the existing Show details disclosure.
5–8: states, repetition, dependencies and soul No new empty state or confirmation; no duplicate title/body fact; connection dependency and recovery are explicit; no humour.
9: text lengths and widths No interpolated names, new labels, string changes or layout changes. Uses the same notice as #345; no browser or UI test was run in this task.
10: accessibility Existing visible explanation and action labels convey meaning without colour, icon shape or position.

@nixuuu
nixuuu merged commit 7371809 into dev Nov 7, 2026
16 of 18 checks passed
@nixuuu
nixuuu deleted the fix/codex-import-provider branch November 7, 2026 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant