Repository navigation
Implement the harness contract for Claude, PR Review and BCal - #1012
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Explicit timeout=0 incorrectly selects long default timeouts in three agent implementations, allowing subprocesses to continue instead of timing out immediately.
1 open issue
What changed in this PR
Completes the harness-contract adoption started in #1008, letting BC-Bench evaluation pipelines use a shared Harness interface rather than agent-specific runner functions.
Changes:
- Introduces Claude, PR Review, and BCal harness classes with
identity()andrun(). - Removes runner adapters and centralizes request construction in
EvaluationContext.agent_request(). - Makes
AgentRequestcovariant and updates tests, exports, and architecture guidance.
| File | Description |
|---|---|
| tests/test_review_runners.py | Updates CLI coverage for harness construction and execution. |
| tests/test_pr_review_agent.py | Invokes PR Review through its harness. |
| tests/test_nl2al_pipeline.py | Uses the shared stub to verify single-attempt execution. |
| tests/test_evaluate_pipeline.py | Migrates pipeline tests to harness injection. |
| tests/test_cli_commands.py | Updates harness mocks and version-function patch targets. |
| tests/test_claude_code_agent.py | Tests Claude execution through its harness. |
| tests/test_bcal_agent_provider.py | Adapts provider tests to BCalHarness. |
| tests/test_agent_version_results.py | Uses StubHarness for timeout-result testing. |
| tests/conftest.py | Adds a reusable, request-recording StubHarness. |
| src/bcbench/types.py | Adds evaluation-context request construction. |
| src/bcbench/evaluate/testgeneration.py | Runs test-generation tasks through Harness. |
| src/bcbench/evaluate/nl2al.py | Runs NL2AL tasks through Harness. |
| src/bcbench/evaluate/ext_request_triage.py | Runs triage tasks through Harness. |
| src/bcbench/evaluate/ext_request_implement.py | Runs implementation tasks through Harness. |
| src/bcbench/evaluate/ext_request_advisor.py | Runs advisory tasks through Harness. |
| src/bcbench/evaluate/dataquery.py | Runs data-query tasks through Harness. |
| src/bcbench/evaluate/codereview.py | Runs code-review tasks through Harness. |
| src/bcbench/evaluate/bugfix.py | Runs bug-fix tasks through Harness. |
| src/bcbench/evaluate/base.py | Replaces runner abstractions with typed harness parameters. |
| src/bcbench/evaluate/__init__.py | Exports the harness type alias instead of runner adapters. |
| src/bcbench/commands/run.py | Constructs concrete harnesses for direct runs. |
| src/bcbench/commands/evaluate.py | Injects harnesses and resolves identity through them. |
| src/bcbench/agent/pr_review/agent.py | Introduces the code-review-specific PRReviewHarness. |
| src/bcbench/agent/pr_review/__init__.py | Exports PRReviewHarness. |
| src/bcbench/agent/claude/agent.py | Introduces ClaudeHarness with configuration stored on the instance. |
| src/bcbench/agent/claude/__init__.py | Exports ClaudeHarness. |
| src/bcbench/agent/bcal/agent.py | Introduces the NL2AL-specific BCalHarness. |
| src/bcbench/agent/bcal/__init__.py | Exports BCalHarness. |
| src/bcbench/agent/__init__.py | Exposes concrete harness classes. |
| packages/bcbench-core/src/bcbench_core/agent/harness.py | Declares explicit covariance for AgentRequest. |
| .github/copilot-instructions.md | Updates architecture guidance to describe harness injection. |
Review effort: Balanced
Sun Haoran (haoranpb)
force-pushed
the
app/harness-03-all-harnesses
branch
from
November 3, 2026 14:01
cd3db1d to
dfd4feb
Compare
Wenjie Fan (gggdttt)
previously approved these changes
Nov 3, 2026
Sun Haoran (haoranpb)
dismissed
Wenjie Fan (gggdttt)’s stale review
November 3, 2026 14:29
The base branch was changed.
…s harnesses to pipelines ClaudeHarness, PRReviewHarness and BCalHarness replace their run_* functions; identity() replaces the per-harness version lookups in the CLI. PR Review and BCal are typed by their entries (CodeReviewEntry, NL2ALEntry), so the runtime category and entry checks are gone. Pipelines now take a harness directly and build the request with EvaluationContext.agent_request(), so AgentRunner and harness_runner are removed. AgentRequest is explicitly covariant so a harness for any entry satisfies a pipeline for a specific entry type. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Pipelines spell out Harness[E, AgentHarness]. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cit covariant TypeVar ty reports the test StubHarness (Harness[BaseDatasetEntry]) as not assignable to pipelines for narrower entry types; left unresolved for investigation. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Tests now pass a harness of the pipeline's exact entry type, so they do not rely on AgentRequest being inferred covariant. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sun Haoran (haoranpb)
force-pushed
the
app/harness-03-all-harnesses
branch
from
November 3, 2026 14:33
dfd4feb to
0e68be5
Compare
Sun Haoran (haoranpb)
enabled auto-merge (squash)
November 3, 2026 14:33
Contributor
Code coverage overviewLanguages: Python Python / code-coverage/pytest
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. |
Wenjie Fan (gggdttt)
approved these changes
Nov 3, 2026
| import pytest | ||
| from bcbench_core.agent.experiment import ExperimentConfiguration | ||
| from bcbench_core.agent.harness import AgentIdentity | ||
| from bcbench_core.agent.harness import AgentIdentity, AgentRequest, AgentResult, Harness |
| from bcbench.dataset import BaseDatasetEntry, NL2ALEntry | ||
| from bcbench.dataset.codereview import CodeReviewEntry | ||
| from bcbench.evaluate import AgentRunner, CodeReviewPipeline, EvaluationPipeline, NL2ALPipeline, harness_runner | ||
| from bcbench.evaluate import CodeReviewPipeline, EvaluationPipeline, NL2ALPipeline |
| from bcbench.commands.evaluate import MockEvaluationPipeline | ||
| from bcbench.dataset import BaseDatasetEntry, BugFixEntry, NL2ALEntry | ||
| from bcbench.evaluate.base import AgentRunner, EvaluationPipeline | ||
| from bcbench.evaluate.base import EvaluationPipeline |
| from bcbench.collection.patch_utils import extract_file_paths_from_patch | ||
| from bcbench.dataset import TestGenEntry | ||
| from bcbench.evaluate.base import AgentRunner, EvaluationPipeline | ||
| from bcbench.evaluate.base import EvaluationPipeline |
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.

Stacked on #1008.
Completes BC-Bench's adoption of the harness contract so pipelines depend only on
Harness.ClaudeHarness,PRReviewHarnessandBCalHarnessreplacerun_claude_code,run_pr_review_agentandrun_bcal_agent. Most of their diff is re-indentation intorun(); review with Hide whitespace.identity()replaces the per-harnessget_*_version()calls in the evaluate commands.Harness[CodeReviewEntry]and BCal aHarness[NL2ALEntry], so the runtime category/isinstancechecks in PR Review are gone and type checking enforces them instead.execute(context, harness)), building the request withEvaluationContext.agent_request().AgentRunnerandharness_runnerare removed; the mock command uses a tinyMockHarness.AgentRequestis declared covariant (explicitTypeVar, with a targetednoqa: UP046): ty infers frozen dataclass fields as invariant, which would stopCopilotHarness(Harness[BaseDatasetEntry]) from satisfying a pipeline forBugFixEntry.StubHarnessfromconftest.py; CLI tests patch the harness classes.