Skip to content

feat(providers): add reusable proxies for provider profiles - #72

Merged
nixuuu merged 1 commit into
devfrom
feat/proxies
Nov 4, 2026
Merged

nixuuu merged 1 commit into
devfrom
feat/proxies

Conversation

@nixuuu

@nixuuu nixuuu commented Nov 4, 2026

Copy link
Copy Markdown
Member

Adds Settings → Proxies: save a model proxy once and pick it in any provider instance instead of typing the URL and key into every profile.

  • Proxy kinds: CLIProxyAPI (or a fork), generic Anthropic-compatible, generic OpenAI-compatible. Name, base URL (with or without /v1), secret encrypted in the gateway (never shown again, Replace), owner-scoped, audited; deleting a proxy in use is blocked.
  • Harness mappings: Claude ANTHROPIC_BASE_URL + ANTHROPIC_AUTH_TOKEN + empty ANTHROPIC_API_KEY; Codex isolated CODEX_HOME with a model_providers entry (wire_api = "responses", env_key, optional websockets/extra headers); Grok custom endpoint through an isolated GROK_HOME.
  • "Test connection" lists models and detects CLIProxyAPI.
  • Provider instance Connection: Device login / Proxy (pick or add inline). Existing endpoint profiles migrate into proxies automatically (identical URL+key deduplicated), same env/config on workers as before.
  • Built-in Device login instance: the locked choice now looks disabled and offers "add an instance"; manual ANTHROPIC_BASE_URL/ANTHROPIC_AUTH_TOKEN (or Codex equivalents) in an instance's variables get "Move to a proxy", which moves the secret server-side.
  • Migration 0061_proxies. Docs: docs/proxies.md.

Checks: install, gen:check, typecheck, lint, format:check, web build; check:tmp 919 pass / 151 skip / 1 fail — the failure is the skills.sh catalog request-count test from #66, which also fails on clean dev on this machine only (investigated separately; CI passes). Browser checked light/dark at desktop and phone widths. Connection tests used fakes, no live model calls.

@nixuuu
nixuuu merged commit 3eb744a into dev Nov 4, 2026
2 checks passed
@nixuuu
nixuuu deleted the feat/proxies branch November 4, 2026 16:48
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 10, 2026
When a failed Codex turn receives late output after a background wake-up
starts, its work is grouped above the new turn but its failure footer
can remain at the bottom. Keep the footer with its own work, and prevent
advisory idle/systemError activity from idling a thread that still has a
running turn.

Codex `error` notifications already map to diagnostic notices, including
`willRetry: false`; only `turn/completed` determines the outcome.
Preserve that contract and genuine terminal failures. Web and mobile now
show readable provider error summaries with redacted JSON behind **Show
details**, including previously saved notices.

## Transport investigation

- Canopy uses `turn/steer` for steering and `turn/interrupt` for Stop.
Steering is not interrupt + restart.
- Codex 0.164.0 itself sends `response.interrupt` over Responses
WebSockets, including during its default instant-interrupt steering
path. CLIProxyAPI has a documented late-interrupt race that returns this
400 and can poison the next response. Sources and the distinction from a
missing WebSocket capability are in `docs/proxies.md`.
- New proxy connections default to HTTP/SSE. Explicit saved WebSocket
settings remain honored. Existing affected connections need **Supports
WebSockets** disabled; the change applies after instance drain.
Connection testing checks the model catalog, not interruption
compatibility.
- `worker_shutdown` means background processes stopped for a worker
restart/deploy. The existing recovery tests and new gRPC regression
cover the resulting wake-up. It does not establish that the restart
caused the provider error. Without incident events and the proxy
version, the screenshot's exact sequence remains unconfirmed.

## Validation

- Passed frozen dependency install, generated-code check, monorepo
typecheck, lint, formatting check and web production build.
- Adapter regressions: both retry flags followed by work and success;
true terminal failure; a new wake-up turn and late old-turn output;
redaction of endpoint and credential details. Sequences are scripted
app-server notifications, not an incident recording.
- Real gateway/Postgres/worker gRPC regression checks live and reloaded
statuses, web footer order, mobile turn order, `worker_shutdown` wake-up
and repeated late terminal/activity events. Existing Codex
mapping/turn-boundary, proxy, worker-restart, background-task,
durability and report-order files also passed individually.
- Full `check:tmp` ran once with concurrency limited to 1: 2,221 passed,
163 skipped and 2 failed across 408 files; the temp-directory check was
clean. Both failures passed on targeted reruns: the existing launch
expectation needed the new explicit `supports_websockets=false`
argument, and `worker-profile-env.test.ts` needed my `CANOPY_LIVE=0`
invocation override removed (the fixture checks exact inherited
environment keys). No production change was required for either. The
full suite was not repeated. Opt-in live inference was skipped; the real
Codex app-server/fake-inference connection-resume test passed.
- Chromium visual inspection: 1440 px desktop in light/dark, 820 px
narrow, 390 px phone in light/dark; short, typical and long notices,
collapsed/expanded details, copy control and historical failure above
running work. Temporary fixture removed. Native mobile rendering was not
run; mobile typecheck and shared presentation/order coverage passed. No
component or E2E suites added.

## Copy audit (§8)

- Raw error JSON → **Provider error 400: no active upstream websocket
for response.interrupt**, with the raw payload behind **Show details**
and a copy action. This follows the requested diagnostic wording;
`response.interrupt` is retained as the provider's literal message, not
an invented user-facing term. Summaries and details redact endpoints and
credentials.
- **Enable when the upstream supports Codex Responses over WebSockets.**
→ **Use HTTP streaming unless the proxy supports Codex WebSocket
interruptions.** One sentence, 10 words, a concrete condition for the
advanced setting.
- Reused **Show details**, **Copy error details**, and **Error
details**. Actions start with verbs; sentence case, glossary, non-color
cues and wrapping checked. No new empty states, confirmations, duplicate
explanations or humor.

Fixes: #72
Related: #527
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