Skip to content

feat(experiment): calibrate a reconstruction benchmark adapter - #8944

Draft
WenyuChiou wants to merge 5 commits into
morluto:mainfrom
WenyuChiou:experiment/8475-reconstruction-calibration
Draft

WenyuChiou wants to merge 5 commits into
morluto:mainfrom
WenyuChiou:experiment/8475-reconstruction-calibration

Conversation

@WenyuChiou

Copy link
Copy Markdown
Contributor

Summary

Refs #8475. I am proposing a small experimental calibration harness to make the adapter boundary concrete before choosing external task-pack formats or scoring policy. This is a Draft for scope discussion, not a production integration or an assertion that the RFC is settled.

Problem and expected behavior

The existing comparison and verify_reconstruction tools can produce finite claim verdicts, but the RFC has no runnable adapter example. I want an experiment that preserves pass/fail/unknown, Evidence and execution errors rather than turning them into an unsupported agent score.

Change and scope

Five isolated files under experiments/reconstruction-benchmark/: a public MCP adapter, three synthetic behavioral calibration cases, a local stdio runner, six boundary tests and usage/limitations. No registered tool, dependency, package command, generated catalog or production source changes.

In-repository versus external harness, claim versus task rollups, benchmark task ownership, and AgentRE-Bench/SRE-Bench compatibility remain unresolved. Maintainer scope decision is pending; this draft does not close #8475.

Contract and boundary impact

  • Semantic owner: existing comparison and reconstruction contracts remain unchanged. The experimental consumer validates their inputs/outputs.
  • CLI/MCP: existing tools only; no new public contract.
  • Evidence: retains input records and returned comparison/verification Evidence, including partial comparison if verification errors. Errors and unrun tasks are not failed claims.
  • Authority: fixtures are explicitly synthetic, including the authority fields required to exercise the protocol. No actual process capture, target execution or agent evaluation.
  • Side effects: starts a local REA stdio server; creates isolated HOME/XDG scratch and removes it only after observing child close. Captures bounded stderr. No deep provider is configured by the runner. Child-close observation is not general process-tree containment.
  • Package/install/generated metadata impact: none; existing built runtime and installed SDK required.

Evidence and regression coverage

Executed on Linux with Node v24.22.1 using an existing REA 6.8.0 build. The runtime checkout HEAD was 89317a39fab23df81efa4331311d09d2110377bd and had unrelated JavaScript analysis edits. This is not clean-main or current-upstream validation. No rebuild/install was performed.

  • node --test experiments/reconstruction-benchmark/adapter.test.mjs: 6 passed, 0 failed.
  • node experiments/reconstruction-benchmark/run.mjs: exit 0. Public stdio MCP produced equal-complete: pass, changed-exit: fail, unknown-environment: unknown; all expected-outcome assertions passed. Child-close observation and scratch cleanup completed; stderr was empty.
  • Existing oxfmt with repository config: five files formatted.
  • Independent read-only review of the experimental code found lifecycle and evidence gaps; corrected and reran tests/calibration. This is AI review, not human author readiness.

Runtime artifact fingerprints before and after were equal: 5206cd75fbc3d5351920f1d9bd13685e1cff09ca2da4bf7d6f49e81632856a03. Launcher SHA-256: 326efe32e54a1357bba94314b1fbbe518b0e110d746bd0bf1f9d08fd55d064dc. These fingerprint dist/launcher, not dependency identity or source-build provenance.

Remaining proof gaps

Repository-wide npm run check, test-discovery, clean-current-main build and CI have not run. The new Node tests are explicit opt-in commands, not integrated into the production suite. Structural-function/artifact packs, external benchmark formats, real agent tasks, real targets/providers, independent scoring validity, and Windows/macOS are unverified. Synthetic calibration cannot demonstrate scientific benchmark quality. A verifier pass covers only the declared finite claims, not global equivalence.

Author readiness

Human owner: @WenyuChiou

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Material scope and authority questions are resolved.
  • Required validation is complete on the proposed head.
  • Human readiness declarations are complete.

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5 Tier: apex

[Low impact] The PR adds an opt-in experiment without changing REA’s production tools or workflows.

The isolated experiment has no blocking code defect; both findings concern what failed reports retain.

Findings

  1. P2 Saved results miss the report ▶
  2. P2 Failed reports omit requested checks ▶
