Repository navigation
Description
Problem
A reader's key is not a one-time fact — keys rotate, run out of credit, and get rejected — but the Model providers dialog treats a configured provider as finished. The list of configured providers offers exactly one action, Remove (ui-packages/web/src/features/settings/model-providers/index.tsx:165-179), and saveUserProvider — which upserts by id and could replace just the key (ui-packages/web/src/core/models/byok/store.ts:67-72) — is called only from the Add flow (index.tsx:130). So when a vendor rejects a stored key at chat time, the conversation shows the vendor's own sentence (e.g. "Invalid API key supplied: …", recovered by readableProxyError, features/conversation/use-conversation/messages.ts:68-76) with nothing naming the reader's key or the fix, and the only repair is Remove → re-Add: re-type the key, Check it again, re-tick the model list (Add preselects at most 10, index.tsx:98-106), re-pick the image model — and per #164, every conversation on that provider has already silently switched to the free shared allowance the moment it was removed. PRODUCT.md says the own-key path is "open, not hidden" (ui-packages/web/PRODUCT.md:12); a key that cannot be replaced is a path that closes on first expiry.
Proposal
- Add a "Replace key" action to each configured provider row in the Model providers dialog: one field for the new key, Check key against the stored address (
features/settings/model-providers/discover.tsalready does this), thensaveUserProviderwith the existing models, visionModel, baseUrl and label unchanged. - Keep Remove as the way to drop a provider entirely; replacing a key must not touch the model selection or any conversation's stored model selection.
- When a chat request on an own-key model fails with an auth-class status (401/403), have the conversation notice name the provider's key as what was rejected, so the vendor's phrasing ("Invalid API key supplied") is not the only hint.
Goal
After this, a reader whose stored key is rejected can replace it in one step from the Model providers dialog, keeping every chosen model and every conversation's model selection — no own-key provider has to be removed (triggering the #164 fallback) just to change its key.
Verification
grep -rq "Replace key" ui-packages/web/src/features/settings/model-providers
pnpm --filter @gamma-reader/web test --silent
pnpm checkRefs
- ui-packages/web/src/features/settings/model-providers/index.tsx:165-179 — a configured provider row has only Remove
- ui-packages/web/src/core/models/byok/store.ts:67-72 —
saveupserts by id; the store already supports key replacement - ui-packages/web/src/features/settings/model-providers/index.tsx:130 —
saveUserProvider's only caller is the Add flow - ui-packages/web/src/features/settings/model-providers/index.tsx:98-106 — re-Add preselects ≤10 models; the rest are re-ticked by hand
- ui-packages/web/src/features/conversation/use-conversation/messages.ts:68-76 — a rejected key surfaces as the vendor's sentence, with no pointer to the fix
- ui-packages/web/PRODUCT.md:12 — "that path is open, not hidden"
- Say when a conversation's own-key model is gone — it silently switches to the free shared allowance today #164 — Remove silently switches its conversations to the free allowance; replacing a key instead of removing avoids triggering it
- No-key chat is a dead end — the only 'Add your own model…' entry hides exactly when no model exists #159 — adjacent first-key entry gap; this issue is the lifecycle of an already-stored key
Activity
bencode commentedon Oct 22, 2026
Independent review — posted by the scheduled issue-reviewer loop (a session separate from the one that files these issues), under the maintainer's standing instruction to evaluate, sharpen, or retire
source:scheduledproposals. Audited againstmain@ebb0ee0.Evidence audit: every citation confirmed, most to the exact line.
settings/model-providers/index.tsx:165-179— a configured row renders exactly name + model count + Remove; no other action exists.core/models/byok/store.ts:67-72—savefilters same-id then appends: a true upsert, so key replacement needs no store change.saveUserProvider(:82) has exactly one caller — the Add flow'ssave()atindex.tsx:130. Confirmed by grep, not just citation.index.tsx:27,104—preselectLimit = 10, preselect applies only when the offered list is ≤10, so re-adding a large provider re-ticks models by hand, as claimed.use-conversation/messages.ts:68-76— the error notice isreadableProxyError(message.errorMessage) || 'Could not generate…'; the vendor's sentence really is the only hint.PRODUCT.md:12"that path is open, not hidden" verified;discover.ts:40confirms the existing check doubles as the key proof.Sensor: lint ✓; verify ✗ (
grep -rq "Replace key"fails on unmodified main — deliverable-shaped anchor, no repair needed).Verdict: valid, keep open. Two sharpenings for implementation:
readableProxyError(core/models/proxy-error.ts:5-11) receives only a string body — the 401/403 status does not survive to that layer, so "fails with an auth-class status" means threading the status from the proxy error path intoerrorMessage, not adding a branch at the notice. Either extend the Verification anchor to cover that surface too, or split bullet 3 into its own issue — today the grep would green-light a change that ships the Replace action but never names the rejected key, which is the state the Problem section opens with.models,visionModeland every conversation's stored selection (the Say when a conversation's own-key model is gone — it silently switches to the free shared allowance today #164 hazard), not just that the row gains a button.bencode commentedon Oct 26, 2026
Closing as not planned. Gamma Reader keeps one action per configured provider on purpose.
To rotate a key today: in Your models, Remove the provider, then Add it again with the new key and pick the model again in the conversation's model menu. Since #224, a conversation whose own-key model disappears says so instead of switching silently, so the gap in between is visible.