Skip to content

Verify copilot adapter against real CLI 1.0.117 (#116) - #214

Merged
vsn411 merged 4 commits into
secfoo-com:mainfrom
Shruti070107:verify/copilot-cli-116
Nov 29, 2026
Merged

vsn411 merged 4 commits into
secfoo-com:mainfrom
Shruti070107:verify/copilot-cli-116

Conversation

@Shruti070107

Copy link
Copy Markdown
Contributor

Addresses #116 for one adapter. opencode is intentionally not duplicated here because upstream PR #207 already verifies it.

What changed

  • Added scripts/record_agent.py, which invokes the real secfoo adapter, redacts credential-shaped strings and opaque provider IDs, and refuses to save a fixture if a key pattern survives.
  • Recorded real GitHub Copilot CLI 1.0.117 transcripts under tests/fixtures/agents/copilot/1.0.117/:
    • success.json — full secret-scanning --depth quick run on examples/, exit 0, real report and usage payload.
    • auth_failure.json — real 401 Bad credentials rejection.
    • timeout.json — real short-timeout kill.
    • binary_not_found.json — real missing-binary path.
  • Updated CopilotAdapter with the CLI's --usage-output-file flag so input/output tokens are read from the file the CLI actually writes. Premium requests / AI credits are not USD, so cost_usd stays None rather than being invented.
  • Added replay tests in tests/test_agents/test_copilot_recordings.py that feed the recordings through extract_report(), the report parsers, token extraction, and status mapping (failed, binary_not_found, timeout; not_configured is asserted as API-only).
  • Added a dated verification matrix in docs/agents.md and removed the stale docs-only claim for Copilot.

Verification

  • CLI: GitHub Copilot CLI 1.0.117, Windows, verified 2026-11-29 by Shruti070107.
  • Install: npm install -g @github/copilot; auth: gh auth login plus GH_TOKEN from gh auth token.
  • pytest -q tests/test_agents/test_copilot.py tests/test_agents/test_copilot_recordings.py → 17 passed.
  • ruff check on all changed Python files → clean.

Other adapters remain explicitly marked unverified in the matrix; this PR does not claim otherwise.

vsn411 and others added 2 commits November 29, 2026 09:46
The usage file had a predictable name in the shared temp dir
(secfoo-copilot-usage-<pid>-<id>.json); another local user could
pre-create it as a symlink and have the CLI overwrite its target. Use a
mkdtemp() directory (0700, random name) per run and remove it after.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vsn411

vsn411 commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Thanks for a second adapter! The recordings are real and thorough:

  • success, a real 401, timeout, binary missing;
  • reading output tokens from --usage-output-file, because the JSONL stream doesn't carry them, is a real fix;
  • keeping cost_usd at None for premium requests is the honest choice.

Your recorder drives the real secfoo adapter, so it verifies the argv secfoo actually builds. That's the better design.

I pushed one fix (c1ac34c). The usage file had a predictable name in the shared temp directory (secfoo-copilot-usage-<pid>-<id>.json). On a multi-user machine, someone could pre-create that name as a symlink and have the CLI overwrite the file it points to. It now uses a private mkdtemp() directory for each run and removes it afterwards. I also merged current main.

Two things for you:

  1. Home paths in the fixtures. The recordings contain the recording machine's home directory (C:\Users\<name> and /Users/<name>) about 190 times. Could record_agent.py replace Path.home() (raw and JSON-escaped) with ~ before the secret check, and then re-record or rewrite the four files? fix(agents): verify opencode 2.3.0 adapter against real CLI (#116) #207 got the same request.
  2. One recorder for both PRs. fix(agents): verify opencode 2.3.0 adapter against real CLI (#116) #207 (opencode) adds its own scripts/record_agent.py, so the two will conflict. Since yours runs the adapter itself, we suggest yours becomes the shared one, and fix(agents): verify opencode 2.3.0 adapter against real CLI (#116) #207 records opencode with it. If you two are working together, you could coordinate that directly.

@vsn411 vsn411 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.

Real recordings, usage from --usage-output-file, honest cost handling. CI is green. Approving.

@vsn411
vsn411 merged commit 91ade50 into secfoo-com:main Nov 29, 2026
10 checks passed
@vsn411

vsn411 commented Nov 29, 2026

Copy link
Copy Markdown
Collaborator

Merged, thank you! That's two merged PRs from you this weekend. 🎉 Copilot is now the second adapter with real recordings and a dated row in the verification matrix.

Before merging I moved the usage file into a private temp directory and merged current main. CI was green.

Two follow-ups, whenever you have time:

#116 stays open until every adapter has its recordings.

vsn411 added a commit to saryeljaramany/secfoo that referenced this pull request Nov 29, 2026
Resolve the docs conflicts with secfoo-com#205 (api MCP tool loop), secfoo-com#209 (Models
column) and secfoo-com#214: keep both the api and Codex MCP text. Also drop the
header row that the secfoo-com#209 merge duplicated in docs/agents.md, and say
'remove the entry, then run sync again' for key rotation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.

2 participants