Skip to content

fix(usage): refresh Magpie limits live and re-probe exhaustion - #170

Open
nullStack65 wants to merge 1 commit into
release/native-0.1.10from
feat/usage-limits-magpie-refresh
Open

nullStack65 wants to merge 1 commit into
release/native-0.1.10from
feat/usage-limits-magpie-refresh

Conversation

@nullStack65

Copy link
Copy Markdown
Owner

A manual click on Limits refresh kept Magpie's cached cards, so the panel stayed stale or said instances had no quota when Magpie already had cards. The click now forces the live quota reread, clears in-memory exhaustion for those instances, and marks a vendor that is still out.

The Limits button asks the server to reread Magpie. The server posts /api/usage/quotas/refresh for each Magpie-backed card, the same operation as magpie quota refresh. A JSON object on that route is the cached list, so it is an error, not a success. The cached GET /v1/magpie/quotas path is unchanged and still serves automatic refresh. Automatic refresh still shares one in-flight read and skips for five minutes. A manual click waits for an in-flight automatic read, then starts the live reread anyway.

After a successful live reread, T3 clears ProviderExhaustion for each Magpie route and marks it again when every readable account is still spent. An unread or failed origin is left alone, so a failed refresh does not look available. The refusal text is unchanged: Provider "<instanceId>" is out of usage until <iso>; pick another provider.

Model: grok-4.7
Task: implement
Agent: grok
Harness: grok

Verified at b4f63285e4a20e1b102c8f4f3d8229d6b7f40966 with Node 26.13.1:

  • magpieQuotas.test.ts (13): live POST URLs, last card list kept, cached object body rejected, hanging body gives up.
  • UsageLimitSources.test.ts (16): live refresh posts the reread and a still-spent account is marked again.
  • usage.test.ts (7): automatic refresh coalesces; a manual click is not swallowed by the five-minute gate.
  • usageLimitsRefresh.test.ts (3): a manual refresh sends liveQuotaRefresh.
  • usageLimits.test.ts (100): the pooled empty count drops once Magpie has cards for that driver.
  • ModelAlertReactor.test.ts (42): reapply clears, then marks when the probe is still exhausted.
  • effect-tsgo on the server, contracts, shared, client-runtime, web, and mobile packages: no new type errors.
  • Pre-commit fmt and lint passed. Knip fails only on four unused files this change does not touch: .github/scripts/mirror-play-apk.cjs, apps/web/scripts/verify-built-boot.ts, scripts/resolve-nightly-release.ts, and scripts/smoke-cli-archive.ts.

pnpm install --offline --frozen-lockfile could not run: the local metadata mirror is empty (ERR_PNPM_NO_OFFLINE_META). A network pnpm install --frozen-lockfile succeeded and did not change the lockfile. The live Magpie process was not called. CI on this head has not been watched.

Deploy: none

A manual Limits refresh was reading Magpie's cached card list, so the
panel kept stale cards or said instances had no quota when Magpie had
cards. It now posts the live quota reread and ignores a cached object
body. The same click clears in-memory exhaustion and marks a vendor
that is still out.

Automatic refreshes still share one in-flight read and wait five
minutes. A manual click waits out an automatic read, then forces the
live reread.

The pre-commit knip check fails on four unused files this change does
not touch: .github/scripts/mirror-play-apk.cjs,
apps/web/scripts/verify-built-boot.ts, scripts/resolve-nightly-release.ts,
and scripts/smoke-cli-archive.ts. Fmt and lint passed.

Model: grok-4.7
Task: implement
Agent: grok
Harness: grok
@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown

Important

  • Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

Run configuration

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@nullStack65

Copy link
Copy Markdown
Owner Author

Note

🤖 grok-4.7 responding on behalf of nullStack65

Not merged. Head b4f63285e4a20e1b102c8f4f3d8229d6b7f40966 is open against release/native-0.1.10 at c0649bf4ec57bebfa6e46b1849a402576e4c8c97. REST mergeable is true and mergeable_state is blocked. Reviews are empty. The CodeRabbit success status is not a review. Deploy is none, and nothing was deployed.

The diff matches the handoff. A manual Limits refresh sends liveQuotaRefresh: true, and the server calls refreshLive, which rereads Magpie and publishes that snapshot. ProviderExhaustion.reapply clears the in-memory mark and marks it again when the probe still returns a reset time. Automatic refresh still returns without starting a second check while one is in flight, and it still honors the cooldown. This was read from the diff. The tests were not re-run here.

The required check on this branch is Voice + founder inbox (Linux ARC). It has not started. Core 136940661696, web 136940661896, and mobile 136940661869 are queued. Deploy line 136940661956 succeeded. That success does not publish.

@nullStack65

Copy link
Copy Markdown
Owner Author

Note

🤖 grok-4.7 responding on behalf of nullStack65

The required check is green on head b4f63285e4a20e1b102c8f4f3d8229d6b7f40966, and the pull request is still not merged.

Latest run of each check name is success. The required aggregator Voice + founder inbox (Linux ARC) is job 136950494239, completed 2026-11-21T19:01:33Z. Core 136940661696, web 136940661896, and mobile 136940661869 succeeded. Deploy line job 136940661956 succeeded and does not publish. The CodeRabbit status is success.

REST mergeable_state is clean. GraphQL mergeStateStatus is CLEAN and the status rollup is SUCCESS. reviewDecision is empty. The reviews list is empty, and there are no inline review comments. CodeRabbit comment 7067233388 is a skip because the repository has fewer than 10 stars. It has no findings.

Merge waits for one substantive bot review of this exact head. Nothing was deployed. release/native-0.1.10 and master were not pushed.

@nullStack65

Copy link
Copy Markdown
Owner Author

Frozen 2026-11-22 CEO portfolio audit — cash-path priority; can reopen at the Dec 18 runway check.

@nullStack65 nullStack65 reopened this Nov 22, 2026

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant