Skip to content

fix(runtime): tighten shutdown and failure events#23

Merged
jaredjakacky merged 1 commit into
mainfrom
fix/lifecycle-shutdown-observability
May 19, 2026
Merged

fix(runtime): tighten shutdown and failure events#23
jaredjakacky merged 1 commit into
mainfrom
fix/lifecycle-shutdown-observability

Conversation

@jaredjakacky
Copy link
Copy Markdown
Owner

Summary

Tightens two v1 lifecycle semantics in the runtime.

  • Stops Runtime.Shutdown before StopAll when the caller context has already expired
  • Prevents shutdown timeout from marking otherwise healthy workers failed
  • Keeps servekitservice fallback cleanup working with a fresh stop context
  • Suppresses duplicate non-command FailureEvents when a worker is already failed
  • Preserves per-attempt command failure event behavior

Why

Runtime.Shutdown previously used one context across drain, idle wait, and stop. If the context expired during drain or idle wait, shutdown could still call StopAll with an already-expired context. Context-aware workers could then return DeadlineExceeded, causing Workerkit to mark them failed during shutdown.

Separately, if WorkerRuntime.ReportFailure was called during Start and Worker.Start later returned an error, Workerkit could emit two lifecycle failure events for one startup failure path.

Both behaviors make lifecycle and observability semantics noisier than they should be for v1.

Verification

  • make test
  • make test-race

@jaredjakacky jaredjakacky merged commit 25437d9 into main May 19, 2026
7 checks passed
@jaredjakacky jaredjakacky deleted the fix/lifecycle-shutdown-observability branch May 19, 2026 17:33
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