Files
DuncanandWill Pfleger c581d2eca9 fix(buzz-agent): classify refresh 4xx by OAuth error, add cross-process auth tests
Refresh classification now keys on the OAuth error body, not the bare HTTP
status class. Per RFC 6749 §5.2 only `error == "invalid_grant"` means the
refresh token is dead — the one failure a browser sign-in can repair. Every
other 4xx (`invalid_request`, `invalid_client`, `unsupported_grant_type`,
`invalid_scope`, 408, 429), an unparseable error body, and all 5xx stay in the
infrastructural bucket as `NetworkUnavailable`, so a rate limit or a
misconfigured request can no longer pop a needless browser.

Prove the cross-process single-flight contract with a real second process. The
in-memory `INFLIGHT` registry coalesces same-key callers within one process
before the file lock, so two in-process handles cannot exercise the
cross-process protocol. A new `auth-worker` test binary runs the public
coordinator API against a shared temp cache and a scripted opener, driven by
barrier-marker files, covering (a) a `UserInitiated` denial in one process
shared with an already-waiting `Auto` in another and (b) two coordinator
processes racing to one grant and one cache artifact. Rename the two tests that
falsely claimed to be cross-process to reflect the in-process single-flight
they actually exercise. Run the coordinator integration suite on the Windows CI
job so `LockFileEx` contention and crash release execute rather than compile
only.

Gate the first provider response in the steer fold test so round 1 cannot
complete until the steer is sent and observed accepted, removing a
nextest-scheduling race in which round 2's boundary could drain an empty steer
queue before the steer was dispatched.

Co-authored-by: Will Pfleger <pfleger.will@gmail.com>
Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
2026-08-11 10:00:49 -04:00
..