Skip to content

fix: ignore restartable sidecar exit codes in k8s failure detection - #118

Merged
captainsafia merged 1 commit into
mainfrom
safia/ignore-sidecar-exit-codes
Aug 4, 2026
Merged

fix: ignore restartable sidecar exit codes in k8s failure detection#118
captainsafia merged 1 commit into
mainfrom
safia/ignore-sidecar-exit-codes

Conversation

@captainsafia

@captainsafia captainsafia commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

User was reporting that that they were getting the following errors in their Oz agent task runs based on the exit status of their sidecars:

│ 04:11:02.000 INF Leaving failed Kubernetes Job oz-task-019fa68f-bcd1-7a54-bf86-a9d37cc37ce9-exec-3977090 in place for TTL-based cleanup                                                                                                            │
│ 04:11:02.000 ERR Task execution failed: taskID=019fa68f-bcd1-7a54-bf86-a9d37cc37ce9, error=init container zookeeper in pod oz-task-019fa68f-bcd1-7a54-bf86-a9d37cc37ce9-exec-3977090-qpm95 (namespace oz-agents, job oz-task-019fa68f-bcd1-7a54-bf │

The Kubernetes guidance (ref) states the following:

From a Kubernetes perspective, the sidecar container's graceful termination is less important. When other containers take all allotted graceful termination time, the sidecar containers will receive the SIGTERM signal, followed by the SIGKILL signal, before they have time to terminate gracefully. So exit codes different from 0 (0 indicates successful exit), for sidecar containers are normal on Pod termination and should be generally ignored by the external tooling.

With that in mind, I think it makes us for us to ignore non-zero exit codes for sidecar containers (init containers with restartPolicy: always) in our handling.

REMOTE-2365: https://linear.app/warpdotdev/issue/REMOTE-2365/self-hosted-k8s-worker-falsely-reports-task-failure-when-native

Init containers declared with restartPolicy: Always are native sidecar
containers: the kubelet SIGTERMs them during pod wind-down after the
main task container finishes, and Kubernetes excludes their exit codes
from pod and Job outcome. Treating their non-zero terminations (e.g.
JVM services exiting 143 on SIGTERM) as fatal caused successful tasks
to be reported as failed and misattributed genuine task failures to
collateral sidecar exits.

Co-Authored-By: Oz <oz-agent@warp.dev>

@ianhodge ianhodge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the delay on this review!

captainsafia commented Aug 4, 2026

Copy link
Copy Markdown
Contributor Author

Merge activity

  • Aug 4, 3:14 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Aug 4, 3:14 PM UTC: @captainsafia merged this pull request with Graphite.

@captainsafia
captainsafia merged commit 3382ab6 into main Aug 4, 2026
7 checks passed
@captainsafia
captainsafia deleted the safia/ignore-sidecar-exit-codes branch August 4, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants