Skip to content

fix(usage): every host reads the fleet's Magpie gateway, not only the ones its configs name (CLO-1348) - #248

Merged
nullStack65 merged 2 commits into
release/native-0.1.10from
feat/clo-1348-usage-fleet-parity
Nov 29, 2026
Merged

nullStack65 merged 2 commits into
release/native-0.1.10from
feat/clo-1348-usage-fleet-parity

Conversation

@nullStack65

Copy link
Copy Markdown
Owner

Problem

CLO-1348: T3 Usage should show the same Magpie-backed data on every fleet machine. Quota-row discovery found a Magpie gateway only from a private base URL named in an enabled instance's own config (Codex config.toml, OpenCode config, Claude settings). A host that signs in natively names none, so its panel listed different quota accounts than a host routed through the gateway, although the fleet reads one source: the ASUS gateway's /v1/magpie/quotas, over the loopback link 127.0.0.1:13425 (127.0.0.1:3425 on ASUS itself; see scripts/magpie_quota.py and docs/infra/subscriptions.md in Home).

Change

discoverGatewayOrigins now appends the two fleet loopback origins after the ones the configs name. A closed port is dropped quietly, an account set already shown by a configured or discovered source is not listed twice (existing dedupe), and T3CODE_MAGPIE_FLEET_GATEWAYS=off restores config-only discovery. No new settings key, no credential, no schema change: older peers are unaffected because this is read-side only.

Scope

This PR is the quota-row half of CLO-1348 only. It does not close the issue. Still open on it:

  1. Upstream field audit: the live gateway read on 2026-11-29 returned claudex2, grokx2, codexx1 and one magpie-openrouter-free balance card. It carries balance, last, lastServedAt and resets fields the reader's schema ignores, and it returned no OpenCode or Antigravity/Gemini quota row. The balance card has no driver mapping and is dropped silently, so the panel cannot yet say "provider-limited" for it.
  2. Token totals, billed vs estimated cost and Magpie/T3 de-duplication: totals still come from each host's own transcript scan, joined client-side per environment the viewer has connected.
  3. Real-screen verification on each declared fleet T3 target, with exact builds and fleet-live receipts (needs the rollout of this change first).
  4. Mixed-version behavior is tracked in CLO-1095.

Prior art

Searched: 2026-11-29, nullStack65/t3code and Home repo for existing fleet quota readers.

  • scripts/magpie_quota.py (closura-quota): reuses its source and ports. Verdict: same source, different consumer.
  • Settings default for usageLimitSources: rejected. A persisted {} hides a decoding default, and a key would have to ship in config.
  • New fleet-wide aggregator service: rejected as unnecessary for the quota rows; one gateway is already the single source.

Verification

  • pnpm exec vp test run src/usage in apps/server: 9 files, 245 tests pass. New tests: discovery returns the fleet origins for a host whose instances name no gateway (and dedupes when they do), and UsageLimitSources shows a Magpie source from the loopback link with the other port refusing.
  • effect-tsgo tsrs --noEmit in apps/server: no errors. vp fmt clean on the 3 changed files.
  • Not run: vp lint (the local Node 22 cannot load the oxlint TypeScript plugin here, so CI is the lint check); no live UI check yet.
  • Live probe on r720: 127.0.0.1:13425/v1/magpie/quotas answered 200 with 6 cards; 127.0.0.1:3425 refused, as expected off ASUS.

Deploy: fleet

Model: claude-sonnet-5-5, harness t3/claude-code.

🤖 Generated with Claude Code

… ones its configs name (CLO-1348)

Usage limit discovery found a Magpie gateway only from a private base URL named in an enabled
instance's own config (Codex config.toml, OpenCode config, Claude settings). A host that signs in
natively names none, so its Usage panel listed a different set of quota accounts than a host routed
through the gateway, even though the fleet reads one source: the ASUS gateway's /v1/magpie/quotas,
over the loopback link on 127.0.0.1:13425 (127.0.0.1:3425 on ASUS).

Discovery now also tries those two loopback origins after the ones the configs name. They answer the
quotas route without a key and a closed port is dropped quietly. An account set a configured or
discovered source already shows is not listed twice. T3CODE_MAGPIE_FLEET_GATEWAYS=off restores
config-only discovery.

Scope: this is the quota-row half of CLO-1348. Token totals, billed cost and the per-target live
comparison stay open on the issue.

Model: claude-sonnet-5-5
Task: fix
Agent: Platform
Lane: CLO-1348
Harness: t3/claude-code

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 29, 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

…O-1348)

Review finding: refreshLive built its sources from route-named origins only, so
a host reaching the fleet gateway only through loopback lost the row on a
manual refresh. Read those origins without the live POST.

Model: claude-sonnet-5-5
Task: fix
Agent: Platform
Lane: CLO-1348
Harness: t3/claude-code

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@nullStack65
nullStack65 force-pushed the feat/clo-1348-usage-fleet-parity branch from 5a686c7 to b1b490b Compare November 29, 2026 16:41
@nullStack65
nullStack65 merged commit 39b0a57 into release/native-0.1.10 Nov 29, 2026
6 of 7 checks passed
@nullStack65
nullStack65 deleted the feat/clo-1348-usage-fleet-parity branch November 29, 2026 16:49
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