Skip to content

Clarify native-agent trace attribution - #371

Merged
mohanagy merged 1 commit into
mainfrom
issue-368-native-agent-trace-diagnostics
May 28, 2026
Merged

mohanagy merged 1 commit into
mainfrom
issue-368-native-agent-trace-diagnostics

Conversation

@mohanagy

@mohanagy mohanagy commented May 28, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • add native-agent compare trace_status for trace_available vs missing_verbose_trace
  • explain missing Claude --verbose attribution in terminal summaries, help, and proof docs
  • keep verbose Madar MCP runs valid while suppressing reductions for no-trace degraded runs

Closes #368

Verification

  • npm run typecheck
  • npm run build
  • CI=1 npm run test:run

Summary by CodeRabbit

  • Documentation

    • Updated guidance for --baseline-mode native_agent to clarify that --verbose flag is required alongside --output-format json for proper MCP-call attribution and token reduction reporting.
  • New Features

    • Reports now include a trace_status field indicating whether verbose trace data is available (trace_available or missing_verbose_trace).
  • Bug Fixes

    • Reports without verbose trace data now explicitly mark this limitation.

Review Change Stack

Add trace_status to native-agent compare reports so non-verbose Claude runs are distinguishable from trace-backed MCP attribution. Surface the missing --verbose requirement in summaries, help, and proof docs.\n\nCloses #368\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented May 28, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c21d00ef-b6ee-47f1-a727-8b30c386052a

📥 Commits

Reviewing files that changed from the base of the PR and between f6cb32b and 9530472.

📒 Files selected for processing (6)
  • docs/proof-workflows.md
  • src/cli/main.ts
  • src/infrastructure/compare.ts
  • tests/unit/benchmark-suite.test.ts
  • tests/unit/cli.test.ts
  • tests/unit/compare-native-agent.test.ts

📝 Walkthrough

Walkthrough

This PR adds explicit trace-availability signaling to native-agent compare reports. A new NativeAgentTraceStatus type and trace_status field on NativeAgentCompareReport distinguish whether verbose Madar/MCP trace data was captured. The status is initialized to missing_verbose_trace and upgraded to trace_available when Madar trace extraction succeeds. Documentation and CLI help clarify that --verbose is required for MCP attribution alongside --output-format json.

Changes

Native agent trace availability signal

Layer / File(s) Summary
Trace availability contract
src/infrastructure/compare.ts
Exports NativeAgentTraceStatus type ('trace_available' | 'missing_verbose_trace') and adds trace_status field to NativeAgentCompareReport interface.
Trace status tracking during execution
src/infrastructure/compare.ts
Initializes trace_status to missing_verbose_trace before Madar trace extraction; conditionally updates to trace_available when extractMadarTrace succeeds; clears madar_trace and zeros madar_mcp_call_count if no trace is available.
Report formatting and test coverage
src/infrastructure/compare.ts, tests/unit/benchmark-suite.test.ts, tests/unit/compare-native-agent.test.ts, tests/unit/cli.test.ts
Adds formatNativeAgentTraceStatusLine and updates appendNativeAgentValidityLines to render trace status in summaries; test fixtures include trace_status field; assertions validate both degraded (missing_verbose_trace) and valid (trace_available) scenarios, verify formatted output includes the trace status line and MCP attribution warning.
User guidance: help and documentation
src/cli/main.ts, docs/proof-workflows.md
Updates CLI help text and workflow documentation to clarify that Claude MCP attribution in native_agent mode requires both --verbose and --output-format json; plain --output-format json alone results in trace_status: missing_verbose_trace.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

  • #368 — Directly addresses the core request: adding explicit verbose-trace diagnostics with trace_status to distinguish MCP attribution availability (with values 'trace_available' / 'missing_verbose_trace') and warning users that --verbose is required for MCP-call attribution.

Possibly related PRs

  • mohanagy/madar#364 — Both modify src/infrastructure/compare.ts native-agent reporting to suppress/gate output (reductions, favorable-win lines) based on Madar trace/MCP availability; trace_status added here is the upstream signal used to control those gates.
  • mohanagy/madar#321 — Both modify src/infrastructure/compare.ts's native-agent Madar trace extraction and NativeAgentCompareReport fields; this PR gates on trace availability with trace_status, while the other expands madar_trace schema.
  • mohanagy/madar#343 — Both add new status fields to NativeAgentCompareReport in src/infrastructure/compare.ts; this PR introduces trace_status gated on --verbose, while that PR introduced install_verified and measurement_validity gated on Madar install detection.

Poem

🐰 A verbose trace hops through the logs,
Making MCP calls visible and clear,
Without its whisper, attribution fogs—
So trace_status now shows what's here.
Plain JSON blinks, but verbose sings true.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding trace attribution clarification for native-agent mode.
Description check ✅ Passed The description includes a clear summary of changes and verification steps, though it omits testing checkbox details and the related-issues reference is incomplete.
Linked Issues check ✅ Passed All objectives from issue #368 are addressed: trace_status type added [#368], terminal warnings for missing verbose traces [#368], documentation updated [#368], and Madar runs remain valid while degraded runs are properly marked [#368].
Out of Scope Changes check ✅ Passed All changes are directly related to issue #368 objectives: trace status tracking, documentation, help text updates, and test fixtures for native-agent trace attribution.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch issue-368-native-agent-trace-diagnostics

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

@mohanagy
mohanagy merged commit 55b5849 into main May 28, 2026
7 checks passed
mohanagy added a commit that referenced this pull request May 28, 2026
* Prepare 0.27.0 release

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Finish 0.27.0 release punchlist

Closes #358

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Relax pipeline fixture timeout on Windows

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Fix degraded compare attribution

Closes #361

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Handle no-trace degraded compare runs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Improve summary runtime path scoring

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Admit worker runtime starts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Handle metadata-less runtime starts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Add compare timeouts and heartbeats

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Prepare 0.27.1 release (#367)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Clarify native-agent trace attribution (#371)

Add trace_status to native-agent compare reports so non-verbose Claude runs are distinguishable from trace-backed MCP attribution. Surface the missing --verbose requirement in summaries, help, and proof docs.\n\nCloses #368\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Flag pre-Madar broad exploration (#372)

Closes #369

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Separate native compare routing wins from token proof (#373)

* Separate native compare token proof claims

Closes #370

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Assert native compare latency improvement

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* Prepare 0.27.2 release (#374)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

native_agent compare needs explicit verbose-trace diagnostics for MCP attribution

1 participant