Repository navigation
Conversation
📝 WalkthroughWalkthroughModified lifecycle reconciliation logic so JSON payload parsing failures return undefined instead of an empty object, causing heartbeat messages with invalid JSON to be ignored. Updated worker_done reconciliation to recover missing taskId/dispatchId values from a terminal's active dispatch context when not present in the payload, validating against conflicts before proceeding with completion logic. Corresponding tests in coordinator and orchestration RPC methods were updated: a test helper now supports optional taskId and explicit payload overrides, new edge-case tests were added for worker_done handling, and an existing RPC test assertion was changed to expect task/dispatch completion rather than no change. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Taking a look! |
cec625e to
4e85e2a
Compare
|
Thanks for the fix! I rebased this onto current |
|
Current |
Summary
worker_donerecover missingtaskIdordispatchIdfrom the sender's active dispatch, then complete through the existing lifecycle checks.updateTaskStatus(taskId, 'completed', result)so task and dispatch state still move through the DB-owned transition path.Closes #7429.
Screenshots
No visual change
Testing
pnpm lintpnpm typecheckpnpm testpnpm buildFocused validation:
pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/orchestration/coordinator.test.ts- passed; covers null-idworker_donecompletion, missing-active-dispatch rejection, conflict rejection, stale retry preservation, non-owner rejection, and already-completed idempotence.pnpm exec vitest run --config config/vitest.config.ts src/main/runtime/rpc/methods/orchestration.test.ts -t "completes worker_done missing taskId or dispatchId|does not complete worker_done from a terminal that does not own the dispatch|does not complete worker_done for a stale inactive dispatch"- passed; covers the RPCorchestration.checkconsumer of lifecycle reconciliation.pnpm run typecheck:node- passed.AI Review Report
Security Audit
db.getActiveDispatchForTerminal(msg.from_handle), which scopes recovery to the sender's active dispatch.taskIdordispatchIdvalues are rejected before any completion state transition.Notes
ELI5
A worker finishing without a task/dispatch id could leave orchestration stuck. Missing ids are recovered from the active dispatch so the task completes normally.