[AI-689] ACP observability: lifecycle logging + opt-in debug-frame gate + metrics (PR 3/4)#317
Conversation
PR Summary by QodoACP observability: lifecycle logs, gated debug frames, and minimal metrics
AI Description
Diagram
High-Level Assessment
Files changed (18)
|
Code Review by Qodo
1.
|
…ate, and minimal metrics Adds source-gen [LoggerMessage] Info-level lifecycle logging for the ACP hosted-agent launch/handshake/session-start/blocking-request/session-end points that exist today (ids, kinds, counts, model, protocol/capability metadata only — never prompt/tool content), a KCAP_ACP_DEBUG_FRAMES opt-in flag that gates the two existing unconditional content-leaking Debug logs (unknown-update raw dump, cursor-agent stderr) behind explicit consent plus a startup Warning and a shared length cap, adds the same opt-in full-frame logging to AcpConnection without touching its existing shape-only logging, and a minimal Capacitor.Cli.Daemon.Acp Meter with launch/session/ blocking-request/failure counters (verified warning-free under NativeAOT). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…startup failed before a session started (+ test) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ound frame only after it's written; skip raw-JSON alloc on the default path (IsEnabled gate); trim the flag env value Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
bbf5c98 to
9271b42
Compare
What & why
AI-689 Workstream B — PR 3 of 4 (observability). Design-of-record in #315. Stacked on #316 (diagnostics) — base is
ai-689-diagnostics; retarget tomainonce #316 merges.An operator watching at the default level currently sees nothing ACP-specific unless something fails, and two Debug logs leak unredacted content. This PR fixes both, plus adds minimal metrics.
[LoggerMessage], payload-free — ids/kinds/metadata only, never prompt/tool/assistant content): hosted-agent launch, handshake OK (protocolVersion + loadSession + resolved model), session started, blocking-request issued+resolved (kind + decision only), session ended.KCAP_ACP_DEBUG_FRAMES(default off): when off, the Unknown-kind update dump and cursor-agent stderr log shape only (kind + length), andAcpConnectionkeeps its existing shape-only frame logging. When on, full raw updates / stderr lines / inbound+outbound frames are logged at Debug under a dedicated path, length-capped, with a one-time loud "may contain full prompts, tool arguments, and file contents" Warning. Nothing is ever written to the transcript or forwarded to the server.Meter "Capacitor.Cli.Daemon.Acp":acp.launches,acp.sessions_started,acp.blocking_requests{kind},acp.failures{stage}). No exporter — observable viadotnet-counters. Confirmed NativeAOT-clean.Tests & gates
New:
AcpEventTranslatorTests,AcpDebugFrameLogTests,AcpMetricsTests,DaemonDebugFramesFlagTests,AcpHostedAgentRuntimeFactoryTests, plus extendedAcpConnectionTests/AcpInteractionBridgeTests— assert default-off gating logs shape-not-content, the enable-warning fires once, and blocking-request logs carry kind+decision but no content. Full unit suite 2896/2898 (2 pre-existingKCAP_ACP_LIVE-gated skips); NativeAOTosx-arm64gate warning-free (incl. metrics).Follow-up
Reconnect/resume + its lifecycle events/metrics land in PR 4/4.
🤖 Generated with Claude Code