Skip to content

fix(acp): go offline when Claude/Codex auth expires - #3876

Open
Chessing234 wants to merge 8 commits into
block:mainfrom
Chessing234:fix/acp-auth-expiry-presence
Open

fix(acp): go offline when Claude/Codex auth expires#3876
Chessing234 wants to merge 8 commits into
block:mainfrom
Chessing234:fix/acp-auth-expiry-presence

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Classify headless Authentication required (-32000) as a non-retryable auth error alongside Re-authenticate / API Error: 401.
  • On auth expiry: dead-letter the turn, post a restart-needed notice, stop presence heartbeats, and publish presence offline so the agent stops looking live in the sidebar.
  • Document the recovery path in buzz-acp README.

Fixes #3831

Test plan

  • cargo test -p buzz-acp --lib auth_error
  • Run a managed Claude agent, force claude auth logout (or expire creds), @mention it — expect channel notice + sidebar goes offline, no further online heartbeats
  • Re-login + restart harness — presence returns to online and mentions work again

Made with Cursor

Give the event loop a distinct signal when credentials are dead so it can
stop advertising online without exiting the process.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Headless Claude expiry reports -32000 with this message; dead-letter it with
the existing Re-authenticate / 401 patterns instead of retrying forever.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Surface credential death to the event loop after dead-lettering the batch
and posting the re-auth notice.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Keeps the harness process up for logs/restart, but stops looking online in
the sidebar once Claude/Codex credentials are dead (block#3831).

Signed-off-by: Taksh <takshkothari09@gmail.com>
Pin the headless Claude expiry message so a future precision tweak cannot
quietly drop it from the non-retryable set.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Regression pin for the block#3831 sidebar-online-after-credential-death path.

Signed-off-by: Taksh <takshkothari09@gmail.com>
The channel notice now matches presence behavior — re-login alone is not
enough until the harness process is restarted.

Signed-off-by: Taksh <takshkothari09@gmail.com>
Operators running headless Claude agents hit this often; put the recovery
steps next to the other harness docs.

Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234
Chessing234 requested a review from a team as a code owner July 31, 2026 08:20
@Chessing234

Copy link
Copy Markdown
Contributor Author

@tlongwell-block @wesbillman @wpfleger96 mind taking a look when you get a chance?

@HashMac

HashMac commented Aug 3, 2026

Copy link
Copy Markdown

Independent macOS managed-agent reproduction. The failure surfaced as:

Agent reported error (code -32000): Failed to authenticate: OAuth session expired and could not be refreshed

The current patch matches Re-authenticate, API Error: 401, and Authentication required, so this exact provider wording still appears to miss is_auth_error() and enter the generic requeue/backoff path. I observed repeated retries while the runtime continued to look available; the channel had no actionable reauthentication state.

Reauthenticating the Claude subscription and restarting the managed runtime restored turns.

Could this PR add a precise match and fail-first test for OAuth session expired and could not be refreshed (ideally constrained to AgentError / code -32000)? Suggested live acceptance:

  1. Expire subscription OAuth and mention the agent.
  2. One visible reauthentication notice; presence becomes offline/not-ready; no retry storm.
  3. Reauthenticate and restart.
  4. Presence returns online and one fresh mention produces exactly one turn.

This is the same user-facing failure as #3831, just a fourth message variant.

@Chessing234
Chessing234 force-pushed the fix/acp-auth-expiry-presence branch from a1e93e4 to 4b600cd Compare August 5, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent stays "online" after its Claude credentials expire — every mention fails with -32000, nothing surfaces it

2 participants