fix(omo-senpi): never let the wake-queue count cost a delivery receipt (#10782)

CO
3h ago
+238-1

Part of code-yeongyu/oh-my-openagent#10782. Stacked on #11115 (frozen at e5c8b55fb4, batch #8): review only the top commit a3f874a80e. Lead ruling: #11115's two review LOWs ship as one car in the SAME batch, because a lost completion is too costly to ship knowingly.

What changed

  • Receipts before the report (idle-injection-coordinator.ts): the coordinator reported the child work count before firing onFlushed / onDeliveryFailed. A stale generation's event bus throws, so a failing publish could skip the receipt that senpi-task's completion redelivery depends on. Receipts now fire first on every path (sync success, sync throw, async resolve, async reject).
  • The publish never throws (wake-queue-source.ts): publishWakeQueueChildWork catches a throwing event bus and logs it through the component logger.
  • A baseline per generation (wake-queue-source.ts, compose.ts): senpi keeps wake-source counts across a reload, so each session generation publishes its count at session_start (childWorkCount() on the coordinator); a count the previous generation could no longer clear does not outlive it.

Bundle car: source and tests only.

Tests

  • idle-injection-child-work.test.ts: receipt-before-report on sync delivery and on an async rejection (both fail on #11115's coordinator: 2 fail / 9 pass; 11/11 with the change), a throwing bus is logged not thrown, and session_start publishes the baseline.
  • src/extension + src/components/task: 1010 pass, 0 fail. tsgo --noEmit -p packages/omo-senpi/tsconfig.json: clean. Coordinator 177 pure LOC.

Live QA (senpi-qa)

The task-rpc-e2e scenario A (real senpi, plugin built from this branch, a background process child whose completion lands while the parent is alive, a probe on wake_source_state): omo-wake-queue went 0 (the session_start baseline), 1, 0, all kind: "children"; the completion was delivered; senpi exit 0; real ~/.senpi untouched. Evidence: .omo/evidence/omo-senpi-adapter/20261024-wake-queue-receipts/, sha256:

  • checks.json 462dd3024e2681c931b1c437e1765472a40f93e5976563564ee6d7a1b6acc8ca
  • wake-source-events.json 8752fcb6f2079868813cea347475c272301f242c938ce6ef0a519d7bf8d1c7a4
  • run.log 680d2772e91c807d3779e691d17af5e581c05fb3360daf651cb7563a2ed9ad88
  • red/green logs 9f6c4834ca0a7b1a387cabf52a14f3807b923a404239e18818fd43b5fdf333b0 / 4f84ee436fd398f69e229c90667cdb64a90a171a61bb420a958b84623e8d890d

Summary by cubic

Prevents the omo-senpi wake-queue child-work count from ever costing a delivery receipt. The coordinator now fires onFlushed/onDeliveryFailed before reporting the count, a throwing event bus is logged instead of thrown, and each session generation publishes its count as a baseline at session_start so a stale count cannot outlive a reload.