Skip to content

Lifecycle: a panicking worker is a failed worker - #50

Merged
floatdrop merged 1 commit into
mainfrom
worker-panic
Sep 12, 2026
Merged

Lifecycle: a panicking worker is a failed worker#50
floatdrop merged 1 commit into
mainfrom
worker-panic

Conversation

@floatdrop

Copy link
Copy Markdown
Owner

The Go worker was the one user function not called through callHook (lifecycle.go, the worker goroutine), so a panic in it escaped the goroutine and took the process down with no OnStop run and no event emitted, where a panicking OnStart, OnDrain or OnStop becomes that hook's error. CLAUDE.md's invariant says every hook goes through the wrapper; this one did not.

It now goes through callHook like the rest. The panic is the worker's error and takes the existing path: wrapped once, handed to Shutdown, reported by Stop, returned by Run, with OnStop run and the stop event carrying the failure.

TestPanickingWorkerIsAFailure in worker_test.go checks all four. It passes here and, run against a clone of c44198f, crashes with panic: consumer exploded.

Behaviour change, no signature change: a CHANGELOG entry under Unreleased as Fixed, and the CLAUDE.md invariant now names the worker. Full gate passes (gofmt, vet, race suite, golangci-lint, embedmd). Intended for 0.16.1.

🤖 Generated with Claude Code

The Go worker was the one user function not called through callHook, so a
panic in it escaped its goroutine and took the process down with no OnStop
run and no event emitted, where a panicking hook became that hook's error.
It now goes through callHook like the rest: the panic is the worker's
error, Shutdown receives it, Run returns it, OnStop runs and the stop event
carries it. TestPanickingWorkerIsAFailure pins it and crashes against
c44198f with "panic: consumer exploded".

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@floatdrop
floatdrop merged commit 5376ddc into main Sep 12, 2026
4 checks passed
@floatdrop
floatdrop deleted the worker-panic branch September 12, 2026 12:39
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