Skip to content

Commit c9f4223

Browse files
anandgupta42clauderalphstodomingosahrizvi
authored
feat: default to Altimate Base with no consent gate; stop falling back to keyless Zen (#1361)
* feat: auto-register Altimate Base with no consent gate Since 2026-09-17, OpenCode Zen rejects keyless traffic outright ("OpenCode's free tier can only be used from within OpenCode"), which breaks every install that falls back to the keyless `opencode` provider with no model of its own (360 machines in 5 days). This registers Altimate Base automatically, with no disclosure dialog, and stops the default-model resolvers from ever falling back to the now-broken keyless tier when Base is available. - `FreeTier.autoRegister()` / `autoRegisterWithin(ms)` in `packages/opencode/src/altimate/free/client.ts`: registers without a consent token, reusing the existing lock, `inflight` dedupe, and `registerOnce` path `registerAfterConsent` already uses. Skips (never throws) when `ALTIMATE_BASE_AUTO_REGISTER` is `0`/`false`, no gateway URL is configured, the user explicitly logged out (checked inside the registration lock so a concurrent logout can't be missed), or valid credentials already exist. `autoRegisterWithin` bounds the wait and lets a slow attempt keep going in the background — its credentials still land on disk for the next launch. - Every entrypoint (`cli/cmd/serve.ts`, `cli/cmd/tui.ts`, `cli/cmd/run.ts` outside `--attach`, `cli/cmd/acp.ts`, `cli/cmd/web.ts`) calls `FreeTier.autoRegisterWithin()` before provider/instance state is first built. - `Provider.isPublicZen()` is the one shared predicate for "this is the keyless `opencode` tier" (id `opencode`, placeholder `"public"` key, no real key). `Provider.defaultModel()`, ACP's `defaultModelFromConfig()`, and the TUI's `fallbackModel()`/`currentModel()`/`restoreSession()` now: - drop the `declinedManagedBaseDefault` veto (still parsed for compatibility, no longer consulted) — there is no working public-Zen fallback left for a decline to protect. - exclude Base only via a real `enabled_providers`/`disabled_providers` verdict, never merely because a project's `config.provider` block names some other provider. - replace a stale persisted/session selection that resolves to public Zen with Base once it's registered, instead of replaying a model OpenCode Zen now rejects outright (`prompt.ts`'s `lastModel()`, ACP's `availableModel()`, and the TUI's recents/current-model/`restoreSession` paths). - ACP no longer strips `altimate-free` out of the directory snapshot for a project with an unrelated `config.provider` block (`acp/service.ts`). - `altimate_base_registration` telemetry gets an optional `origin: "auto" | "consent"` field; the auto path tracks the event directly instead of calling `Telemetry.init()` (which would treat config as enabled outside an Instance context). Part of a 3-commit PR; part (b) removes the TUI consent dialog and capability/consent machinery, part (c) covers the Zen error message and rate-limit retry. Both are separate, later work. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: clear OpenCode Zen block message and retry Altimate Base TPM throttling - `provider/error.ts`: map OpenCode Zen's "can only be used from within OpenCode" 403 (keyless free tier, blocked since 2026-09-17) to a clear, non-retryable message pointing users at Altimate Base or their own provider via `/models`. Never auto-switches the model. - `altimate/free/client.ts`'s `describeRateLimit`: a `throttling_error` with "Limit type: tokens" is now retryable with the same message shape as the generic burst limit, since the per-minute token budget was raised to 1.5M/min and now really means a burst of fast turns, not an oversized request. - `provider/error.ts`: cap the `Retry-After` header passed to `session/retry.ts`'s existing retry machinery at 60s so a large gateway-reported wait can't stall a session for minutes; the user-facing message still shows the real value. - Update `altimate-base-rate-limit-messages.test.ts`, `altimate-base-harness-smoke.test.ts`, and `release-v0.11.0-adversarial.test.ts` for the new TPM classification, and add coverage for the Zen-block mapping, TPM retry classification, and the 60s Retry-After cap in `test/provider/error.test.ts`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * refactor: remove the Altimate Base consent dialog and capability machinery The product decision is fixed: no consent gate for Altimate Base. Replaces the blocking terminal dialog with a one-line non-blocking notice, shown once per install the first time Base becomes the active model. The disclosure wording itself (`ALTIMATE_BASE_DISCLOSURE`) is unchanged — the gateway still logs requests — but accepting it is no longer a precondition of registering. - `FreeTier.register({ origin })` replaces `registerAfterConsent(token)`: no token, still shares the lock/dedupe/`registerOnce` path with `autoRegister`. Unlike `autoRegister`, an explicit register proceeds even after a logout — the user asked for it. - Deleted `altimate/free/capability.ts` (the one-shot arm/redeem consent authority) and `altimate/free/host.ts` (the per-process registration-gate injection it existed to protect) — nothing needs either any more. - `altimate/free/consent.ts` keeps the `DISCLOSURE`/`HINT`/`disclosureHash()` re-exports the notice and route still use; `createRegistrationConsentGate` becomes `createRegistrationGate`, a plain outcome classifier with no token. - `server.ts`: `POST /altimate/base/register` calls `FreeTier.register({ origin: "server" })` directly and accepts (but ignores) `acceptedDisclosureSha256` for older clients. Both routes are now available on every server with a gateway configured, not just one that provisioned a gate — `serve.ts` no longer claims the armer or provides a gate at all. - `cli/tui/worker.ts`'s `registerAltimateBase` RPC drops `setAltimateBaseConsentToken` and the token param; `cli/cmd/tui.ts` no longer mints one. - TUI: deleted `DialogAltimateBaseConfirm`, `context/altimate-base-consent.tsx` (the dedicated pre-SDK-context registration operation), and the startup migration dialog trigger in `app.tsx`. Picking Altimate Base from any picker (the welcome screen, the provider dialog, the full model catalogue) now calls a shared `selectAltimateBase()` helper directly: register if needed → refresh provider state → validate → select, showing a toast on failure. The registration operation moves onto the public `sdk` context (`AltimateBaseRegisterFn`) since there's no more consent boundary to keep it out of; an attached TUI (no in-process worker) falls back to the HTTP route over the same transport everything else uses. - Telemetry: `altimate_base_registration`'s `origin` gains `"picker"` and `"server"` (`"consent"` stays in the union for historical data). The retired dialog's `altimate_base_confirm_shown` / `altimate_base_choice` / `altimate_base_register_result` events keep their schema entries but are no longer emitted by anything. - Tests: deleted `altimate-base-armer-callsites.test.ts`, `context/altimate-base-consent.test.tsx`, and `cli/tui/dialog-altimate-base.test.tsx` (all tested deleted machinery). Removed the token-forgery/capability-unforgeability tests from `altimate-base.test.ts` and the token-redemption test from the v0.11.1-adversarial suite; migrated every other `registerAfterConsent( consented())` call site to `FreeTier.register({ origin: "picker" })`. Rewrote `test/server/altimate-base-registration.test.ts` for the no-gate routes (register works with no hash; browser-Origin is still refused on an unsecured server). Third and final commit of this PR; part (a) added no-consent auto-registration and Base-over-keyless-Zen default selection, part (c) covers the Zen error message and rate-limit retry. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * test: cover the no-dialog Altimate Base picker flow and the disclosure notice Adds the two automated tests flagged as missing after the consent-dialog removal — the user-visible promises of this PR: - `test/component/select-altimate-base.test.ts`: unit-tests `selectAltimateBase()` directly (with hand-built fakes for its collaborators, since `selectModel()`'s underlying `local.model.set()` is agent-scoped and the package's component-mount fixtures don't set one up). Covers: a successful registration disposes the instance, refreshes provider state, selects `altimate-free/altimate-base`, and never opens a dialog; the same via the attached-TUI HTTP fallback (no host-injected `registerAltimateBase`); a registration failure shows an error toast and leaves the model/dialog untouched; and a registration that reports success but never actually surfaces the model in the refreshed provider list also fails closed with a toast, not a partial selection. - `test/component/altimate-base-disclosure-notice.test.tsx`: mounts the real provider stack with a single `altimate-free` provider (so `fallbackModel()` resolves to Base with nothing else to configure) and drives `useAltimateBaseDisclosureNotice()`'s kv-persisted "already shown" flag the way a real restart would (a pre-seeded `kv.json`). Confirms the notice shows exactly once — the first time Base becomes the active model — and does not reappear on a subsequent launch once the flag is set. Exported `ALTIMATE_BASE_DISCLOSURE_SHOWN_KEY` from `altimate-onboarding.tsx` (previously module-local) so the second test can seed it, the same way `ALTIMATE_BASE_MIGRATION_DECLINED_KEY` is already exported from `context/local.tsx` for the identical reason. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: Altimate Base fallback ordering and retry latch Three Codex review findings on the Altimate Base default-no-consent branch: - `fallbackModel()`'s implicit last-resort pick in `local.tsx` used a naive array-order `.find()` instead of mirroring `Provider.defaultModel()`'s ordering, so keyless public Zen could be picked over a registered Base, and Base could beat a provider the user actually connected depending on array position. Extracted `pickImplicitFallbackProvider()` as a pure, directly testable function that mirrors the server's ordering exactly, and added 3 unit tests covering: Base outranking Zen, a credentialed provider outranking Base, and unchanged behavior when Base isn't registered. - `dialog-provider.tsx` and `dialog-model.tsx` set the Altimate Base row's one-shot activation latch before the async `selectAltimateBase()` resolved, and never reset it on failure, permanently bricking the row for the rest of the dialog session after a single failed attempt. Reset the latch when `selectAltimateBase()` returns `false`, and added a full-render retry test confirming a failed selection can be retried and re-fires registration. - `altimate-onboarding.tsx`'s `chooseAltimateBase()` had the same bug, but on the first-run welcome picker: it returned `true` synchronously right after firing the unawaited `selectAltimateBase()` call, so `activateRow()` claimed its one-shot latch before the registration attempt was known to have failed. A failed Base registration then bricked Enter, `/` and mouse-up for the rest of the dialog session on the picker shown to users with no model at all. Reset the latch on failure the same way, keeping the double-input guard intact for the in-flight window, and added a retry test to `dialog-model-welcome.test.tsx` confirming the same row can be retried. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: repair unbalanced `altimate_change` markers and upstream branding in the Base default changes - `server.ts`: restore the outer import block's `altimate_change end` that was removed together with the `FreeTierHost` import - `acp.ts`: the auto-register import block used a single-line marker closed by an `end`; make it a `start` - `provider.ts`: drop a nested `start` inside an already-marked block in `defaultModel()` - `provider/error.ts`: the Zen rejection message and its matcher no longer name the upstream product; behavior unchanged (still scoped to the `opencode` provider) - Reword two comments that the branding audit flagged Fixes the Marker Guard and `bridge-merge` / `upstream-merge-guard` CI failures. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: headless disclosure, persisted auto-register backoff, retry cap, dedupe and idempotent register Finishes the backend half of the PR #1361 review findings: - Headless disclosure (`run`/`serve`/`acp`/`web`): the first successful AUTO registration outside the TUI now prints `ALTIMATE_BASE_DISCLOSURE` once to stderr (`consent.ts`'s `printDisclosureOnceForHeadless()`), tracked with a marker file next to the credential store so it survives across process launches. `serve` skips it when `ALTIMATE_CLI_CLIENT=datamates`, since the VS Code extension shows its own notice. - Retry cap bypass (`provider/error.ts`): the 60s cap on a retryable Base 429's `Retry-After` only clamped a numeric `retry-after` in seconds. `SessionRetry.delay()` reads `retry-after-ms` first and falls back to an HTTP-date `retry-after` — both bypassed the cap entirely. All three forms are now clamped, with 4 new tests. - Idempotent register tearing down every instance (`server.ts`): the `POST /altimate/base/register` route disposed every session/LSP/PTY/MCP connection whenever `FreeTier.register()` reported success, even when the credential on disk hadn't actually changed (its "already registered" fast path). Compares `FreeTier.credentials()` before/after and skips disposal when nothing changed, with 2 new tests. - `SessionPrompt.lastModel()`: `FreeTier.isRegistered()` can throw (unreadable store, bad config), which aborted resuming a session. Now best-effort — falls through to the unchanged model on error. - Shared in-flight dedupe (`free/client.ts`): `autoRegister()` and `register()` used one dedupe map keyed only by gateway URL, so an explicit `register()` racing an in-flight `autoRegister()` could observe autoRegister's own "logged out" skip instead of actually reconnecting. Split into `explicitInflight`/`autoInflight`, still serialized through the same `Flock` lock, with a new race test. - Repeated startup wait after a failure (`free/client.ts`): every entrypoint calls `autoRegisterWithin()` at startup, so a persistent failure (network down, gateway 429/5xx) repeated the same attempt on every new launch — these are short-lived processes, so an in-process-only backoff map never helped. The backoff deadline is now persisted to a small JSON file next to the credential store, read at the start of `autoRegister()` (including the first call in a brand-new process) and cleared on success; `register()` ignores it. 3 new tests, including one asserting the backoff survives what an in-memory map would have lost. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: attached-TUI auth headers, explicit model authority, dismissed-picker guard Finishes the TUI half of the PR #1361 review findings: - Attached TUI registration drops auth (`altimate-onboarding.tsx`): the HTTP fallback for `registerAltimateBase()` (used when there's no host-injected worker RPC, i.e. `opencode attach`) called `sdk.fetch` directly with no auth headers, so it 401ed against a password-protected server. `sdk.tsx` now exposes the same `headers` `createOpencodeClient` already bakes into every typed SDK call; the fallback merges them in. New test asserts the Authorization header is actually sent. - Explicit model must stay authoritative (`local.tsx`'s `currentModel()`): the stale-public-Zen -> registered-Base substitution applied uniformly to whatever `fallbackModel()`/a persisted pick/an agent's own `model` resolved to — so an explicit `--model opencode/x` (or config `model`, or an agent's configured `model`) pointing at the now-broken keyless Zen tier got silently rewritten to Base instead of staying put. Split `fallbackModel()`'s explicit args/config checks into their own `explicitFallbackModel()` memo so `currentModel()` can route only the two truly implicit sources (a persisted per-agent pick, and the implicit recents/allowlist fallback) through the substitution. `Provider.defaultModel()`, ACP's `defaultModelFromConfig()`, and `SessionPrompt.lastModel()` were already correct (their explicit sources short-circuit before any substitution logic runs) — verified, not changed. New full-mount test (`explicit-model-authoritative.test.tsx`) exercises `currentModel()` itself with Base actually registered, confirming `--model opencode/x` stays put and — as a control — that the same catalogue substitutes Base when nothing explicit overrides it. - Dismissed picker (`selectAltimateBase()`): registration and bootstrap are both async; if the originating picker was dismissed or replaced while either was in flight, the function still went on to select the model and call `dialog.clear()` — closing whatever the user has open now, not the picker that started this. Snapshots the top-of-stack dialog by reference at entry and re-checks it after every await, bailing out silently the moment it no longer matches. 2 new tests (dismissed during registration, replaced during bootstrap). - Test isolation (`select-altimate-base.test.ts`): `selectAltimateBase()` calls `markSetupComplete()` on every successful path, flipping the module-global `setupComplete` signal that Bun's test runner shares across every file in the run (already handled in `local.test.ts` around its own `markSetupComplete()` calls, but missing here). Added the same `resetSetupComplete()` in `afterEach`. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * docs: state the new Altimate Base auto-registration behavior Every doc still promised the retired flow — "registration only after an explicit confirmation that defaults to No" — after auto-registration with no consent dialog shipped. Updates the security FAQ, quickstart, provider docs, README, and network reference to state the new behavior (a fresh install with no model of its own registers Altimate Base automatically, the disclosure is shown once) and the actual opt-outs (`ALTIMATE_BASE_AUTO_REGISTER=0`, `altimate providers logout altimate-base`, `enabled_providers`/`disabled_providers`) — noting that only the env var stops the background registration call itself. `docs/docs/configure/providers.md` also drops the stale claim that `declinedManagedBaseDefault` still keeps public Zen ahead of registered Base for a migrating Big Pickle user — Zen's keyless tier rejects unauthenticated traffic outright now, so there's no working choice left to honor; the flag is read for backward compatibility only. `docs/docs/reference/telemetry.md`: corrected `altimate_base_registration`'s "after consent" wording, and marked `altimate_base_confirm_shown` / `altimate_base_choice` / the `altimate_base_back` picker trigger as legacy — still defined in the event schema, but no longer emitted now that the consent dialog they recorded is gone. Logging/retention wording is unchanged verbatim from `ALTIMATE_BASE_DISCLOSURE` (verified against `test/altimate/altimate-base-disclosure-claims.test.ts`, which checks the docs note stays a superset of the in-app notice). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: mark two lines the strict marker guard flagged as unmarked new code `--base origin/main --strict` diffs against HEAD (not the working tree), so this only surfaced after the previous two commits landed: - `sdk.tsx`: the new `headers: props.headers,` line had its explanation on the line above instead of a same-line marker, which the line-based checker doesn't credit — moved to a start/end block ending on that line, matching the sibling `registerAltimateBase` line's own trailing-marker style. - `local.tsx`: `const fallbackModel = createMemo(() => {` is unchanged content, but inserting `explicitFallbackModel()` above it shifted its diff position enough that git shows it as a delete+add against origin/main rather than pure context — flagged the same way. Added a marker comment. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: mark remaining shifted line the strict marker guard flagged Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> * fix: close the late-registration gaps and tidy review findings - Headless disclosure: `printDisclosureOnceForHeadless` now prints whenever Base is registered and the once-per-install marker is unclaimed, not only when this launch's own registration finished. A registration that outlasted the startup wait finished in the background and every later launch reported "already registered", so the notice was never shown. The marker is claimed with an exclusive create before printing, so concurrent launches print once. - Register route: skip the process-wide reload only when the credential is unchanged AND Base is already in this server's provider list. After a background auto-registration (or a credential refreshed in place) the file is unchanged but the cached provider state predates it. - Move `isPublicZen` out of the `Provider` namespace into `provider/public-zen.ts` (packages/opencode/AGENTS.md "Module shape"). - Restore `altimate_base_register_result` for picker registrations during first-run onboarding (welcome picker `origin: "welcome"`, catalogue and provider dialog `origin: "model"`), as the removed confirm component did. - Cap the persisted 429 auto-register backoff at 24 hours, and serialise the backoff record's read-modify-write under its own file lock. - Docs: registration happens on every unregistered install, whether or not the user has a model of their own; logout keeps automatic registration off until Base is picked again; fleet audits look for `altimate-base.json`; the `ALTIMATE_CLI_CLIENT=datamates` skip applies to `serve`; the registration telemetry row covers the server route. - Tests: route reload when Base is not loaded, backoff cap, headless disclosure after a background registration, picker result callback; the explicit-model test restores its env even if mounting fails. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: reload providers per process, not per workspace, and qualify the Base docs - The register route skipped its reload whenever the requesting workspace already listed Base. Caches in other directories, or in the `/api` registry, could still predate a background registration. It now skips only once this process has reloaded for that exact credential. - The headless disclosure test isolates its home directory like the other Base suites. - Docs: the three-second startup wait and background completion, the retry backoff, the auto-register skip conditions, what registration sends, and the TUI notice appearing when Base first becomes active. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: treat a renewed Base credential as changed, and scope the backoff docs - The register route's credential identity now includes the expiry. An expired credential loads as absent, so a renewal that reissues the same key and URL still reloads the provider caches. - Docs: the retry backoff follows only network errors, rate limits and gateway server errors. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: tell a credential reissued after logout from an untouched one The register route's credential identity now also covers the rejected flag and the logout nonce. Logout rotates the nonce, so a registration that reissues the same key, URL and expiry after a logout in another process still reloads the provider caches. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: return the logout nonce from a fresh Base registration `registerOnce()` persisted the nonce but left it out of the returned credentials, so callers saw a different identity than the stored one. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: serialize the register route's reload, and tighten the Base tests - The register route runs its check-and-reload one call at a time, so concurrent calls cannot both dispose the same live resources. Inside that section it skips only when this process has already reloaded for the credential now on disk, which makes the before/after read unnecessary. - Tests: a concurrent-register case; an ACP case where the model changes between sessions; the picker's HTTP fallback asserts method and body; the disclosure notice flushes its KV write before cleanup; the retry case's name says it covers the re-fire only; the slow-registration test releases its gate on failure; the error tests assert their type and the budget message; a duplicate logout test is removed. - Docs: drop the stale "consented" registration wording. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: keep Zen's variant off a restored Base session, and cycle past a repaired Zen pick - Restoring a session whose model was keyless Zen selects Altimate Base instead; the prompt now applies the saved variant only when the restored model is the one that was saved, and clears it otherwise. - `cycle()` resolves stale keyless-Zen entries in `recent` to Base the way `currentModel()` does, so a repaired current model is found in the order and cycling moves on instead of doing nothing. New test covers it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: keep the rejected-to-restored reload, cycle off explicit Zen, and pin the concurrency test - The register route reads the credential before registering again and compares it inside the serialized section, so a rejected credential restored with identical fields still reloads. New test covers it. - `cycle()` keeps keyless-Zen entries as-is when the current model is an explicit Zen pick, which `currentModel()` honors, so cycling can move away from it. New test covers it. - The concurrency test waits for both requests to pass registration and for the first disposal to start before releasing it, instead of a fixed sleep. It fails without the serialization. - Test fixture: rename a mock provider to avoid a product-name leak. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: reload once when overlapping register calls repair the same credential Each register request notes the reload count before its pre-registration read. If a reload for the credential now on disk finished since then, it already covers that read, so overlapping repairs of a rejected, expired or logged-out credential reload once. A sequential restore still reloads. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: snapshot the reload count after the pre-registration read A reload finishing while the read was in flight counted as covering it, which could skip a reload a later rejection made necessary. Taking the snapshot after the read errs toward one extra reload instead. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: capture the pre-registration read and reload count on the reload queue Reading the credential and noting the reload count as one step on the same serialized queue as the reloads means no reload can finish in between, so the count says exactly which reloads followed the read: overlapping repairs reload once and a stale read never skips a needed reload. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: honor an explicit keyless-Zen pick, and notice a late Base registration in the same launch - The TUI records whether each agent's selection was explicit (`--model`, picker, cycle, favorite). `currentModel()` repairs a stale keyless-Zen selection to Base only when it was not explicit, e.g. a session restored before Base existed, so an explicit Zen choice gets Zen's own error instead of being routed to Base. - `autoRegisterWithin()` takes an optional callback for a registration that finishes after the startup wait gave up. `run`, `serve` (except for the VS Code extension), `acp` and `web` use it to print the disclosure in the same launch rather than the next. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: keep an explicit keyless-Zen pick across conversation switches The TUI now remembers which models were explicitly picked during this launch rather than flagging the agent's current selection, which session restore reset. Both `currentModel()` and `restoreSession()` leave an explicitly picked keyless-Zen model alone, so returning to a conversation doesn't reroute it to Base. Tests pass model copies, because the store merges a newly set object into the one already stored. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: carry an explicit keyless-Zen pick to an agent without its own model An agent with no stored pick inherits the most recent one through `fallbackModel()`, whose recents loop skipped a keyless-Zen entry without checking this launch's explicit picks. The loop and the shared Zen repair helper now both honor that record, so Tab to another agent keeps a deliberate Zen choice. New test covers it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * fix: key explicit picks unambiguously Provider and model IDs can contain slashes, so joining them with one could let two different picks share a key. Encode the pair as JSON. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_016x3nbZU5Vb6HnSTqE7vELm * test: pin autoRegisterWithin's late-notice callback wiring per entrypoint Round-2 re-review NIT: nothing checked that run/acp/web always pass a real onLateRegistration callback, or that serve does the same except when serving the VS Code extension (ALTIMATE_CLI_CLIENT=datamates, which renders its own notice). Source-assertion test, following the pattern in test/branding/upstream-guard.test.ts — the CLI commands are Effect-based and heavy to execute directly. Verified by mutation: dropping run.ts's callback, and dropping serve.ts's datamates gate, each fail exactly one assertion. Co-Authored-By: Claude Sonnet 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01H8gZMvZunXzx4LPSZzCafq --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: ralphstodomingo <[email protected]> Co-authored-by: Haider <[email protected]>
1 parent a165057 commit c9f4223

62 files changed

Lines changed: 3731 additions & 2337 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎README.md‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ altimate # Launch the TUI
6060

6161
Altimate Base is the free, no-signup option. It is rate limited, and its requests and responses
6262
are logged and may be used to improve Altimate products and services; do not send secrets or
63-
confidential code. The setup dialog shows this disclosure and defaults to **No** before registering.
63+
confidential code. If you don't pick another provider, a fresh install registers it automatically
64+
— no dialog to accept — and prints this notice once. Opt out with `ALTIMATE_BASE_AUTO_REGISTER=0`,
65+
`altimate providers logout altimate-base`, or `disabled_providers` in config.
6466

6567
Or set an environment variable directly:
6668
```bash

‎docs/docs/configure/providers.md‎

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,23 +62,43 @@ If you need stronger guarantees — no training on your data, metadata-only rete
6262
[Altimate LLM Gateway](https://help.altimate.ai/datamates/user-guide/components/llm-gateway/)
6363
instead.
6464

65-
Choose **Altimate Base** from the first-run picker or `/connect`. A disclosure is shown before any
66-
registration request; **No** is selected by default. After registration, the model is available as
65+
Choose **Altimate Base** from the first-run picker or `/connect` — or do nothing at all: every
66+
install that is not yet registered registers it automatically at startup, so it works the same way
67+
headlessly (`run`, `serve`, `acp`, `web`). Startup waits up to three seconds for this; a slower
68+
registration finishes in the background and applies from the next launch (a `serve` client can
69+
apply it sooner through the register route). After a network error, rate limit or gateway server error, startup skips
70+
registration for a retry backoff of one hour (longer if the gateway asks, up to 24 hours). This happens whether or not you
71+
also have a model of your own; a registered Base only becomes your default when nothing you
72+
configured is usable. There is no confirmation dialog to accept.
73+
The disclosure above is shown once per install: in the TUI as a toast the first time Base becomes
74+
the active model, and for a headless entrypoint as a one-line notice to stderr the first time it runs
75+
with Base registered (`serve` skips it when
76+
`ALTIMATE_CLI_CLIENT=datamates`, since the VS Code extension shows its own notice). After registration, the model is available as
6777
`altimate-free/altimate-base` and becomes the free fallback when no paid Altimate Gateway or
6878
explicit model is selected. Big Pickle is retired as a new selection — it no longer appears in the
6979
picker or the full model catalog for users choosing a model for the first time. Users already on
70-
Big Pickle are still detected on launch and offered Altimate Base through the same consent gate.
71-
If you decline the default switch, `declinedManagedBaseDefault: true` in the state directory's `model.json` keeps public Zen ahead of registered Base for headless and ACP defaults, with Base used only as a last resort; accepting migration or explicitly selecting Base clears the flag.
72-
73-
Registration is per machine, not per host. Once any host on a machine has registered Altimate
74-
Base (the TUI's consent gate, or the HTTP registration route used by IDE integrations), every
75-
other host on that machine treats Base as the default free model without showing its own
76-
prompt: the TUI migrates an implicit free default silently, and headless `altimate run`,
77-
`altimate serve`, and ACP sessions resolve to Base ahead of the keyless public Zen tier. The
78-
disclosure is therefore shown once per machine, by whichever host registers. Declining as
79-
described above applies to all hosts on the machine too. Administrators auditing a fleet can
80-
check `model.json` for `declinedManagedBaseDefault` and the registered `altimate-free` provider
81-
entry in `auth.json`.
80+
Big Pickle are migrated to Altimate Base the same automatic way once it registers, not through a
81+
separate confirmation: `declinedManagedBaseDefault` is still read from `model.json` for backward
82+
compatibility, but no longer changes the outcome — the keyless public Zen tier rejects
83+
unauthenticated traffic outright, so there is no longer a working "stay on public Zen" choice to
84+
honor.
85+
86+
To opt out: set `ALTIMATE_BASE_AUTO_REGISTER=0` before this install first registers Base, run
87+
`altimate providers logout altimate-base` afterward, or keep it out of your own choices with
88+
`enabled_providers` / `disabled_providers`. The env var is the only one of these that stops the
89+
background registration call itself; the other two only control whether Base can be *selected* as
90+
your model on this machine. Logging out un-registers it and also stops automatic registration on
91+
this machine: later launches skip it until you pick Altimate Base again in the picker (or an IDE
92+
calls the registration route), which reconnects it.
93+
94+
Registration is per machine, not per host: once any host on a machine has registered Altimate
95+
Base (auto-registration on any entrypoint, or the HTTP registration route used by IDE
96+
integrations), every other host on that machine treats Base as the default free model too — the
97+
TUI migrates an implicit free default silently, and headless `altimate run`, `altimate serve`, and
98+
ACP sessions resolve to Base ahead of the keyless public Zen tier. Logging out on any host applies
99+
to all hosts on the machine, since the credential is a single shared file. Administrators auditing
100+
a fleet can check for the Altimate Base credential file, `altimate-base.json`, in the data directory
101+
(it is stored separately from the shared provider-auth file).
82102

83103
Official release binaries embed the current gateway endpoint at build time. Operators and local
84104
development can override it without changing code:
@@ -91,7 +111,7 @@ altimate
91111
The URL must use HTTPS. Credentials,
92112
query strings, and fragments in the URL are rejected. `ALTIMATE_FREE_GATEWAY_URL` is retained as a
93113
legacy fallback, but `ALTIMATE_BASE_GATEWAY_URL` takes precedence. If the configured gateway host
94-
changes, credentials issued by the previous host are not loaded and the consented registration
114+
changes, credentials issued by the previous host are not loaded and the registration
95115
flow must run again.
96116

97117
Altimate Base waits up to **5 minutes** for the gateway to send response headers, because the

‎docs/docs/getting-started/quickstart.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ On a fresh install, a welcome panel appears with a curated 6-provider picker:
2525

2626
- **Altimate LLM Gateway** *(recommended)* — 10M tokens free, no API keys. Routes to the best model per task across Sonnet, Opus, GPT-5, and more. Sign-in opens a browser tab; complete Google or email signup and you're back in the TUI. If your terminal can't open a browser (SSH / tmux / WSL), the CLI prints the URL — paste it into a browser on your desktop.
2727
- **Anthropic** / **OpenAI** / **Google** — paste an API key or OAuth in.
28-
- **Altimate Base** — a hosted open model, free and rate limited, with no signup or API key. Requests and responses may be logged and used to improve Altimate's products, so do not send secrets or confidential code. Registration happens only after an explicit confirmation that defaults to **No**.
28+
- **Altimate Base** — a hosted open model, free and rate limited, with no signup or API key. Requests and responses may be logged and used to improve Altimate's products, so do not send secrets or confidential code. Every install registers it automatically at startup, whichever provider you pick — there is no confirmation dialog — and this notice is shown once, when Base is first used; it only becomes your model when nothing else you configured is usable. Opt out with `ALTIMATE_BASE_AUTO_REGISTER=0`, `altimate providers logout altimate-base`, or `disabled_providers` (see [providers](../configure/providers.md#altimate-base)).
2929
- **Search all providers…** — full picker if you need Bedrock, Databricks AI Gateway, Cloudflare AI Gateway, Snowflake Cortex, DigitalOcean Inference, etc.
3030

3131
Or set an environment variable and skip the picker:

‎docs/docs/reference/network.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ altimate needs outbound HTTPS access to:
4141
| Destination | Purpose |
4242
|-------------|---------|
4343
| Your LLM provider API | Model inference (Anthropic, OpenAI, etc.) |
44-
| Official Altimate Base gateway (embedded in release), or the host set by `ALTIMATE_BASE_GATEWAY_URL` | Altimate Base registration and inference when you explicitly enable Altimate Base |
44+
| Official Altimate Base gateway (embedded in release), or the host set by `ALTIMATE_BASE_GATEWAY_URL` | Altimate Base registration (automatic at startup on any install not yet registered, unless `ALTIMATE_BASE_AUTO_REGISTER=0`, after logging out of Base, or during the 1–24 h retry backoff after a network error, rate limit or gateway server error) and inference |
4545
| `registry.npmjs.org` | Package updates |
4646
| `models.dev` | Model catalog (can be disabled) |
4747
| Your warehouse endpoints | Database connections |

‎docs/docs/reference/security-faq.md‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,23 @@ Answers to the most common security questions about running Altimate Code in you
1111

1212
## Does Altimate Code send my data to external services?
1313

14-
Altimate Code sends prompts and context to the LLM provider you configure (Anthropic, OpenAI, Azure OpenAI, AWS Bedrock, etc.). **You choose the provider.** No data is sent anywhere else except optional [telemetry](#what-telemetry-is-collected), which contains no code, queries, or credentials.
15-
16-
Altimate Base is an optional hosted provider. Its confirmation dialog explains that requests and
17-
responses are logged and may be used to improve Altimate products and services; do not send
18-
secrets or confidential code. The dialog defaults to **No**, and no registration request is made
19-
unless you explicitly accept. This request logging is part of the Altimate Base service and is
20-
separate from anonymous product telemetry.
14+
Altimate Code sends prompts and context to the LLM provider you configure (Anthropic, OpenAI, Azure OpenAI, AWS Bedrock, etc.). **You choose the provider.** Beyond that provider, Altimate Code contacts the Altimate Base gateway to register this install (see below), and sends optional [telemetry](#what-telemetry-is-collected), which contains no code, queries, or credentials.
15+
16+
Altimate Base is Altimate's own hosted free model. By default, every install that is not yet
17+
registered registers it automatically at startup, whether or not you also have a model of your own.
18+
Registration sends only a hash of a random per-install secret and the CLI version, not your prompts or code. It is skipped when
19+
`ALTIMATE_BASE_AUTO_REGISTER=0` is set, after you log out of Base, when no gateway is configured, and
20+
during the retry backoff that follows a network error, rate limit or gateway server error. There is
21+
no confirmation dialog to accept. It only becomes your default model when nothing you configured is
22+
usable. Requests and responses are
23+
logged and may be used to improve Altimate products and services, including the model; secrets are
24+
automatically masked before storage, but don't rely on it — avoid sending secrets or confidential
25+
code. This notice is shown once — a toast in the TUI the first time Base becomes the active model, or a one-line stderr notice the first time
26+
a headless entrypoint (`run`, `serve`, `acp`, `web`) runs with Base registered — and is part of the Altimate
27+
Base service, separate from anonymous product telemetry. To opt out: set
28+
`ALTIMATE_BASE_AUTO_REGISTER=0` before Base ever registers, run `altimate providers logout
29+
altimate-base` afterward, or exclude it from your own model choices with `enabled_providers` /
30+
`disabled_providers` (see [providers](../configure/providers.md#altimate-base)).
2131

2232
**What identifies you to Altimate Base.** Registration sends a SHA-256 hash of a locally generated
2333
installation secret — the secret itself never leaves your machine. That hash is stable, so logged
@@ -110,7 +120,7 @@ You can also configure per-agent permissions. For example, restrict the `analyst
110120
| Destination | Purpose |
111121
|-------------|---------|
112122
| Your configured LLM provider | Model inference |
113-
| Altimate Base gateway | Registration and inference only after you explicitly enable Altimate Base |
123+
| Altimate Base gateway | Registration (automatic at startup on any install not yet registered) and inference |
114124
| Your warehouse endpoints | Database queries |
115125
| `registry.npmjs.org` | Package updates |
116126
| `models.dev` | Model catalog (can be disabled) |

0 commit comments

Comments
 (0)