Repository navigation
feat(providers): apply changes next turn and switch proxies in place - #85
Merged
Merged
Conversation
nixuuu
added a commit
that referenced
this pull request
Nov 4, 2026
Fixes from testing bots on desktop nightly.32. - **Sidebar freeze:** "Create your first bot" in the sidebar froze the app through a shallow-navigation reactive cycle. Fixed; both entry points open the wizard the same way. - **Stale providers:** the wizard refreshes provider definitions and model catalogs when it opens and on configuration changes, with loading and error states instead of an empty list. - **Eligibility by connection:** bots decide by an instance's current connection (proxy/endpoint vs Device login), not by the id `native` — since #85 the built-in instance can be a proxy. Device-login instances appear disabled with the reason and a link to that instance's settings. - **Labels:** Settings → Workers provider chips and the built-in instance's display-name placeholder follow the current connection (no "Native" / "Device login" for a proxy). Fixes: #85 Fixes: #72
nixuuu
added a commit
that referenced
this pull request
Nov 5, 2026
#131) Fixes two causes of flaky failures in `tests/integration/instance-changes.test.ts`. Both are in the test fixture; product code is unchanged. 1. **The caller's environment leaked in.** The in-process worker passes its own environment to native harnesses. A shell that sets `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_BASE_URL` or `CLAUDE_*` (for example an agent session) made every native turn look proxied, so the native→proxy→native checks failed. The fixture now removes provider variables (`ANTHROPIC_`, `CLAUDE`, `CODEX_`, `OPENAI_`, `XAI_`, `GROK_`) while it runs and restores them on close. 2. **A half-written line was read** (the CI failure). The test polls `probe.jsonl` while harness processes append to it. A read could catch half a line, and the strict decoder threw `Expected a valid JSON string`. Grok's instance switches were then never audited, so the audit test saw 4 rows instead of 6. Only lines that end with a newline are parsed now. No sleeps, retries, raised timeouts or weaker assertions. Related: #85
nixuuu
added a commit
that referenced
this pull request
Nov 7, 2026
Existing Codex threads can fail at `turn/start` after their instance switches between Device login and Proxy. The thread selects `canopy_native`, while the app-server process still defaults to `openai`, producing a provider mismatch that the UI labels as a Canopy internal error. Fixes: #85 ## Cause and fix - Threads pin `provider_profile_id`, the instance ID. Changing another instance does not move them. Explicitly changing their instance's connection applies on the next turn, after running work drains. - Device login uses `openai`; a proxy uses `canopy_<instance id>`. In particular, `canopy_native` is the proxy on the instance named `native`, not device login. Configure the single-instance app-server's `model_provider` as well as the existing `modelProvider` on thread start/resume. Credentials remain in env. - Codex 0.164.0 supports a provider override on cold resume. Keep the same conversation, full history and turn references. A fork or seeded continuation is unnecessary, so there is no migration timeline note. The adapter regression exercises the real CLI against two local fake APIs and confirms earlier prompts and replies reach the new connection. - Recognize the reported refusal as `connection_changed`, with instructions to restore the previous connection and an **Open provider settings** action. Preserve the native error behind **Show details**. This shared presentation covers web and mobile. - Claude and Grok keep their existing session stores when switching connections; the gateway↔worker regression covers both. Explicit home/own-login changes can point at another store and do not migrate history; document that boundary and remove the obsolete statement that in-use instances cannot change connection. Pinned source reviewed: [app-server resume/fork](https://github.com/openai/codex/blob/rust-v0.164.0/codex-rs/app-server/src/request_processors/thread_processor.rs), [core resume](https://github.com/openai/codex/blob/rust-v0.164.0/codex-rs/core/src/thread_manager.rs), [provider requirements](https://github.com/openai/codex/blob/rust-v0.164.0/codex-rs/app-server/src/config_manager.rs). Managed Codex requirements remain enforced. Canopy uses the installed CLI; the strict scripted server also reproduces versions that compare the thread route with the current process provider. ## 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`. No proto or migration changes. - Focused gateway↔worker tests: 7 passed, including strict provider admission, native→proxy→native, restart, error presentation and retry; Claude/Grok switches and drain are covered too. - Real Codex adapter with local fake inference: device login → proxy → another proxy → another profile → device login keeps one conversation and earlier history. No paid live inference; no real CLI homes or credentials. - Passed full `bun run check:tmp`: **1751 passed, 161 skipped, 0 failed** across 312 files; nothing left in the test temp directory. Tests use worktree-local temp data, isolated provider homes and a Git discovery ceiling. `CANOPY_LIVE` is unset; paid live tests require `1`. The test container was removed. - Manual T3 browser check against an isolated gateway, worker and Postgres: light/dark at 1280×800 and 390×844. Verified completed `Cześć` after switching, specific fallback text, details wrapping, and navigation to the correct instance/worker settings. Stopped the dev server and fixture; closed the preview tab. ## Copy audit — docs/copy.md §8 Before: “Canopy had an internal error. Retry…” → After: “Codex could not use this thread with the current connection. Restore its previous connection in provider settings, then retry.” This identifies the connection problem and gives a recovery step. | Checks | Result | |---|---| | 1–2: wording and glossary | 2 short, active sentences; sentence case and punctuation; uses thread, connection and provider settings; no protocol names on the surface. | | 3–4: actions and errors | Existing **Open provider settings** and **Retry** actions; source, code and original refusal stay in **Show details** with copy support. | | 5–8: states, repetition, dependencies and soul | No new empty states or confirmations; no duplicate title/body fact; names the connection dependency and recovery; no humour. | | 9: text lengths and widths | Short `Cześć`, typical prompt and a long thread title checked at desktop/phone widths in both themes; error and expanded details wrap without horizontal overflow. The error has no interpolated names. | | 10: accessibility | Meaning and actions are visible text; no dependence on colour, icon shape or position. |
This was referenced Nov 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Any provider instance (including the built-in
nativedevice login and instances with threads) can now switch between Device login and a saved Proxy in place, and every instance change applies at the next turn without interrupting running work.Why it was locked: the UI, the gateway and a SQL constraint forbade kind changes for built-in/in-use instances, and switching reset
ownLogin, which could move the session directory so existing threads could not resume.Now
0065_instance_connections; Polish docs (worker-config, durability, proxies).Checks: install, gen:check, typecheck, lint, format:check, check:tmp (947 pass, 152 skip, 0 fail), web build. Integration tests use local fake CLIs (no paid calls). Browser checked light/dark at desktop and phone widths.