fix: handle K8s 404 (job deleted) gracefully in waitForJobCompletion (FAR-122) #5

Merged
farhoodliquor-paperclip[bot] merged 1 commits from fix/far-122-404-job-not-found into master 2026-04-22 17:08:03 +00:00

1 Commits

Author SHA1 Message Date
Test User 2a31fe1f9b fix: handle K8s 404 (job deleted) gracefully in waitForJobCompletion (FAR-122)
- Add `isK8s404()` helper compatible with @kubernetes/client-node v0.x and v1.0+
  (checks response.statusCode, response.status, err.statusCode, and message text)
- `waitForJobCompletion` now catches 404 and returns `{ jobGone: true }` instead
  of throwing — prevents uncaught exceptions when the K8s Job is TTL-deleted or
  externally removed while the adapter is polling for a terminal condition
- Keepalive job-liveness check now uses `isK8s404` (was checking `response.statusCode`
  which is absent in the v1.0+ fetch-based client, silently breaking 404 detection)
- `jobGone` case in completion handler logs a diagnostic and falls through to stdout
  parsing rather than returning an opaque 404 error to the user

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-04-22 16:42:07 +00:00