Skip to content

feat(cognition): dispatch_listener — fold background-command completions into the mind by handle - #1903

Merged
joelteply merged 1 commit into
canaryfrom
feat/dispatch-listener-consumer
Jul 7, 2026
Merged

joelteply merged 1 commit into
canaryfrom
feat/dispatch-listener-consumer

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

The consumer that closes the loop between dispatch_background (#67, producer) and the WM async recency channel
(#66, sink). fold_completion(wm, event) takes a command:completed event and, IF the persona owns its handle
(registered in the WM's dispatched map at dispatch time), records the result via record_dispatch_event —
Done+result on success, Failed+error otherwise. Other clients' completions and this persona's synchronous
commands (no handle) are ignored, so a persona only ever hears back about the sentinels/compiles/debuggers IT
sent away. spawn(bus, wm) runs it on the core bus (CommandExecutor::message_bus()), lag/close-safe.

Pure reuse of the pattern already under every command: emit on a handle, subscribe, fold it in. Adds
WorkingMemory::dispatched_label (handle → owned label, the ownership filter). Result folded back is bounded
(4k) so one huge log can't dominate perception.

Tested deterministically (no live bus): a persona's own handle folds Running→Done+result and Running→Failed+
error; a handle it never dispatched and a sync (no-handle) completion are both ignored.

All three pieces of the async handle/event channel are now built + green: #66 sink, #67 producer, this consumer.
The final attachment — spawn() in the persona runtime + the executor auto-backgrounding long_running commands —
is the live wiring, which I'll verify against the personas before calling it done.

Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo

…ons into the mind by handle

The consumer that closes the loop between dispatch_background (#67, producer) and the WM async recency channel
(#66, sink). `fold_completion(wm, event)` takes a `command:completed` event and, IF the persona owns its handle
(registered in the WM's dispatched map at dispatch time), records the result via `record_dispatch_event` —
Done+result on success, Failed+error otherwise. Other clients' completions and this persona's synchronous
commands (no handle) are ignored, so a persona only ever hears back about the sentinels/compiles/debuggers IT
sent away. `spawn(bus, wm)` runs it on the core bus (`CommandExecutor::message_bus()`), lag/close-safe.

Pure reuse of the pattern already under every command: emit on a handle, subscribe, fold it in. Adds
`WorkingMemory::dispatched_label` (handle → owned label, the ownership filter). Result folded back is bounded
(4k) so one huge log can't dominate perception.

Tested deterministically (no live bus): a persona's own handle folds Running→Done+result and Running→Failed+
error; a handle it never dispatched and a sync (no-handle) completion are both ignored.

All three pieces of the async handle/event channel are now built + green: #66 sink, #67 producer, this consumer.
The final attachment — spawn() in the persona runtime + the executor auto-backgrounding long_running commands —
is the live wiring, which I'll verify against the personas before calling it done.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo
@joelteply
joelteply merged commit 5c3362b into canary Jul 7, 2026
1 check passed
@joelteply
joelteply deleted the feat/dispatch-listener-consumer branch July 7, 2026 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant