Repository navigation
feat(cognition): dispatch_listener — fold background-command completions into the mind by handle - #1903
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The consumer that closes the loop between dispatch_background (#67, producer) and the WM async recency channel
(#66, sink).
fold_completion(wm, event)takes acommand:completedevent 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