Repository navigation
feat(runtime): dispatch_background — fire-and-poll command dispatch with a first-class UUID handle - #1902
Merged
Conversation
…ith a first-class UUID handle The producer for the async recency channel (#66), built RIGHT at the universal command layer so ANY client benefits, not just personas. `CommandExecutor::dispatch_background(command, params, caller) -> Uuid` returns a handle immediately and runs the dispatch on a spawned task; the caller never blocks (the fire-and-poll shape, #86). On completion, the existing `command:completed` event carries the handle AND the result, so a subscriber matches the completion to its exact dispatch and folds the outcome in without a second call. `CommandCompletedEvent` gains `handle: Option<Uuid>` + `result: Option<Value>` — populated ONLY for tracked background dispatches; synchronous commands stay thin (both None, elided on the wire — the caller already holds the return value). The handle is a plain UUID precisely so it's reusable in a follow-up command (cancel/query/ attach) — handles + events, the pattern already under every command ([[commands-are-agency-algs-are-pathways]]). Tested: dispatch_background returns a handle and its completion event carries that handle + the result; a synchronous dispatch carries neither; the wire round-trip elides both when None. ts-rs binding regenerated (handle?: string, result?: unknown). This is the PRODUCER; the persona-side listener (subscribe command:completed → filter to this persona's handles → record_dispatch_event into working memory) is the final connecting slice — pure reuse of Connection::subscribe. 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 producer for the async recency channel (#66), built RIGHT at the universal command layer so ANY client
benefits, not just personas.
CommandExecutor::dispatch_background(command, params, caller) -> Uuidreturns ahandle immediately and runs the dispatch on a spawned task; the caller never blocks (the fire-and-poll shape,
#86). On completion, the existing
command:completedevent carries the handle AND the result, so a subscribermatches the completion to its exact dispatch and folds the outcome in without a second call.
CommandCompletedEventgainshandle: Option<Uuid>+result: Option<Value>— populated ONLY for trackedbackground dispatches; synchronous commands stay thin (both None, elided on the wire — the caller already holds
the return value). The handle is a plain UUID precisely so it's reusable in a follow-up command (cancel/query/
attach) — handles + events, the pattern already under every command ([[commands-are-agency-algs-are-pathways]]).
Tested: dispatch_background returns a handle and its completion event carries that handle + the result; a
synchronous dispatch carries neither; the wire round-trip elides both when None. ts-rs binding regenerated
(handle?: string, result?: unknown).
This is the PRODUCER; the persona-side listener (subscribe command:completed → filter to this persona's handles
→ record_dispatch_event into working memory) is the final connecting slice — pure reuse of Connection::subscribe.
Co-Authored-By: Claude Opus 4.8 [email protected]
Claude-Session: https://claude.ai/code/session_01LoTjvf5j3Ez13g6k8mRkFo