Skip to content

Notify the account when its subscription auto-disconnects on invalid_grant #1007

Open

Description

@czpython

What happened

The hourly rotation in backend/druks/harnesses/providers.py got invalid_grant ("Refresh token expired") for two accounts' Anthropic subscriptions and revoked the rows, as designed. Nobody was told. Each person found out on their next message or run, which failed with:

The agent cannot run: connect your Anthropic subscription in Settings → Providers. Send the message again to retry.

Over two weeks this text ended eight messages or runs for six people. A person on Slack has no "Settings → Providers" in front of them, and the text says to send the message again, which fails again. One person sent "hello" three times. A scheduled run under an affected account fails the same way with not_connected until someone notices.

Proposal

  • When a subscription auto-disconnects, notify the account: a chat message on the channel they used last, or the installation's notification destination for the default account. Say that the provider expired the grant and give the link to reconnect.
  • In the chat failure text, drop "Send the message again to retry" for not_connected, since a retry cannot succeed, and include the absolute link to the Providers page.
  • Show the disconnect on the Providers page with the time and the reason, so an operator can see who is affected.

Observed but not confirmed

One run failed not_connected while its account's row was not revoked and a run twenty minutes later succeeded. That looks like a run that started between the token's expiry and the rotation tick. If the harness reads expires_at before launching, a token within the rotation window should be refreshed on demand rather than refused.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions