You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2ef2c8a
Browse filesBrowse the repository at this point in the historyBrowse files
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]>
0 commit comments