Skip to content

fix(usage-queue): warn each pane on cred failure, not just the first - #233

Merged
aterrylu merged 1 commit into
mainfrom
terry/usage-queue-authwarn-perpane
Jun 20, 2026
Merged

fix(usage-queue): warn each pane on cred failure, not just the first#233
aterrylu merged 1 commit into
mainfrom
terry/usage-queue-authwarn-perpane

Conversation

@aterrylu

Copy link
Copy Markdown
Owner

Problem

Follow-up to #232. A review thread on that PR flagged a real bug in the usage-queue's credential-failure warning: authFailureNotified was a single global boolean, so the "warn each armed pane once" intent was actually implemented as "warn at most once across all panes."

Concretely:

  1. Creds break (e.g. expired session key).
  2. Pane A is armed → tick observes unauthorized → A is warned, authFailureNotified = true.
  3. Hours later (still broken), pane B is armed → tick sees authFailureNotified already true → B is never warned.

B now has a queued auto-send that can never fire and the user has no idea — a silent failure of the exact contract that warning exists to enforce.

Fix

Move the latch from a single global boolean to a per-pane authWarned flag on ArmedEntry:

  • On a permanent credential failure, warn any armed pane not yet warned — including one armed after an earlier warning while creds stayed broken.
  • Reset each pane's flag when a real usage signal returns (so a later break re-warns).

Testing

  • New regression test: warns a pane armed AFTER creds break, while they stay broken — arms one pane, warns it, then arms a second pane while still broken and asserts it's also warned (and the first isn't re-warned).
  • Existing auth test (warns each armed pane once) still passes — no re-warn spam, fires both on recovery.
  • Full suite green: server + 254 dashboard.

Note

This PR's base branch (main) now requires conversation resolution before merging (newly enabled), so a future unresolved review thread can't slip through to merge the way the original did.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UpGRD3fxgWmCKyp9nZtrQs

The credential-failure warning used a single global boolean, so only the first
armed pane was warned when usage became unreadable. A pane armed afterward,
while creds stayed broken, was never told its queued auto-send could never fire
— a silent failure of the exact contract that warning enforces.

Move the latch to a per-pane authWarned flag: warn any armed pane not yet
warned (including ones armed after an earlier warning), and reset each pane's
flag when a real usage signal returns. Adds a regression test for the
arm-after-break case.

Addresses the unresolved review thread on #232.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UpGRD3fxgWmCKyp9nZtrQs
@aterrylu
aterrylu enabled auto-merge (squash) June 20, 2026 20:16

@nox-0x nox-0x left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving — clean targeted fix for the per-pane vs. global auth-warning latch flagged on #232, with a regression test that exercises the exact failure mode (pane armed after first warning, while creds stayed broken) and the existing 'warn each pane once' and 're-warn on recovery' contracts still hold. Reset loop and arm-time initialization are both in the right place; nothing else to flag.

@aterrylu
aterrylu merged commit e0dc6ba into main Jun 20, 2026
9 checks passed
@aterrylu
aterrylu deleted the terry/usage-queue-authwarn-perpane branch June 20, 2026 20:18
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.

2 participants