Repository navigation
perf(persona): tool dispatch through the uniform client + kill Value round-trip - #1702
Merged
Merged
Conversation
…Value round-trip Persona ToolExecutor now rides the SAME continuum_client::Connection every citizen uses, over InProcessTransport (the local-connection variant) — no bespoke Arc<CommandExecutor> path. cli/mobile/persona differ only by transport. - execute_native_batch dispatches the whole batch CONCURRENTLY (join_all): native parallel tool calls in a turn are independent, correlate by tool_use_id. Consolidated burst at O(batch), never per-event FIFO. - CommandClient::execute_value: Value-native dispatch that skips the to_value/from_value round-trip the typed execute() did for P=R=Value (two full tree-walks of pure waste on every persona tool call). execute() now delegates through it — one dispatch path; round-trip only at the genuine typed boundary. +10-15% at scale even in debug. - Cow command names: only allocate the _->/ rewrite when an underscore exists. - time_async! probe on the dispatch seam (not eprintln). Proven, not claimed (gated #[cfg(feature="stress-tests")]): - Barrier(50) deadlock-proofs: intra-batch + cross-persona dispatch is concurrent; serialization would deadlock -> timeout fails. - load_harness.rs: realistic 50-persona team on a shared project via the REAL CodeModule (read/search/tree/write, real payloads). read 27k/s search 17k/s write 31k/s tree 6k/s, 0 errors. Dispatch overhead ~13us = ~2% of a real read. read scaling sweep 10->400 personas: 23k->35k reads/sec, flat latency, NO contention cliff. Verdict: the in-process client path scales clean; dispatch is not the bottleneck. Next: airc remote-path (AircIpcTransport) body-opaque streamlining. Refs #15. Co-Authored-By: Claude Opus 4.8 <[email protected]>
…s, preserve behavior Adversarial reviewer (default-BLOCK) findings on #1702, all fixed: - BLOCKER: the per-call `time_async!` wrap allocated 3 Strings every tool call (TimingGuard is NOT a no-op when logging is off — `.into()` x2 on construct + `format!` in Drop before the LOGGER check). It ADDED hot-path allocations in the PR meant to remove them, with a false "no-op" comment. Removed the per-call wrap; dispatch latency is already captured by the executor's command_completed event + measured by the load harness. Hot path is now alloc-lean. - MAJOR: error content fed to the model was the ClientError wrapper Display ("substrate refused command `x`: …"). Now unwraps ClientError::Refused.reason so the model sees the substrate's real message ("Unknown command: …"), matching the prior behavior. Pinned by an assertion in failed_call_*. - MAJOR: Binary command results flipped from success(metadata) to error when routed through InProcessTransport. command_result_to_value now mirrors CommandResult::to_json_value (Binary → Ok(metadata)). Pinned by a new test. - MINOR: reworded the exec_over doc — this executor is not yet wired into build_workspace_cycle (that's the next slice of #15). - NIT: restored alphabetical order of the InProcessTransport re-export. All green: client execute_value, 6 executor tests (incl. 3 stress proofs), 4 in_process_transport tests (incl. the new Binary pin). Refs #15. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Re-review caught it: load_scaling_curve's comment still claimed per-call dispatch is timed by a time_async! probe — that probe was removed in the prior fix commit. Corrected to state batch latency is the measurement and per-call dispatch is intentionally not separately probed on the hot path. Comment-only. Co-Authored-By: Claude Opus 4.8 <[email protected]>
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.
What
Routes the persona's
ToolExecutorthrough the samecontinuum_client::Connectionevery citizen uses, overInProcessTransport(the local-connection variant) — no bespokeArc<CommandExecutor>path. cli / mobile / persona now differ only by transport. Closes the executor half of #15.Why (performance + harmony)
execute_native_batchdispatches the whole batch viajoin_all— native parallel tool calls in a turn are independent, correlate bytool_use_id. Consolidated burst at O(batch), never per-event FIFO.CommandClient::execute<P,R>didto_value/from_valueforP=R=Value— two full tree-walks of pure waste on every persona tool call. Newexecute_valueforwards theValuestraight through;executedelegates through it (round-trip only at the genuine typed boundary). +10–15% at scale even in debug.Cowcommand names (alloc only on_→/),time_async!probe on the dispatch seam.Proven, not claimed (gated
#[cfg(feature="stress-tests")])load_harness.rs) — 50-persona team on a shared project via the REALCodeModule, real payloads. read 27k/s, search 17k/s, write 31k/s, tree 6k/s, 0 errors.Next
airc remote-path (
AircIpcTransport) body-opaque streamlining (separate PR).Refs #15.
🤖 Generated with Claude Code