07faed33bb
Anthropic OAuth refresh tokens are single-use: the POST that returns a new pair invalidates the one that was sent. The replacement therefore only becomes real once it reaches its authoritative store - ~/.claude/.credentials.json for claude_code entries, ~/.hermes/.anthropic_oauth.json for hermes_pkce ones. Both writers caught OSError/IOError, logged at debug level and returned nothing, so no caller could tell a durable commit from a failed one. That let a refresh spend the only refresh token, report success, and leave the consumed pre-rotation pair on disk. _seed_from_singletons() re-reads those files on every load_pool(), so the next process seeded the spent pair back over the fresh pool row and the following refresh replayed a consumed token (invalid_grant / refresh_token_reused) - exactly the failure this PR set out to remove. - _write_claude_code_credentials() and _write_hermes_oauth_credentials() now raise CredentialPersistError instead of swallowing the write error. - _refresh_oauth_token() treats a failed commit as a failed refresh and returns None rather than handing back an access token whose refresh half was lost. - _refresh_entry_impl() fails closed on both the primary and the recovery path: the rotated pair is never marked, persisted or returned, and the entry is quarantined DEAD with a credential_persist_failed reason so it leaves rotation and surfaces as an explicit re-auth instead of a silent fallback to another provider. The retry path now commits to the singleton before persisting the pool row. - _upsert_entry() no longer treats re-seeding a borrowed source as a rotation. Borrowed rows (claude_code, env-backed) are written to auth.json without their secret, so comparing the re-seeded token against the empty stored value reported a rotation on every load and cleared the DEAD state the previous process had just written - resurrecting the quarantined, already-consumed credential on restart. It now compares the incoming token against the row's secret_fingerprint. Adds failure-injection coverage for both writers, the direct resolver, the claude_code and hermes_pkce pool paths and the retry path, each asserting that a reload cannot bring the pre-refresh pair back as a usable credential.