Skip to content

fix(mcp): cora.scan_finalize reports whole-directory coverage when the agent judged only some batches #685

Closed

Description

@ajianaz

Problem

In agent-as-reviewer mode the agent is expected to judge every batch, but nothing records or reports which batches were actually judged. A finalize call after judging a single batch returns a summary that reads as a full verdict, which can mislead the user or a downstream automation (the result is labelled advisory, but the numbers are not).

Reproduction (cora 0.19.0, MCP over stdio)

  1. cora.scan_prepare {"path": "crates/tole-cli/src", "batch": 0} -> total_batches: 11, files_fingerprint: dc6aa4596f8c7f6a.
  2. Judge only batch 3 (3 of the directory's files); report 9 findings.
  3. cora.scan_finalize {"path": "crates/tole-cli/src", "files_fingerprint": "dc6a...", "issues": [...9 findings...]} returns:
{ "files_scanned": 23, "total_issues": 59, "should_block": false, "judge": "agent",
  "summary": "Scanned 23 files (14763 lines), found 59 issues. Judged by the calling agent (not by a cora-configured LLM).",
  "note": "Judged by the calling agent: advisory ... The verdict covers only the input passed to this finalize call." }

"Scanned 23 files" is the file count of the directory, but the agent judged 3. The note says the verdict covers "only the input passed", yet should_block: false and files_scanned: 23 read as a clean result for all 23 files.

Proposal

  • Add an optional batches_judged: [int] input to scan_finalize (or infer from the findings' files if absent) and return batches_judged, total_batches, files_judged, files_total.
  • When coverage is partial, say so in the summary ("Judged 1/11 batches (3/23 files)") and set coverage: "partial"; consider forcing should_block to null/unknown instead of false for a partial run.
  • Optionally let scan_prepare embed a per-batch id into the fingerprint so finalize can tell which prepare calls were made.

Done when

The repro returns coverage: "partial" with 1/11 batches, and judging every batch returns coverage: "complete".

Related: #647.

Activity

  1. added
    bug
    scope:integration
    on Oct 16, 2026
  2. added 2 commits that reference this issue on Oct 27, 2026
    5bad288
    36a8dba
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugpriority:mediumscope:integration

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions