Skip to content

Add InterruptedWatchdog scaffolding#148

Merged
stidsborg merged 5 commits into
mainfrom
interrupted-watchdog
May 17, 2026
Merged

Add InterruptedWatchdog scaffolding#148
stidsborg merged 5 commits into
mainfrom
interrupted-watchdog

Conversation

@stidsborg
Copy link
Copy Markdown
Owner

Summary

  • New InterruptedWatchdog that polls GetInterruptedFunctions and calls FlowsManager.Interrupt with the subset owned by this replica (present in FlowsManager's in-memory dict).
  • Adds FlowsManager.FilterOwned(ids) so the watchdog can scope to locally-running flows under the existing lock.
  • Wired into FunctionsRegistry ctor, started under EnableWatchdogs. Shutdown via existing ShutdownCoordinator.

Note on stubs

FlowState.Interrupt and FlowsManager.Interrupt's ResetInterrupted call are stubbed for now. The earlier implementations raced with SuspendFunction: when the watchdog cleared the persistent Interrupted flag mid-flight (after AppendMessage set it, before SuspendFunction read it), the flow transitioned to Suspended instead of Postponed and never restarted. Scaffolding is in place; semantics can be re-introduced once the suspend-design direction lands.

Test plan

  • In-memory test suite (451 tests) passes in ~20s with the new watchdog wired in

stidsborg added 5 commits May 16, 2026 15:05
The watchdog polls GetInterruptedFunctions and calls FlowsManager.Interrupt
with ids owned by this replica (i.e. present in FlowsManager's in-memory dict).

FlowState.Interrupt and FlowsManager.Interrupt are stubbed for now: the
existing implementations raced with SuspendFunction's Interrupted-flag check
(clearing the flag mid-flight caused suspended-vs-postponed-status to be
decided wrong, leaving flows stuck). Adds FilterOwned helper.
- Replace two redundant/misnamed GetInterruptedFunctions tests with
  distinct scenarios: idempotent multi-interrupt returns single id,
  and interrupting a Postponed function still surfaces it.
- Remove the obsolete argument from new FlowsManager(...) call sites
  in test files now that FlowsManager has no constructor parameter.
@stidsborg stidsborg merged commit 2053d22 into main May 17, 2026
8 checks passed
@stidsborg stidsborg deleted the interrupted-watchdog branch May 17, 2026 07:47
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