Files
magpie/docs
yetone d2d94917a6 provider: a Claude allowance heard as Claude Code answered is on the cards a Remote magpie is told, not "nothing read" (#2206, SuInk)
NoteClaudeLimits keeps the windows a Claude answer tells in claudeUsage
and drops the account's LoginUsage reading (StaleAllowance), while the
cards another magpie is told (CachedCards → withAccountReadings) were
built from loginUsageCache and quotas.json only. On a `magpie serve`
that only requests reach, the latest (often the only) Claude reading
was a header, so the remote's Claude card went missing or stale until
its refresh ran LoginUsage.

- claudeUsageEntry gets heardSeq, taken from quotaReadSequence when a
  header is noted: in the same order readings are (readSeq, which is
  taken when a read starts).
- withHeardClaude lays the kept windows on the Claude account's card
  when they were heard after the card's reading started; a reading
  started after the header stands. An account with no card and no
  reading gets one from the header (Plan from its login).
- A /usage run writes a fresh entry (heardSeq 0), so its own reading,
  carried by the card read that ran it, stands.
- docs/subsystems/providers-accounts.md: the allowance row says so.

Run (sandbox HOME, private GOCACHE):
- TestCachedCardsTellHeardClaudeLimits (new, from SuInk's repro): a
  header with no reading gives a card at 42%; a reading started before
  the header (10%) doesn't replace it; one started after (55%) does; a
  later header (60%) wins again. Red without the cards_kept.go change
  ("no Claude card"); with the seq comparison removed it fails "a
  reading started after the header: used 42, want 55".
- go test -tags nogui ./internal/provider -run
  'TestCachedCardsTellHeardClaudeLimits|TestCachedCards|Claude': ok.

Run on the stack of #2204, #2208, #2206 and #2201 on 743fcc035 (the
same trees as pushed), sandbox HOME, private GOCACHE, go1.26.8:
- gofmt -l on the changed Go files: clean. go vet ./... on darwin,
  GOOS=linux -tags nogui and GOOS=windows: clean. go build . on all
  three: ok.
- go test -tags nogui ./...: 51 packages ok; internal/agent and
  internal/gateway hit the 10m default timeout at load ~200 (#2191).
  Rerun with -timeout 60m: agent ok (1205s); gateway ok but
  TestOTelFastRequestTranscriptDiscovery/true (#1811, the 50ms session
  window under load), which passes alone -count=3.
- go test -race -tags nogui ./internal/gateway -run
  'TestRemoteMagpie|TestVerify' and ./internal/provider -run
  'TestCachedCards': ok.

Not tried: a real Remote magpie pair with a real Claude account (no
Claude API calls are made with a user's token here).
2026-10-15 00:54:00 +08:00
..