Skip to content

Fix #266: expose timed-out handlers in worker health - #309

Open
joei4cm wants to merge 1 commit into
CopilotKit:mainfrom
joei4cm:fix/266-orphaned-handler-health
Open

joei4cm wants to merge 1 commit into
CopilotKit:mainfrom
joei4cm:fix/266-orphaned-handler-health

Conversation

@joei4cm

@joei4cm joei4cm commented Dec 2, 2026

Copy link
Copy Markdown

Fixes #266

Summary

  • runWithTimeout now keeps handlers that outlive their timeout visible as orphaned work, keyed by claim token so a retried job does not overwrite the previous execution.
  • WorkerHealthStatus exposes maxConcurrency and orphanedHandlerCount; /health returns 503 once orphaned handlers reach the worker\x27s concurrency ceiling.
  • Timeouts now log the job id/type and state that the handler is still running after its slot was released.

Tests

  • Queue, worker-concurrency and worker health suites passed: queue 62 passed, worker-concurrency 24 passed, worker health 84 passed
  • Queue and worker tsc --noEmit, Prettier check, ESLint (0 errors), and git diff --check passed.

Notes

  • The orphan map is keyed by claim token, not job id: a timed-out job can be retried while its first handler is still running, and both executions stay visible.
  • A timed-out handler is counted as orphaned until it settles on its own, at which point it is dropped from the count.

🤖 Generated with Claude Code

Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

Keep a timed-out handler visible after runWithTimeout stops waiting for it

1 participant