Skip to content

feat(copilot): add bounded evidence tools - #19

Draft
mingchuno wants to merge 2 commits into
mainfrom
agent/16-3
Draft

mingchuno wants to merge 2 commits into
mainfrom
agent/16-3

Conversation

@mingchuno

Copy link
Copy Markdown
Owner

Summary

  • add runner-owned Copilot tools to list captured changes, read individual chunks, and search captured text for case-sensitive literals
  • register the tools automatically for read-only publication and review sessions with captured evidence, while leaving Codex behavior and Copilot shell/write permissions unchanged
  • bind every query to the current invocation manifest, verify artifact hashes before returning content, bound responses, and report unread chunks and binary metadata
  • retain tool starts, completions, and failures in invocation events
  • document the evidence tools and their permission boundaries
  • add deterministic coverage for pagination, multi-chunk reads, bounded search, binary metadata, invalid references, modified evidence, provider/stage scoping, permission denial, and event retention

Why

Large Copilot publication and review changes previously lacked a bounded way to inspect captured evidence without requesting shell access. These tools expose the evidence already owned and verified by the runner, allowing the agent to navigate it without broadening read-only stage permissions or introducing a second source of truth.

Closes #16.

Validation

  • pnpm verify passed
    • TypeScript check passed
    • Biome check passed
    • build and script tests passed
    • test suite: 197 passed, 0 failed, 2 skipped

Limitations

  • The two skipped tests are live-provider checks for Codex and Copilot, so this validation does not include a live Copilot run against a large real-world change.
  • The change does not establish that evidence tools resolve every cause of provider timeout.
  • Codex custom tools, arbitrary source-file access, shell access, write access, timeout changes, and client configuration are outside this change.

Refs #16

Let read-only publication and review sessions inspect their captured change
without requesting shell access. Restrict listing, chunk reads, and literal
search to the verified invocation manifest, with bounded responses and
explicit failures for absent or modified evidence.

Closes #16

Co-authored-by: Codex <noreply@openai.com>
Agent-Workflows-Run: 905089e8-f83b-4b66-919a-71daf7030455

@mingchuno mingchuno left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Review of 3a8dd2f

The evidence was fully readable and hash-verified. Four actionable issues remain: truncated searches misreport coverage, worst-case search work is insufficiently bounded, the central large-change publication flow lacks an acceptance test, and review-stage registration is not actually tested.

Comment thread src/evidence-query.ts Outdated
return this.bounded({
term,
limit,
searchedChanges: changes.filter((change) => !change.binary).length,

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

searchedChanges always reports the total number of non-binary changes, even when the loop stops after reaching the match limit and later changes were never searched. This can falsely imply complete coverage and undermine honest limitation reporting. Track the number of changes/chunks actually scanned and report the unsearched remainder; add a regression where the first of multiple changes exceeds the limit.

Comment thread src/evidence-query.ts Outdated
for (const change of changes) {
signal?.throwIfAborted();
if (change.binary || change.chunks.length === 0) continue;
const parts = await Promise.all(

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Search reads every chunk of a change concurrently, concatenates the entire change, and repeatedly copies/splits its prefix for each match. At the supported 32 MiB limit this can fan out roughly 512 reads and copy about 1.6 GiB across 50 late matches, risking resource pressure or the timeout this feature is intended to prevent. Process chunks sequentially with bounded overlap and incremental line tracking.

assert.ok(messages.includes("captured evidence"));
});

test("Copilot read-only stages expose bounded evidence tools and retain tool failures", async () => {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

The requested high-level controlled-Copilot publication test is missing. This test invokes handlers directly over a one-chunk hand-built manifest and returns finished; it never demonstrates a session navigating captured multi-chunk evidence and producing schema-valid publication JSON without shell approval. Add an invocation-level large-change fixture that performs list/search/read calls and returns a valid publication response.

Comment thread tests/invocation.test.ts
assert.equal(calls, 1);
});

test("only Copilot publication and review receive captured evidence tools", async () => {

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Despite its name, this test only exercises publication; it never sets the stage name to review. Automatic review-stage evidence registration therefore lacks coverage. Add a review case asserting the evidence object, application-owned prompt instruction, and resulting tool registration while preserving the Codex exclusion.

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.

feat: give Copilot publication and review bounded evidence tools

1 participant