Skip to content

Added the channel machines and notification delivery to the external Core. - #13

Closed
moetemp wants to merge 3 commits into
moe/AI-198-ch-ext-core-1-protosfrom
moe/AI-198-ch-ext-core-2-machines
Closed

moetemp wants to merge 3 commits into
moe/AI-198-ch-ext-core-1-protosfrom
moe/AI-198-ch-ext-core-2-machines

Conversation

@moetemp

@moetemp moetemp commented Oct 3, 2026

Copy link
Copy Markdown
Owner

This PR lets a workflow on Max's external-stream Core subscribe to notification channels and hands it the notifications the server folds for each Workflow Task.

What changed?

  • SubscribeNotificationChannel and UnsubscribeNotificationChannel are bridge commands 29 and 30, each with its own state machine. Max's external commands keep 23 to 28. On replay each machine holds the reissued command to its recorded event, channel included.
  • The machine files are the main lineage's, byte for byte. Their unit tests from the earlier external PR live in sibling test modules, so the two lineages share one copy of each machine.
  • Core reads the notifications on a Workflow Task's scheduled event and hands them to lang as one NotificationsReceived job, sorted with signals and updates.
  • A failed task's notifications reach lang with the retry's, folded to one per channel by fold_notification. A higher counter wins. On a tie the held one stays.
  • scheduled_with_notifications keeps a notified task out of the heartbeat chain, so replay gives it its own activation, as the live run had.
  • Both machines are registered with the coverage report, and the test history builder can write the scheduled event with notifications and the two channel events.

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

Why?

The notifications live in History, so replay yields the same job at the same point. The server clears what it put on a scheduled event, so Core has to carry a failed task's notifications into the retry or lang loses them. The names match the main lineage so the unified Core has one vocabulary. One difference stays on purpose: the job is sent from flush_pending_notifications rather than inline, because the external runtime's wake hooks in there later. This PR doesn't resume parked external waits yet. That's the wake PR's job.

How did you test it?

Link to a test plan if any -

  • Unit Tests
  • Staging
  • End to End Tests

The machine tests cover the matching event, a wrong channel, a wrong event type, the command on the completion and the replay cases. The external stream suite covers the retry fold, live and on replay, and a replayed notified task keeping its own activation. The whole Core lib suite passes, including the coverage reporter. The lints and fmt are clean, and every commit builds.

Lang issues the two commands, and each one's machine matches the recorded
event by channel so replay catches a changed subscription. The machine files
are the main lineage's, and their unit tests sit in sibling modules.
The server folds a channel's notifications onto a Workflow Task's scheduled
event. Core turns them into one job per task, folded per channel, carries a
failed task's notifications into the retry, and keeps a notified task out of
the heartbeat chain so replay hands them over in the same activation.
The reporter panics on any machine it has no visualizer for. This also
restores the external stream machine's entry, which the machines commit
dropped.
@moetemp

moetemp commented Oct 5, 2026

Copy link
Copy Markdown
Owner Author

Replaced by #26 and #28 in the v4 series: one lineage through the channel and the interface, with Max's Option 7 prototype replayed onto it. The branch stays as a pin.

@moetemp moetemp closed this Oct 5, 2026
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