agy-cli's usage reader keeps the hung sign-in guard and stops reading agy's startup diagnostics as sign-in talk.
agy logs unauthenticated cache lookups (glog lines, "I1115 12:00:00.000 ...]") before it loads its keyring, so a timeout whose only output was those lines was marked as a dead sign-in. The reader now takes those lines out before testing for sign-in talk. A timeout with an ended token that prints nothing, or real sign-in talk (accounts.google.com, "Waiting for browser authentication"), still marks that stored sign-in dead, so a signed-out agy is never restarted in the background until the credential changes (the 235 browser opens a day that b40a853c stopped). A diagnostics-only timeout backs off and retries with the same sign-in.
Run at the reviewed head 9311076c merged onto origin/main, on mote:
- HOME=$(mktemp -d) bun test packages/agy-cli: 35 pass, 0 fail (test/usage.mjs runs with its mocks inside).
- bun scripts/check.mjs agy-cli: ok.
Broken by hand, each red on test/usage.mjs:
- the timeout branch removed (auth only on kind "auth"): "a hung sign-in with an ended token is never restarted until the credential changes" fails.
- SIGN_IN_TALK tested on the raw output: "a timeout with only OAuth diagnostics backs off and recovers with the same sign-in" fails.
Not tried: a real agy whose token has ended; the cases are the fake agy's.
Co-authored-by: nicegui <luolingpeng@lovart.ai>