Skip to content

Add advanced code review metrics view - #851

Open
dayland wants to merge 15 commits into
experiment/live-pr-review-leaf-modelsfrom
feature/code-review-advanced-metrics
Open

dayland wants to merge 15 commits into
experiment/live-pr-review-leaf-modelsfrom
feature/code-review-advanced-metrics

Conversation

@dayland

@dayland dayland commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Adds the advanced Code Review metrics view, retaining PR Review-specific diagnostics, coverage, and BCQuality lineage in category-specific result/summary/aggregate data.
  • Keeps the default Code Review dashboard concise and cross-runner compatible; detailed engine, CLI, BCQuality, usage, knowledge, and sub-skill evidence appears only in the advanced view.
  • Catches up to current main, preserving the five newly published GPT-5.6 Terra runs and regenerating the Code Review leaderboard data with optional advanced diagnostics.
  • Integrates the deterministic BC PR Review baseline from Validate deterministic PR review model routing #881: immutable BC-ALAgents revision, explicit root/leaf models and scheduling, strict manifest validation, complete telemetry/model attestation, and engine-owned BCQuality provenance.

Why

The default leaderboard needs comparable headline metrics, while PR Review engineering decisions need detailed evidence about the actual review stack and coverage. This keeps runner-specific provenance and optional diagnostics in the Code Review-specific models and advanced view rather than expanding the generic summary workflow or base schemas.

Validation

  • Focused conflict-resolution metrics/serialization/summary suite: 68 passed
  • Deterministic PR Review conflict-resolution suite: 71 passed
  • Full suite after integration: 1,108 passed, 2 skipped, 1 deselected
  • Changed-file pre-commit hooks, workflow/action YAML parsing, git diff --check, and leaderboard deserialization passed
  • Direct ty check has one pre-existing unused-ignore warning in untouched src/bcbench/redteam.py
  • A focused evaluation-identity PR Review smoke run is dispatched from the integrated head and will be reviewed before merge.

Design boundaries

  • agent_version remains generic harness identity; BCQuality and CLI provenance remain Code Review-specific.
  • Missing optional diagnostics stay unavailable (null); malformed artifacts fail explicitly.
  • The deterministic runner rejects partial, reordered, model-substituted, incomplete, or malformed review runs before scoring.
  • A future named PR Review definition/profile will build on this advanced view after Validate deterministic PR review model routing #881 and this PR are merged; it is intentionally not included here.

@dayland
dayland marked this pull request as draft September 3, 2026 12:50
@dayland

dayland commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator Author

Marking this draft while the advanced data contract is completed. BC-ALAgents currently logs BCQuality filtering/consumption but does not persist article retained, pruned, cited/used, sub-skill execution, or usage-completeness diagnostics into BC-Bench result artifacts, so this page cannot yet show the requested full performance set.

@haoranpb Sun Haoran (haoranpb) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dayland I think lots of the changes here is not needed, if we strictly follow the versioning policy of BC-Bench.

A version of BC-Bench, e.g. v0.10.0, specifically list the version of all agent harness.

So a fixed version of BC-Bench should point to a fixed version of all agent harnesses, which should then points to fixed versions of bcquality etc

Note: the version of BC-Bench is already collected as part of the results

@dayland

dayland commented Sep 7, 2026 •

Copy link
Copy Markdown
Collaborator Author

Sun Haoran (@haoranpb) That makes sense as the intended versioning contract. Would you be open to a thin compromise where we keep the exact pins in the persisted result identity and aggregation key, but only show them compactly as an Evaluation Stack cell on the dashboard?

The release remains the canonical description, while the abbreviated BC-Bench, BC-ALAgents, and BCQuality identities save analysts from reconstructing the transitive pins for each row. This also prevents accidental aggregation if results are produced from different commits or experimental pins under the same in-development benchmark version.

@haoranpb

Copy link
Copy Markdown
Collaborator

Sun Haoran (Sun Haoran (@haoranpb)) That makes sense as the intended versioning contract. Would you be open to a thin compromise where we keep the exact pins in the persisted result identity and aggregation key, but only show them compactly as an Evaluation Stack cell on the dashboard?

The release remains the canonical description, while the abbreviated BC-Bench, BC-ALAgents, and BCQuality identities save analysts from reconstructing the transitive pins for each row. This also prevents accidental aggregation if results are produced from different commits or experimental pins under the same in-development benchmark version.

dayland Good point, you pointed out a very valid gap in the current design:

we can't really experiment with agent harness version.

We never had that need before PR Review Agent, after some thought, what do you think about this #860 ? Could it be an alternative to what we are trying to achieve here? Or at least partly

@dayland
dayland changed the base branch from main to feature/agent-version-identity September 8, 2026 08:46
Base automatically changed from feature/agent-version-identity to main September 8, 2026 08:52
@dayland
dayland marked this pull request as ready for review September 8, 2026 09:21
@haoranpb
Sun Haoran (haoranpb) requested a balanced review from Copilot September 8, 2026 10:37

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

