healer/reporter: the Claude auth-failure detector matches the model's own PROSE — a diagnosis quoting "not logged in" discarded a finished heal, flipped the account and paged a false auth failure #1682
Labels
No labels
agent-blocked
agent-working
autopilot
bug
deferred
deploy-pending
enhancement
landing-pr
model-haiku
model-opus
model-sonnet
needs-design
needs-info
needs-triage
no-triage
out-of-scope
priority
ready-for-agent
ready-for-human
ready-for-session
rehearsal-183
snapshot-pending
standing-drive
wayfinder:grilling
wayfinder:map
wayfinder:prototype
wayfinder:research
wayfinder:task
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Matou/idss#1682
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What happened (#1672 fire 1,
20260921T023204Z)The healer ran TWICE for real — 18 min on account A, then 13 min on account B — and the second run returned a complete
{"action":"healed","commit":"3b227968",…}verdict. Both runs were then classified as Claude auth refusals: the heal was reset away, the active-account marker flipped A→B for nothing, and Ben was paged "CLAUDE AUTH FAILED on account B — not logged in". Both tokens are fine (the reporter used them minutes later and filed #1678/#1679).Cause
claude_auth_failed(.sandcastle/limit-lib.sh) greps the WHOLE of<who>-claude.out— the model's own prose — forCLAUDE_AUTH_RE(failed to authenticate|oauth session expired|not logged in|invalid api key|authentication_error). The healer's diagnosis quoted a Nextcloud 401 body it had read off the box:not logged inmatched. Any diagnosis of a SIGN-IN failure is likely to contain one of these phrases, and sign-in is most of what the drives prove right now — so this will recur.Ask
Make the auth classifier read the CLI's refusal, not the model's prose. Options: anchor the phrases to the start of a line / the CLI's exact shapes ("Not logged in · Please run /login", "Failed to authenticate: …",
API Error: 401 …authentication_error); or never classify an output that carries a parseable verdict as an auth refusal; or only consult stderr + a short stdout. Keeppreflight-swarm'sauth_detectionself-test and scenario 31 ofrehearsal-report-test.shgreen, add a fixture with the exact prose above that must NOT classify, and carry the same change to dev-factory's copy oflimit-lib.sh(the two copies share one host-global marker and must agree).Same classifier guards
run-swarm.sh's worker log, where a worker's prose can trip it the same way.Related, already fixed (
bdb42ff6): the alert this false positive fired printed the full token.rehearsal-report.shdrifted - bdb42ff6’s token-leak fix must land in dev-factory (which still leaks) and ride back on a FACTORY_REF bump #1683rehearsal-report.shdrifted - bdb42ff6’s token-leak fix must land in dev-factory (which still leaks) and ride back on a FACTORY_REF bump #1683Cross-ref from #1683: the token-leak fix landed in dev-factory (issue #159, PR #160 into main), and idss re-vendored
FACTORY_REFto a commit off its own pin base (142a3c10) — no full-main upgrade taken. Your #1682 clause about the same change to dev-factorylimit-lib.shis NOT included in that commit; it should ride the watched full-mainFACTORY_REFbump split off as #1684, which is the moment idss next re-vendors from dev-factory main.Triage →
ready-for-session(bug)Verified against the tree (HEAD
c4f65280): the bug reproduces exactly as described.claude_auth_failed()at.sandcastle/limit-lib.sh:172-173: itgrep -qiE "$CLAUDE_AUTH_RE"over the whole of each file, andCLAUDE_AUTH_RE(:170) isfailed to authenticate|oauth session expired|not logged in|invalid api key|authentication_error. A healer diagnosis that quotes a Nextcloud401 {"message":"Current user is not logged in"}matches onnot logged in— model prose, not a CLI refusal. Confirmed unfixed on the idss side.preflight-swarmself-testguard_auth_detection()(.sandcastle/preflight-swarm.sh:75) and by scenario 31 of.sandcastle/tests/rehearsal-report-test.sh:645(the #632 dead-token case). Both must stay green.Why
ready-for-session, notready-for-agentEvery file this fix touches (
.sandcastle/limit-lib.sh,.sandcastle/tests/rehearsal-report-test.sh,.sandcastle/preflight-swarm.sh) is inside the fingerprinted protected tree (.sandcastle, per.sandcastle/protected-paths-lib.sh/ #445). A swarm worker that edited it would be rolled back and fail loud; the machinery's own escape path routes such changesready-for-session(ADR 0174). No swarm work is available here — an interactive session owns it. Not Ben: the change is a revertible classifier tightening, provable by existing tests plus the new fixture below, and touches no one-way door (it narrows a false-positive, widens no posture, no credentials, no trust surface, no spend, no data loss).Agent brief (for the session)
Goal: the auth classifier must fire on the CLI's own refusal, never on the model's prose.
Change (
.sandcastle/limit-lib.sh) — pick the tightest of the ticket's options that keeps both self-tests green:Not logged in · Please run /login,Failed to authenticate: …,API Error: 401 …authentication_error), and/or{"action":…}) as an auth refusal, and/orAcceptance criteria:
guard_auth_detection()stays green — a realNot logged in · Please run /loginrefusal still classifies (the #632 positive), a usage-limit log still does not, a normal worker log still does not.rehearsal-report-test.shstays green./settings/admin` → HTTP 401 {"message":"Current user is not logged in"}— that must NOT classify as an auth refusal. Add it to theguard_auth_detectionnegative set (and/or a rehearsal-report scenario), asserting a diagnosis quoting a 401 body survives as a real verdict.run-swarm.sh's worker-log path is covered by the same fixture shape (a worker's prose quoting these phrases must not halt the swarm).Explicitly out of scope for this ticket: the dev-factory copy of
limit-lib.sh. Per #1683's cross-ref (comment above), idss re-vendoredFACTORY_REFto142a3c10off its pin base with no full-main upgrade; the dev-factory-side change rides the watched full-mainFACTORY_REFbump split off as #1684. Land the idss-side fix here; #1684 carries the twin so the two host-global-marker copies re-converge on the next full-main re-vendor.Closed — landed and proven. Ruled by agent under ADR 0174 — veto anytime.
Root cause
claude_auth_failed(.sandcastle/limit-lib.sh) grepped the WHOLE of<who>-claude.out— the model's own diagnosis prose — forCLAUDE_AUTH_RE. Fire 1 (20260921T023204Z) diagnosed a sign-in fault by quoting a Nextcloud 401 body —`/settings/admin` → HTTP 401 {"message":"Current user is not logged in"}— andnot logged inmatched inside that quote, so a finished heal ({"action":"healed","commit":"3b227968",…}) was reset away, the active-account marker flipped A→B for nothing, and the false "CLAUDE AUTH FAILED" alert paged Ben. Sign-in is most of what the drives prove, so any sign-in diagnosis was likely to recur this.Fix (the classifier reads the CLI's refusal, not the model's prose)
A new
CLAUDE_AUTH_LINE_REanchors the auth phrases to the start of a line (^[[:space:]]*…) — the CLI prints its refusal as its own line / the whole output, so a phrase quoted mid-line (a JSON body, a markdown bullet, a sentence) is inert.authentication_errorstays matchable only inside the CLI's ownAPI Error: <code> …authentication_errorframing.CLAUDE_AUTH_RE(the phrase list a caller lifts to NAME the refusal in its notice) is unchanged, so every extraction site (_execute_auth_line,claude_auth_announce, run-swarm's worker guard) is untouched.This is the ONE shared classifier, so it fixes run-swarm.sh's worker log and execute-lib's classify at the same root as the healer/reporter — no per-caller patch needed. (Considered and not taken: also gating the healer/reporter auth branch on "carries a parseable verdict"; anchoring at the shared root is general and sufficient, and the reported prose is always mid-line inside JSON, so the extra mechanism would add control-flow to a vendored file for no additional coverage.)
Proof (red-before-green, all offline)
tests/limit-lib-test.sh+1 group: the exact fire-1 401 prose, a{"action":"healed",…}verdict quoting the phrase, a markdown-bullet mention and a mid-sentenceauthentication_errormust NOT classify; the CLI'sAPI Error: 401 …authentication_errorline still MUST. Reintroducing the whole-file grep → the 401-prose case FAILs.preflight-swarm.shguard_auth_detection+1 runtime negative (the exact 401 prose) — the self-test now guards the live classifier against this false positive.tests/preflight-swarm-test.sh's auth-injection scenario retargeted toCLAUDE_AUTH_LINE_RE(the pattern the classifier now reads) so it still turnsauth_detectionRED.check-harness-drift.shOK @834ec68.The two copies now agree
limit-lib.shis vendored (drift-gated), so the fix landed in dev-factory first and idss re-vendored byte-identically — branched off idss's own pin base142a3c10so the unadopted ~16-commit harness rework (#1684) is not dragged in.Commits
4dd2befc— re-vendorFACTORY_REF 142a3c10 → 834ec68+STATUS.md.1cfa5c0(PR #161) — the classifier + limit-lib/preflight tests;834ec68(PR #163) — the preflight-injection retarget. Both merged to dev-factorymain.Related, already fixed (
bdb42ff6/#1683): the alert this false positive fired printed the full token.