Skip to content

Tell a free reader the day's allowance is running low before it is used up #262

Open

Description

@bencode

Problem

A free reader discovers the day's allowance exists only when it is already gone. The proxy computes both sides of it on every request — per network store.tokensToday(subject, day) against dailyTokens (web-packages/server/src/quota/guard.ts:94), everyone together spentToday against totalDailyTokens (guard.ts:102) — yet the figure never leaves the server: an admission is { ok: true; done } | { ok: false; status; message } (guard.ts:15-16), silence or a refusal, with no remaining value in any response. The client matches that silence: across ui-packages/web/src the allowance appears only in code comments, static settings copy (model-providers/index.tsx:166), and the proxy's 429 text reaching core/models/proxy-error.ts — the conversation surface renders context and used tokens but never allowance state. So a reader several questions into a long document gets no signal that the next answer may refuse to start; the limit introduces itself by refusing, mid-session, when the only options are to stop reading or scramble for a key.

Proposal

Goal

After this, a free reader approaching the day's limit sees the notice while they can still act — add a key before being blocked, or spend the remaining answers deliberately — and the 429 refusal is no longer the first time the day's allowance is ever mentioned; no free reader learns of the limit from the refusal itself.

Verification

pnpm --filter @gamma-reader/server test src/quota
pnpm --filter @gamma-reader/web test src/features/conversation
grep -rn "running low" ui-packages/web/src --include='*.ts' --include='*.tsx' | grep -v '\.test\.'
pnpm check

(The grep fails today — "running low" appears nowhere — and lists the new notice after implementation; the two test runs and pnpm check guard the surrounding contracts.)

Refs

Activity

  1. added
    enhancement
    source:scheduled
    on Oct 27, 2026
  2. bencode commented on Oct 27, 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@dbf9cb6.

    Evidence audit: every citation confirmed to the exact line.

    Sensor: lint ✓; verify ✗ on main ✓ ("running low" appears nowhere; both test suites in the block pass).

    Verdict: valid, keep open. Two sharpenings:

    1. The Proposal's example reads only the per-network figure, but the guard can strand a reader through the shared pool (guard.ts:102) while their network remaining looks healthy — the low-notice must cover both figures or explicitly scope to per-network and leave the shared case to Give the used-up daily allowance a path to the fix it names — today the refusal notice says a key of your own is unaffected, offers nothing to click, and the reader re-sends into the same failure #246's refusal. Worth deciding up front.
    2. "Once per crossing, not per message" is the load-bearing UX detail, yet no Verification command exercises it — the conversation unit test already in the block should pin the crossing state (shown below threshold, cleared on recovery, not re-shown while still low), so the anchor tests the outcome rather than the phrase "running low".
  3. bencode commented on Oct 29, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit @ d05b6b6 (stalest remaining review, first pass predated the 10-28 commits) — valid, one anchor corrected below; stays open.

  4. bencode commented on Nov 1, 2026

    @bencode
    OwnerAuthor

    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).

  5. bencode commented on Nov 6, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit at d05b6b6 (HEAD unchanged since 2026-11-01) — valid, stays open.

    Verdict unchanged; the standing sharpening remains the real gap: no command exercises "once per crossing, not per message" — the composer-side crossing-state test (fires on the crossing request, not again while still low, clears on recovery) is what would anchor the outcome.

  6. bencode commented on Nov 10, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit (fifth pass) @ d05b6b6 — valid, stays open. HEAD unchanged since 2026-10-28; no commit, PR, or issue in any state has appeared since #295 (2026-11-05).

  7. bencode commented on Nov 13, 2026

    @bencode
    OwnerAuthor

    Posted by the scheduled issue-reviewer loop, independent of the authoring session.

    Re-audit (sixth pass) @ d05b6b6 — valid, stays open. HEAD unchanged since 2026-10-28; no commit, PR, or issue in any state has appeared since #295 (2026-11-05) — open PRs #287 and #293 touch neither surface.

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