Recover model-usage limits from a boot-time probe failure

The shell starts before DHCP finishes, so Claude's first probe of the
OAuth usage endpoint came back as a transport failure and pinned "Claude
limits unavailable" for a full refresh interval. Opening the panel could
not clear it either: the open path refreshed unforced and hit the same
throttle it was trying to escape.

A transport failure now arms a short retry that goes straight to the
probe, since a retry answering to the throttle never gets off the
ground. Any real answer disarms it — a server that replied, 429
included, is one to stop pestering. Probes are single-flight, a fresh
token skips the throttle its predecessor set, and opening the panel asks
for the wire without re-walking every transcript on disk.

The module also earns its place in the bar now instead of sitting there
dimmed with nothing to say: it collapses out entirely until a provider
has actually recorded usage, here or on a synced machine. That made both
presence probes redundant, so they are gone. Selection follows the
provider rather than its slot, so one appearing while the panel is open
no longer swaps out what you were reading.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-07-28 11:00:43 -07:00
co-authored by Claude Opus 5
parent 9b693cca63
commit 24dc914d28
5 changed files with 112 additions and 57 deletions
+4 -16
View File
@@ -35,9 +35,6 @@ Item {
property string tierLabel: ""
property string usageStatusText: ""
// Optimistic until the probe answers, so a present provider never blinks
// out of the panel on startup.
property bool installed: true
property string authHelpText: "Run `codex login` to authenticate."
property bool hasLocalStats: true
@@ -46,17 +43,6 @@ Item {
readonly property string scannerPath: String(Qt.resolvedUrl("../scripts/codex_usage_scanner.py")).replace("file://", "")
// Codex is "here" if its state directory, its session store, or the CLI
// exists. Re-runs on refresh so installing it mid-session shows up.
Process {
id: presenceProbe
running: true
command: ["bash", "-c", "[[ -d \"$HOME/.codex\" ]] || [[ -d \"$HOME/.pi/agent/sessions\" ]] || command -v codex >/dev/null"]
onExited: function (exitCode) {
root.installed = exitCode === 0
}
}
Process {
id: usageScanner
command: ["python3", root.scannerPath]
@@ -89,14 +75,16 @@ Item {
}
function refresh(force) {
if (!presenceProbe.running)
presenceProbe.running = true
if (usageScanner.running)
return
root.refreshing = true
usageScanner.running = true
}
// Codex reports limits and local stats from the same scanner run, and that
// run has no expensive mode to skip, so there is nothing cheaper to do.
function refreshLimits() { refresh() }
function parseScannerOutput(output) {
const raw = String(output || "").trim()
if (raw === "")