Skip to content

Ticket-provider auth failures should surface in UI, not just logs#445

Merged
jonwiggins merged 1 commit into
mainfrom
optio/task-2aa5ee7f-5970-450f-a094-3e55f3e1d5d7
Apr 17, 2026
Merged

Ticket-provider auth failures should surface in UI, not just logs#445
jonwiggins merged 1 commit into
mainfrom
optio/task-2aa5ee7f-5970-450f-a094-3e55f3e1d5d7

Conversation

@jonwiggins

Copy link
Copy Markdown
Owner

Closes #438

What changed

Ticket-provider sync errors (e.g. GitHub 401 "Bad credentials") were only visible in server logs, creating noise without any user-facing signal. This PR:

  • Persists sync errors per provider: Adds last_error, last_error_at, and consecutive_failures columns to the ticket_providers table. On each sync failure the error message and failure count are recorded; on success they are cleared.
  • Auto-disables after 5 consecutive failures: Providers that keep failing are automatically disabled to stop log spam. A warning is logged once when this happens.
  • Rate-limits error logging: Repeated failures with the same error message are downgraded to debug level instead of error, cutting log noise significantly.
  • Surfaces errors in the UI: The Settings > Ticket Providers section now shows the error message, timestamp, failure count, and a "Re-enable" button when a provider has errors or is disabled.
  • Adds PATCH /api/tickets/providers/:id/re-enable: Clears all error state and re-enables the provider — intended for use after the user refreshes their token.

How to test

  1. Configure a ticket provider (e.g. GitHub) with an invalid token
  2. Trigger a sync (click "Sync Now") or wait for the periodic sync
  3. Go to Settings > Ticket Integration — the provider should show a red error box with the failure message, "Re-enable" button, and failure count
  4. After 5 consecutive failures the provider should be auto-disabled (status dot turns grey, "Disabled" label appears)
  5. Fix the token (delete + re-add, or re-enter credentials), then click "Re-enable" — error state clears and syncing resumes
  6. Verify that repeated sync failures only log at debug level (not error) after the first occurrence

Tests: 4 new test cases covering error persistence, success reset, auto-disable, and log downgrading. All 1934 tests pass. Typecheck and web build clean.

- Add last_error, last_error_at, consecutive_failures columns to
  ticket_providers table so sync errors are persisted per-provider
- On successful sync, clear error state; on failure, record the error
  message and increment consecutive failure count
- Auto-disable provider after 5 consecutive failures to stop log spam
- Downgrade repeated identical errors to debug level logging
- Add PATCH /api/tickets/providers/:id/re-enable endpoint to clear
  errors and re-enable a disabled provider
- Update Settings > Ticket Providers UI to show error details, disabled
  state, failure count, and a "Re-enable" button
- Add migration and journal entry for the new columns

Closes #438

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jonwiggins jonwiggins merged commit 47a3f0f into main Apr 17, 2026
13 of 14 checks passed
jplorier pushed a commit to jplorier/optio that referenced this pull request May 5, 2026
…onwiggins#445)

- Add last_error, last_error_at, consecutive_failures columns to
  ticket_providers table so sync errors are persisted per-provider
- On successful sync, clear error state; on failure, record the error
  message and increment consecutive failure count
- Auto-disable provider after 5 consecutive failures to stop log spam
- Downgrade repeated identical errors to debug level logging
- Add PATCH /api/tickets/providers/:id/re-enable endpoint to clear
  errors and re-enable a disabled provider
- Update Settings > Ticket Providers UI to show error details, disabled
  state, failure count, and a "Re-enable" button
- Add migration and journal entry for the new columns

Closes jonwiggins#438

Co-authored-by: Optio Agent <optio-agent@noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

Ticket-provider auth failures should surface in UI, not just logs

1 participant