Fix with agent prompt
### Issue 1
experiments/reconstruction-benchmark/adapter.mjs:100-105
When a comparison completes but its reply exceeds REA's response budget, the server returns an error containing `evidence_reference`. `checkedCall` keeps that reply only inside error text, so `compared` remains unset. The runner then closes the session without reading the saved result, leaving completed Evidence out of the report and making the reference unusable. Retrieve referenced Evidence before closing, while still marking the task as an execution error.

### Issue 2
experiments/reconstruction-benchmark/adapter.mjs:70-76
When `verify_reconstruction` throws, this entry keeps `task.comparison` but drops `input` and `task.claims`. The comparison does not contain the requested claim dimensions or titles, and the pack digest cannot reconstruct them. Keep the verification request, or the full task, alongside the error so readers can see exactly which checks were attempted.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

Adds an isolated experimental adapter that compares supplied Evidence, verifies finite claims, and checks three synthetic outcomes through local stdio MCP.

  • Task packs use REA comparisons without turning tool errors into claim results.
  • Three synthetic process-capture cases show pass, fail, and unknown outcomes.
  • The local runner reports calibration results and cleans up after its MCP child closes.

Diagram

sequenceDiagram
    participant R as Runner
    participant A as evaluatePack
    participant S as REA stdio session
    R->>S: Start local server with temporary HOME
    R->>A: Supply synthetic pack and callTool
    loop Tasks until first error
        A->>S: Comparison request
        S-->>A: Comparison Evidence or error
        opt Comparison succeeds
            A->>S: verify_reconstruction
            S-->>A: Verification Evidence or error
        end
    end
    A-->>R: Completed, errored and unrun tasks
    R->>S: Close client and transport
    R->>R: Check close, clean scratch, write report
Loading

Reviews (1) · Last reviewed commit: "feat(experiment): add reconstruction cal..." · Reviewed by Greptile

Comment on lines +100 to +105
const response = await call(name, arguments_);
if (response?.isError)
throw new Error(
`${name} returned a tool error: ${JSON.stringify(response)}`,
);
return toolContract(name).outputSchema.parse(response?.structuredContent);

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.

P2 Saved results miss the report

When a comparison completes but its reply exceeds REA's response budget, the server returns an error containing evidence_reference. checkedCall keeps that reply only inside error text, so compared remains unset. The runner then closes the session without reading the saved result, leaving completed Evidence out of the report and making the reference unusable. Retrieve referenced Evidence before closing, while still marking the task as an execution error.

Knowledge Base Used: Session evidence and results

Prompt To Fix With AI
This is a comment left during a code review.
Path: experiments/reconstruction-benchmark/adapter.mjs
Line: 100-105

Comment:
**Saved results miss the report**

When a comparison completes but its reply exceeds REA's response budget, the server returns an error containing `evidence_reference`. `checkedCall` keeps that reply only inside error text, so `compared` remains unset. The runner then closes the session without reading the saved result, leaving completed Evidence out of the report and making the reference unusable. Retrieve referenced Evidence before closing, while still marking the task as an execution error.

**Knowledge Base Used:** [Session evidence and results](https://app.greptile.com/-/switch-tenant?tenant=pre&next=%2Fcustom-context%2Fknowledge-base%2Fmorluto%2Frea%2F-%2Fdocs%2Fsession-evidence-and-results.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Comment on lines +70 to +76
tasks.push({
id: task.id,
execution: "error",
stage,
comparison_input: task.comparison,
...(compared ? { comparison: compared } : {}),
error: error instanceof Error ? error.message : String(error),

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.

P2 Failed reports omit requested checks

When verify_reconstruction throws, this entry keeps task.comparison but drops input and task.claims. The comparison does not contain the requested claim dimensions or titles, and the pack digest cannot reconstruct them. Keep the verification request, or the full task, alongside the error so readers can see exactly which checks were attempted.

Prompt To Fix With AI
This is a comment left during a code review.
Path: experiments/reconstruction-benchmark/adapter.mjs
Line: 70-76

Comment:
**Failed reports omit requested checks**

When `verify_reconstruction` throws, this entry keeps `task.comparison` but drops `input` and `task.claims`. The comparison does not contain the requested claim dimensions or titles, and the pack digest cannot reconstruct them. Keep the verification request, or the full task, alongside the error so readers can see exactly which checks were attempted.

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

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.

[RFC] Benchmark oracle adapter: expose rea_verify_reconstruction for AgentRE-Bench / SRE-Bench task packs

1 participant