feat(acp): per-turn stage latency instrumentation (#2386) - #2460
Open
brocoppler wants to merge 1 commit into
Open
feat(acp): per-turn stage latency instrumentation (#2386)#2460brocoppler wants to merge 1 commit into
brocoppler wants to merge 1 commit into
Conversation
Measure each turn's pipeline stages: relay-accept lag (wall clock, 1s), admission (receipt -> queue), queue wait (receipt -> dispatch), session setup, first model output, and turn total, threaded from the relay loop through QueuedEvent/BatchEvent into run_prompt_task. Emitted on three carriers keyed by turn_id: optional kind:44200 payload fields, the turn_completed observer frame, and one pool::metrics info summary line. Reply-publish/relay-OK stages are out-of-band today (block#2459 tracks that observability). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: Broc Oppler <brocoppler@gmail.com>
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 this solves
First slice of #2386: stage-level timing for the mention-to-reply path, keyed by the existing
turn_id. Answers "which stage was slow" for stages 1–5 of the issue's boundary list.Stages measured
relayLagSecs— relay accept → harness receipt (wall clock, 1s resolution, from eventcreated_at)admissionMs— receipt → queue admission (gates: owner-command, author, rule match, follow policy)queueWaitMs— admission → turn dispatch (oldest batch event)sessionSetupMs+sessionReused— dispatch → ACP session resolved; warm/cold split per the issue's benchmark axesfirstOutputMs— prompt write → firstagent_message_chunkturnTotalMs— dispatch → turn completionAll monotonic-clock except relay lag; all optional; no message content in any telemetry.
Carriers
AgentTurnMetricPayload— new optional camelCase fields (skip_serializing_if, backward-compatible; consumers already MUST ignore unknown fields). NIP-AM.md updated.turn_completedobserver frame — carries the same timings instead of{}.tracing::info!summary line per turn (pool::metrics, keyed byturn_id, outcome +*_msfields) for log-based analysis.Out of scope, per the issue's own split
Testing
cargo test -p buzz-acpand-p buzz-coregreen (new tests: queue field threading through flush/requeue, timing finalization at turn exit, first-output mark/drain, payload serde round-trip incl. omission); clippy-D warningsclean across both crates; fmt clean; workspace check green.🤖 Generated with Claude Code