fix: handle K8s 404 (job deleted) gracefully in waitForJobCompletion (FAR-122) #5
Reference in New Issue
Block a user
Delete Branch "fix/far-122-404-job-not-found"
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?
Summary
waitForJobCompletionhad no 404 handling. When a K8s Job is deleted (TTL garbage collection after completion, or external deletion) while the adapter is polling,@kubernetes/client-nodev1.0+ throwsHTTP-Code: 404 Message: Unknown API Status Code!which propagated uncaught — especially from the re-check path at the bottom of theelsebranch — surfacing as an opaque error to the user.err.response?.statusCodewhich is absent in the v1.0+ fetch-based client (that client usesresponse.status, notstatusCode), silently breaking 404 detection.isK8s404()helper compatible with both v0.x and v1.0+ error shapes;waitForJobCompletionnow catches 404 and returns{ jobGone: true }instead of throwing; completion handler logs a diagnostic and falls through to stdout parsing rather than crashing.Test plan
npm run typecheck)npm test)jobGonewarning and returns the parsed Claude output rather than a 404 error🤖 Generated with Claude Code