A few implementation details make the new “advanced diagnostics” metrics potentially inaccurate or brittle (notably knowledge-usage counting, per-task BCQuality scanning cost, and hardcoded Copilot CLI provenance output).

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR extends the code-review (PR Review) evaluation pipeline to persist and surface richer diagnostics (usage token breakdowns, API call stats, BCQuality knowledge/sub-skill telemetry) and adds an advanced “Code Review Advanced Metrics” dashboard to display the expanded schema, while keeping the default leaderboard view focused on headline metrics.

Changes:

  • Persist PR Review diagnostics into result / summary / leaderboard schemas and aggregate them with “only where available” semantics.
  • Record evaluation stack provenance (BC-Bench commit, Copilot CLI version, BCQuality repo/commit/version) end-to-end through workflows and summaries.
  • Add a dedicated advanced metrics documentation page and adjust the default Code Review dashboard to emphasize production PR Review runs vs legacy direct-agent rows.
File summaries
File Description
tests/test_review_workflows.py Updates workflow/action pin expectations and adds docs/dashboard visibility assertions.
tests/test_pr_review_metrics.py Expands PR Review metrics tests for new diagnostics and knowledge/sub-skill counting.
tests/test_pr_review_metrics_reporting.py Verifies new diagnostics flow through result JSON, summaries, and aggregates.
tests/test_evaluation_summary.py Adds coverage for provenance fields sourced from environment variables.
tests/test_agent_version_results.py Ensures legacy bc_alagents_commit is restored into agent_version.
src/bcbench/types.py Extends AgentMetrics with PR Review diagnostic fields and validation constraints.
src/bcbench/results/summary.py Adds provenance fields to summaries and restores legacy PR Review agent identity.
src/bcbench/results/leaderboard.py Adds provenance fields to aggregates and restores legacy PR Review agent identity.
src/bcbench/results/codereview.py Computes/serializes new diagnostic averages and coverage rates for code-review summaries.
src/bcbench/agent/pr_review/metrics.py Implements parsing/derivation of PR Review usage + BCQuality/filter/findings diagnostics.
src/bcbench/agent/pr_review/agent.py Passes bcquality_root into metrics builder to support knowledge diagnostics.
docs/code-review.md Reframes default dashboard into production vs legacy sections and links to advanced view.
docs/code-review-details.md Adds the advanced metrics dashboard with expanded columns and provenance display.
.github/workflows/summarize-results.yml Plumbs provenance inputs into summarization via environment variables.
.github/workflows/pr-review-evaluation.yml Exports harness identity outputs and forwards them into summarization inputs.
.github/actions/install-agent-harnesses/action.yml Adds harness identity outputs (Copilot CLI + BCQuality repo/commit/version).
Review details
  • Files reviewed: 16/16 changed files
  • Comments generated: 4
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread .github/actions/install-agent-harnesses/action.yml Outdated

@haoranpb Sun Haoran (haoranpb) left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With #860 merged,can we trim this to persisting and displaying the required diagnostics? benchmark_version and agent_version already identify the setup, so I’m not sure we need five extra inputs on the shared summarization workflow.

I understand the convenience of showing the BCQuality version, but the recorded BC-ALAgents SHA already pins it. Could we resolve bcquality-commit in the notebooks for deeper analysis instead of passing it through the evaluation workflows?


Or, alternatively, collect and resolve the dependency chain as part of the evaluation result

@dayland

dayland commented Sep 8, 2026

Copy link
Copy Markdown
Collaborator Author

Addressed the latest review feedback in ea89f12e. The five PR Review-specific inputs have been removed from the shared summarization workflow. Advanced-only provenance is now derived inside the evaluation result from _run-metrics.json, the engine BCQuality config, and the actual prepared checkout commit. The diagnostic correctness/performance comments were also addressed: missing filter reports produce null diagnostics, inventory counting is cached, and article references are normalized and restricted to knowledge paths.

@dayland

dayland commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator Author

Updated #851 against the typed metrics contracts merged in #865.

  • PR Review-only diagnostics and BCQuality lineage now live on PRReviewMetrics; shared AgentMetrics contains only core fields.
  • The PR Review parser and timeout path return the concrete registered type.
  • Summary extraction tolerates generic historical Code Review metrics that do not expose the optional PR Review fields.
  • premium_requests was removed from persisted metrics, aggregate schemas, tests, and the advanced dashboard. It remains validated only as part of the incoming schema-v1 engine artifact.
  • The PR description was updated to match the final scope.

