Skip to content

Let a reader replace a stored key in place — the only action on a configured provider today is Remove, which drops the model selection and switches conversations to the free allowance #174

Closed as not planned

Description

@bencode

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.ts already does this), then saveUserProvider with 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 check

Refs

  • 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 — save upserts 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

  1. added
    enhancement
    source:scheduled
    on Oct 22, 2026
  2. bencode commented on Oct 22, 2026

    @bencode
    OwnerAuthor

    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:scheduled proposals. Audited against main@ebb0ee0.

    Evidence audit: every citation confirmed, most to the exact line.

    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:

    1. Proposal bullet 3 (auth-class notice) is unanchored and is the expensive third of the issue. 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 into errorMessage, 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.
    2. The store's upsert replaces wholesale — the test should pin that replacing a key preserves models, visionModel and 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.
  3. bencode commented on Oct 26, 2026

    @bencode
    OwnerAuthor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsource:scheduled

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions