Skip to content

go executor: restart KeepAlive tasks on clean exit#12

Merged
ChenJesse merged 1 commit into
mainfrom
jesse/keepalive-restart-on-clean-exit
May 6, 2026
Merged

go executor: restart KeepAlive tasks on clean exit#12
ChenJesse merged 1 commit into
mainfrom
jesse/keepalive-restart-on-clean-exit

Conversation

@ChenJesse
Copy link
Copy Markdown
Contributor

@ChenJesse ChenJesse commented May 5, 2026

Summary

  • A KeepAlive task that exits with no error and no context cancellation (e.g. an fx service that catches SIGTERM and shuts down gracefully with exit code 0) was previously treated as "done" and never restarted
  • This treats a clean exit of a KeepAlive task as an error so the existing KeepAlive restart path kicks in
  • The KeepAlive field's doc comment says "this task will be restarted when it exits, regardless of exit code" — this change makes the implementation match that intent

Context

Local dev eventsworker (and other fx-based services) occasionally receive external signals, fx catches them and exits cleanly (code 0), and taskrunner doesn't restart because KeepAlive only checked for taskExecutionState_error, not taskExecutionState_done.

Test plan

  • go test ./... passes
  • Run taskrunner locally, kill a KeepAlive service with kill <pid>, verify it restarts

🤖 Generated with Claude Code


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

A KeepAlive task that exits with no error and no context cancellation
(e.g. an fx service that catches SIGTERM and shuts down gracefully)
was treated as "done" and never restarted. This treats it as an error
so the existing KeepAlive restart path kicks in.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ChenJesse ChenJesse merged commit 5d2f5b9 into main May 6, 2026
1 check passed
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.

1 participant