Files
Peter Wielander 746de8b997 [e2e] Add a cycle-hook scenario to the event-log race repro
`wake-loop` creates its hooks once, at the top, before any wait exists, so it
commits one `hook_created` and never another. That leaves a state it can never
reach: a hook write landing while a wait is already open.

Two production runs died there. `githubUserMonitor` on core 5.0.0-beta.48 mints
a fresh hook inside every cycle, races it against a heartbeat sleep, and
disposes it only when the sleep wins — so after any cycle the hook won, the next
cycle's `hook_created` commits with that cycle's abandoned sleep still counting
down. An open wait is exactly what decides whether the runtime settles a hook's
awaiter from the suspension's own writes or re-reads the log first.

`cycle-hook` is that loop. Its 55-cycle production original is reproduced event
for event in the ledger the scenario asserts on: 56 `hook_created`, 54
`hook_disposed`, 55 `wait_created`, 54 `wait_completed`, 18 `hook_received`, and
one wait still open at the end.

The driver walks the cycle index rather than holding one hook, resuming each
cycle's own token, and aims a configurable share of those resumes at the
heartbeat deadline so a `hook_received` commits next to a `wait_completed`. The
rest are left to the sleep, since a hook win is what sets up the next cycle's
open-wait create; `pressure.cycleHook.createsUnderOpenWait` reports how often the
run actually reached that state, so a clean result can be told apart from a run
that never got there.

Validated against world-local: three runs, all completed, each reporting
`createsUnderOpenWait: 3` across a mix of both branches. That says the shape
drives the intended interleaving, not that it reproduces the corruption — the
production failures were on world-vercel, and world-local at three runs
resolves nothing about a rate.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 10:57:38 -07:00
..
2025-10-23 12:07:52 +03:00

Workbench

These apps are used for testing internally. Refer to Workflow SDK Examples to see some use cases and working examples.