mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-04 12:07:28 +01:00
fix(runner): a 401'd dispatch is an honest failure, not a verified success
Dogfooding a real dispatch (2026-07-10) exposed that a dead-credentials agent was reported as SUCCESS at every layer: the agent replied "Please run /login · 401", yet the runner acked ok/verified and the UI said "Dispatched — starting shortly." Root cause: a 401 still emits output, which flips the agent off "idle", so waitForAgentGenerating false-positives (verified=true) and the existing detectAuthFailure check — gated behind `if (!verified)` — never runs. Re-check detectAuthFailure UNCONDITIONALLY after verify in the PTY dispatch path: on a fresh 401/login signature, force ok=false + an actionable error naming the fix (remove stale ~/.claude/.credentials.json; set CLAUDE_CODE_OAUTH_TOKEN). The dispatch now surfaces as a real failure in Control's AttentionBar instead of a cheerful "starting shortly". (Zellij fallback path has the same latent issue via waitForSessionFileBump — follow-up.) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016g8LdPdzoEbVwQ1SdYW5RY
This commit is contained in:
1 parent
72b654e7c3
commit
dade32b16b
1 file changed
+15
@@ -627,6 +627,21 @@ async function handleCommand(
|
||||
? `${text}, but the agent reports dead credentials (401/login required) — run 'claude setup-token' on the runner host`
|
||||
: `${text}, but the agent isn't generating yet — it may still be booting or already idle`
|
||||
}
|
||||
// Auth failure is a HARD failure even when verify passed. A 401
|
||||
// emits the "/login" error, which flips the agent off "idle" and
|
||||
// false-positives waitForAgentGenerating — so a dispatch that never
|
||||
// ran gets acked ok/verified and the UI cheerfully says "starting
|
||||
// shortly" (dogfood 2026-07-10: three dispatches 401'd while every
|
||||
// layer reported success). Re-check the fresh transcript here and
|
||||
// turn a dead-credentials dispatch into an honest, actionable fail.
|
||||
if (detectAuthFailure(dir)) {
|
||||
ok = false
|
||||
verified = false
|
||||
warning = undefined
|
||||
error =
|
||||
`${agent} is not authenticated (401 / login required) — the prompt was delivered but the agent can't run. ` +
|
||||
`On the runner host, remove any stale ~/.claude/.credentials.json and set CLAUDE_CODE_OAUTH_TOKEN (claude setup-token).`
|
||||
}
|
||||
break
|
||||
}
|
||||
// PTY launch failed → fall through to the zellij path below.
|
||||
|
||||
Reference in new issue
Block a user