The branch is current with main, and all local and GitHub checks pass.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Missing findings artifacts are currently treated as measured zeros (not unavailable/null) and the production performance docs table currently includes experiment rows, both of which conflict with the intended reporting semantics.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 15/15 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread docs/code-review.md
Comment thread src/bcbench/agent/pr_review/metrics.py
Comment thread src/bcbench/results/summary.py Outdated
Comment thread src/bcbench/results/summary.py Outdated
Comment thread src/bcbench/results/summary.py Outdated
Comment thread src/bcbench/results/leaderboard.py Outdated
Comment thread src/bcbench/results/codereview.py
Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread src/bcbench/results/codereview.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Missing engine findings artifacts currently fail evaluation and legacy usage_complete can be mis-aggregated as 0.0 instead of preserved as unavailable.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 13/13 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment thread src/bcbench/agent/pr_review/metrics.py
Comment thread src/bcbench/results/codereview.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread src/bcbench/agent/pr_review/metrics.py Outdated
Comment thread tests/test_pr_review_metrics.py Outdated
@haoranpb

Copy link
Copy Markdown
Collaborator

I see some lots of duplicated code with #881 , can you consolidate?

@dayland

dayland commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator Author

I see some lots of duplicated code with #881 , can you consolidate?

This is on purpose. This PR will not merge until 881 goes in and then will only be the delta.

@dayland
dayland changed the base branch from main to experiment/live-pr-review-leaf-models September 25, 2026 14:53
@dayland
dayland added this pull request to stack #898 September 25, 2026 14:54
@haoranpb
Sun Haoran (haoranpb) requested a balanced review from Copilot September 29, 2026 08:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread src/bcbench/results/codereview.py Outdated
Comment thread src/bcbench/results/leaderboard.py
Comment thread src/bcbench/results/leaderboard.py Outdated

@haoranpb Sun Haoran (haoranpb) left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Taking a step back, and thinking from the general archetecture view:

Should all of the calculated metrics be calculated by PR Review Agent instead?

So it remains a black box to BC-Bench, and we just read manifest just like other metrics? It probably doesn't make sense for BC-Bench to know the folder structure of BCQuality, what do you think?

@dayland
dayland force-pushed the feature/code-review-advanced-metrics branch from 6f1616b to 458b782 Compare October 6, 2026 12:50
@github-code-quality

github-code-quality Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage overview

Languages: Python

Python / code-coverage/pytest

experiment/live-pr-r... 7c98b75 feature/code-review-... f977609 +/-
88% 88% 0%
View coverage of the 9 most impacted files.
File experiment/live-pr-r... 7c98b75 feature/code-review-... f977609 +/-
src/bcbench/age...view/metrics.py 100% 95% -5%
src/bcbench/res.../leaderboard.py 99% 99% 0%
src/bcbench/com...nds/evaluate.py 78% 78% 0%
src/bcbench/commands/result.py 87% 87% 0%
src/bcbench/cli_options.py 100% 100% 0%
src/bcbench/res...s/codereview.py 100% 100% 0%
src/bcbench/types.py 92% 93% +1%
src/bcbench/age...review/agent.py 77% 78% +1%
src/bcbench/age...run_manifest.py 0% 94% +94%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated October 22, 2026 15:00 UTC

@dayland
dayland force-pushed the feature/code-review-advanced-metrics branch from 75b4b40 to 798db44 Compare October 22, 2026 14:30
dayland-ms and others added 15 commits October 22, 2026 15:55
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Restore raw usage and BCQuality diagnostics to result data, aggregate them with explicit telemetry coverage, and expose them in the advanced code-review view.

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

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Include immutable BC-Bench, Copilot CLI, BC-ALAgents, and BCQuality identity in summaries and aggregate grouping, and display linked pins on both code-review dashboards.

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

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Keep historical direct-agent results available while making BC PR Review the baseline and performance comparison surface.

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

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Replace the partial Luna and Gemini baseline with three production runs for all eight curated models, preserving legacy direct-agent history. Backfill the immutable BC-Bench, Copilot CLI, BC-ALAgents, and BCQuality identity used by the refresh.

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

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Persist the evaluated harness version through artifacts and aggregation, support pinned PR Review revision overrides, and surface versions in summaries and leaderboards.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Leave dashboards unchanged, display versions without links, and follow the existing first-result summary convention. Retain only concise capability documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make optional diagnostics resilient, derive provenance from runtime artifacts, and remove PR Review-specific inputs from the shared summarization workflow.

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

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Exclude experiment rows from the production performance table and keep missing findings diagnostics distinct from measured zeros.

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

Copilot-Session: 57308020-6803-4e62-b08e-57fa875bff89
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Use a hashable tuple type for category-specific run keys so the aggregate map accepts each implementation's key.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Initialize deterministic models on every path, mark the summary override explicitly, and narrow runtime summary values.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Keep manifest identity consistent between usage fixtures and assert null costs do not contribute to metric counts or coverage.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dayland
dayland force-pushed the feature/code-review-advanced-metrics branch from 798db44 to f977609 Compare October 22, 2026 14:58

This branch has not been deployed

No deployments
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.

5 participants