Watch
1
0
Fork
You've already forked souveraine
0
Commit graph souveraine/tools/provider-balance.py
Author SHA1 Message Date
Fimeg
c66343f105 provider-balance: read logins and every agent, not three roles
An OAuth login reports present while dead: both Claude access tokens
expired 11h ago and only the refresh token, good 27 more days, keeps
them working. Presence was the check; expiry is the answer.
Widening to per-agent models found Hal and TestAgent naming models
absent from [models.*] — they would fail at first use, not at config.
2026-08-13 10:27:33 -04:00
Fimeg
a2648543b2 provider-balance: distinguish a subscription cap from bankruptcy, ship the tests
The classifier's tests existed only as a throwaway heredoc, so they could not
be re-run and protected nothing. They are now in the file behind --selftest,
built from HTTP bodies captured verbatim rather than written from memory.

Cap and rate wording is now checked before the bankruptcy markers. OpenCode Go
is a subscription with $12/5h, $30/week and $60/month ceilings; hitting one
means wait, not pay, and a cap message that also says 'billing' would otherwise
be reported as an empty account. Verified safe: none of the three real
bankruptcy bodies contain any cap or rate wording.

The Go cap wording itself is unverified and labelled as such in the source
rather than presented as observed.

Gate proven able to reject: removing one marker fails 2/9 and exits 1.
2026-08-13 10:13:35 -04:00
Fimeg
6b9a415aac tools: probe provider balance before a role dies
Three providers ran out of credit in two days (zai, deepseek, opencode) and
in every case the first signal was a failed subconscious pass. Balance
exhaustion is invisible until something dies; absence of complaint reads as
health.

Sends a real one-token completion rather than checking reachability -- GET
/models on opencode returns 200 with a valid key and a bankrupt workspace.
Classifies on wording, not status code: the same condition is 429 on zai,
402 on deepseek, 401 on opencode.

Exits non-zero only when a provider backing a live role (subconscious,
reflection, archivist) cannot answer, or a role names a model absent from
[models.*].

curl rather than urllib: opencode is behind Cloudflare, which answers
Python-urllib's user-agent with 403 code 1010 -- indistinguishable from a
rejected key.
2026-08-13 09:59:16 -04:00