Skip to content

Made notification channels wake the external stream runtime. - #18

Open
moedash wants to merge 3 commits into
moe/AI-198-if-ext-core-5-zero-cache-retentionfrom
moe/AI-198-if-ext-core-6-channel-wake
Open

moedash wants to merge 3 commits into
moe/AI-198-if-ext-core-5-zero-cache-retentionfrom
moe/AI-198-if-ext-core-6-channel-wake

Conversation

@moedash

@moedash moedash commented Oct 3, 2026

Copy link
Copy Markdown
Owner

This PR makes the notification channel the external stream runtime's wake.

What changed?

  • Channel notifications on a task's scheduled event resume the run's parked external waits, as an unparked wake does. They come from History, so replay resumes the same waits.
  • Lang reports the full set of channels its open readers listen on with WorkflowStreamChannels, bridge command 33. It's local to Core and never reaches the server. A report with an empty name, a repeated name or a second report in one completion fails the task.
  • ChannelSubscriptions tracks the reported set against the subscribed one. On the completion that ends the task, Core unsubscribes the channels that left the set, then subscribes the new ones, after the progress marker. A run-ending completion issues neither.
  • Replay reissues both commands from the same report, so a report that names a different channel is nondeterminism.

Part of AI-198 (epic AI-37).

Why?

A parked external run needs something to wake it when a provider writes. A notification rides the scheduled event of the task it produces, so the run wakes without a Signal event in its History. Subscribing from the activation that opened the reader would end a task that's meant to stay retained, so the commands wait for the completion that ends it. Unsubscribing first lets a run that rotates channels free its slot before taking a new one.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

ChannelSubscriptions has its own unit tests. The external stream suite covers a parked wait resumed live and after replay, subscriptions held until a park or finalization ends the task, ordering after the marker, nothing on a run-ending completion or for a channel already held, a swap that unsubscribes first, both replay paths and a malformed report. The whole Core lib suite passes, including the coverage reporter. The lints and fmt are clean, and every commit builds.

A notification on the scheduled event is how the server wakes a parked run
that listens on a channel, so the waits resume as for an unparked wake. The
notifications come from History, so replay resumes the same waits.
Lang reports the full set of channels its open readers listen on, and Core
turns the change into unsubscribe and subscribe commands on the completion
that ends the task, after the progress marker. A run-ending completion
issues none, since the subscription ends with the run.
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