fix(cron): treat non-budget session error as cron failure#19
Merged
Conversation
Pre-fix, a spawn-fail (or any non-budget engine error) left the session manager catching the reject and setting session.status="error", but route() still resolved with a sessionId -- so the runner took the success path and logged status:"success". This hid a ~2.8-day outage where every claude-engine cron silently failed (binary path went stale after the native-installer migration) yet run-logs showed clean successes. - runner.ts: after route() resolves, if finalSession?.status === "error" and it is not a budget stop, log status:"error" + fire opsAlert - runner.test.ts: 2 regression tests + default getSession mock This is the signal source the t1a-health-check heartbeat depends on. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EcjhZ9Nj1KmHyBBRMzBJ93
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
A
claude-engine cron outage went silent for ~2.8 days (Jun 26→29). The native-installer migration relocated theclaudebinary out of the pinned nvm path, ENOENT'ing every spawn — yet run-logs showed cleanstatus:"success".Root cause of the invisibility: on a spawn-fail (or any non-budget engine error) the session manager catches the reject and sets
session.status="error", butroute()still resolves with a sessionId, so the runner took the success path.What
runner.ts: afterroute()resolves, iffinalSession?.status === "error"and it is not a budget stop → logstatus:"error"+ fireopsAlert.runner.test.ts: 2 regression tests + a defaultgetSessionmock.Pairing
This is the signal source the
t1a-health-check.shcron heartbeat depends on (~/.jinn, committed separately). The heartbeat alerts on 0 successful cron runs in 8h — it only works because spawn-fails now recorderrornotsuccess. Reverting this blinds the heartbeat.Verification
pnpm buildclean; full suite 792/792 pass; gateway restarted on the builtdistand confirmed claude spawns from~/.local/bin/claude.🤖 Generated with Claude Code