Repository navigation
Description
Problem
The provider dialog promises "Keys are kept in this browser and are never sent to Gamma Reader." (ui-packages/web/src/features/settings/model-providers/index.tsx:165), and saving appears to honor it: the dialog calls saveUserProvider (index.tsx:135), the store updates, the dialog closes. But the actual keep is one localStorage.setItem whose catch only logs (ui-packages/web/src/core/models/byok/store.ts:51-56):
const writeProviders = (providers: readonly UserProvider[]) => {
try {
localStorage.setItem(storageKey, JSON.stringify(providers))
} catch (error) {
console.error('Unable to save configured model providers', error)
}
}save then sets the in-memory state regardless of the write's outcome (store.ts:70-71), and saveUserProvider returns void, so nothing can tell the dialog the write was refused. In any browser that refuses or drops localStorage writes — a private window, site-data settings, a quota ceiling — the reader types a key, sees success, uses it for the session, and finds it gone on the next launch, the only diagnosis sitting in the browser console. The dialog already has a failed phase for key-checking failures (index.tsx:239-241); a write refusal never reaches it.
Proposal
- Let the write result out of the store:
save/saveUserProviderreports whetherlocalStorage.setItemactually persisted — the catch already exists (store.ts:55), it just swallows. - When the write was refused, keep the dialog open in its existing
failedphase with reader language, e.g. "Gamma Reader could not keep this key in this browser. It works until the page closes, then it is gone — check the browser's site-data settings for this site." - The console.error stays; the reader gets the same honesty the key-check path already has (
index.tsx:239-241).
Goal
After this, no reader closes the provider dialog believing a key is kept when the browser refused to keep it: the refusal is named in the dialog, right under the promise "Keys are kept in this browser", and the works-until-close-then-gone behavior is said out loud instead of discovered on the next launch.
Verification
pnpm --filter @gamma-reader/web test src/core/models/byok src/features/settings/model-providers
grep -rn "could not keep" ui-packages/web/src --include='*.ts' --include='*.tsx' | grep -v '\.test\.'
pnpm check(The grep fails today — "could not keep" appears nowhere in the app — and lists the new dialog copy after implementation; the two suites cover the store's write contract and the dialog's failure phase; pnpm check guards the whole build.)
Refs
- ui-packages/web/src/core/models/byok/store.ts:51-56 — the swallowed write; store.ts:70-71 — state set regardless of the write's outcome
- ui-packages/web/src/features/settings/model-providers/index.tsx:135 — save closes through a void; index.tsx:165 — the promise; index.tsx:239-241 — the failed phase that never hears about this
- Say why nothing opens — a first visit in a browser that blocks site data meets only 'Projects could not be opened in this browser', and its one link loops back to the same screen #180 (closed, shipped) — the same browser wall said out loud at the project door ("Say why nothing opens"); this is the key-save door of that family
- Tell Safari readers the library expires with disuse — WebKit deletes an unused site's storage after 7 days, and every durability sentence names only disk pressure or cleared data #252 (open) — the Safari storage family's eviction member; this is its refused-write member, at the moment of saving
- Say a failed own-key reply in reader language — the notice shows the vendor's raw JSON error body today #228 (open) — own-key failures mid-answer; adjacent failure surface, different moment
- ui-packages/web/PRODUCT.md — "Keep document data local by default and explain the few actions that affect persistence": a reader's key is persistence too
Activity
bencode commentedon Oct 27, 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@dbf9cb6.Evidence audit: every citation confirmed to the exact line.
byok/store.ts:51-56—writeProviderscatch →console.erroronly, verbatim;:70-71—writeProviders(providers)then unconditionalset({ providers }), exactly the cited lines.model-providers/index.tsx:135—saveUserProvider({insidesave;:165— the "Keys are kept in this browser…" promise;:239-241— thefailedphase withfailureText[phase.reason].Sensor: lint ✓; verify ✗ on main ✓ (both suites in the block pass; "could not keep" appears nowhere).
Verdict: valid, keep open. Two sharpenings:
remove(store.ts:73-75) calls the same swallowedwriteProviders— ifsavestarts reporting persistence,removeneeds the same contract, or a reader gets the inverse surprise: the dialog closes believing the key gone, the write fails, and the key survives to the next launch (arguably worse than the save case). The store tests in the block should pin both paths.failedphase couples this tofailureText[phase.reason](:241), whose reasons are key-check failures; a refused write is a different kind of failure with nothing wrong with the key. Use a distinct reason key so check-failure affordances don't leak in, and have the dialog test pin that the dialog stays open with the copy — not merely that the copy exists.bencode commentedon Oct 29, 2026
Re-audit — posted by the scheduled issue-reviewer loop, independent of the authoring session. The previous review ran against
main@dbf9cb6; this beat re-audited againstmain@d05b6b6. The commits since are the plugins feature (#279, #283);git diff dbf9cb6..d05b6b6overbyok/andmodel-providers/is empty.store.ts:51-56(the swallowed write,console.erroronly),:70-71(writeProviders(providers)then unconditionalset({ providers })),index.tsx:135(voidsaveUserProvider),:165(the "Keys are kept in this browser…" promise),:239-241(thefailedphase).removestill routes through the same swallow (store.ts:73-77, write at:75).removeneeds the same persistence contract assave(a silently surviving key is the inverse surprise), and the refused write should carry its own failure-reason key instead of reusing the key-checkfailureText[phase.reason], with the dialog test pinning that the dialog stays open.bencode commentedon Nov 1, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Re-audit at d05b6b6 — valid, stays open (HEAD unchanged since the last review; this pass adds the gate-health check the 10-31 → 11-01 round gave the other issues).
byok/store.ts:51-56, catch →console.erroronly);:70-71stillwriteProviders(providers)then unconditionalset({ providers });removestill routes through the same swallow (:73-77, write at:75); the dialog citations hold —index.tsx:135(saveUserProvider({into a void),:165(the "Keys are kept in this browser…" promise),:239-241(thefailedphase,failureText[phase.reason]). "could not keep" appears nowhere in the app."could not keep"grep. Correctly red.-tpattern (no vitest-5 vacuous exit-0, the Recover a custom endpoint's context overflow like every other model's — the compact-and-continue rescue is gated on a context window no reader-added service has, so its long conversations dead-end in re-sends #285/Let a key change in one tab reach the others — a tab that missed it keeps sending a deleted key, and never lists an added model, until reload #292 hazard) and no--silentbefore a positional (no Let a large workbook open without freezing the reader — today the whole sheet parses on the main thread before the first rows can show, and every row stays in memory though the grid draws a window #275-style crash); the grep's| grep -v '\.test\.'tail keeps a test-only phrase red — green requires production copy. Sound as written. The standing sharpenings are unchanged and unaddressed:removeneeds the same persistence contract assave(a silently surviving key is the inverse surprise), and the refused write should carry its own failure-reason key with a dialog test pinning that the dialog stays open — the phrase grep alone cannot tell kept-open from merely-worded.bencode commentedon Nov 6, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Renewal @ 2026-11-07, HEAD still d05b6b6 — valid, stays open. No commits since the 11-01 re-audit; this pass re-ran the checks rather than assume.
byok/store.ts:51-56, unconditionalsetat:70-71; dialog citesindex.tsx:135/:165/:239-241. "could not keep" still appears nowhere in the app.removeneeds the same persistence contract assave, and a dialog test should pin stays-open — the phrase grep alone can't tell kept-open from merely-worded.bencode commentedon Nov 10, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Renewal @ 2026-11-11, HEAD still d05b6b6 — valid, stays open. Fourth pass, checks re-run rather than assumed.
byok/store.ts:51-56(catch →console.erroronly), unconditionalsetat:70-71,removestill routing through the same swallow (:73-77); dialog citesindex.tsx:135/:165/:239-241hold. "could not keep" appears nowhere in the app.removeneeds the same persistence contract assave(a silently surviving key is the inverse surprise), and a dialog test should pin stays-open — the phrase grep cannot tell kept-open from merely-worded.bencode commentedon Nov 13, 2026
Posted by the scheduled issue-reviewer loop, independent of the authoring session.
Fifth review @
d05b6b6(still HEAD — no commits since 2026-10-28) — valid, stays open.writeProvidersswallows the refused write inconsole.error(byok/store.ts:51-56, verbatim — the issue's quoted block matches the file);savecallswriteProvidersthenset({ providers })regardless of the outcome (:70-71), andremoveroutes through the same swallow (:73-77); the dialog'ssavecloses through the voidsaveUserProvider(index.tsx:135); the promise "Keys are kept in this browser and are never sent to Gamma Reader." verbatim at:165; thefailedphase withfailureText[phase.reason]at:239-241. "could not keep" still appears nowhere in the app (grep re-run: 0 matches).savereturning a boolean/result, orwriteProvidersno longer returning void) instore.ts, so green means the refusal actually escapes the catch, not merely that some copy landed.