You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ci: real-harness lane proving Claude Code and Copilot CLI load native plugins - #5201
Adds a non-required Real Harness lane. It proves that pinned Claude Code and Copilot CLI releases actually load a plugin apm installs natively, not only that apm wrote the files. A fixture plugin (one skill, a SessionStart hook writing a marker, a stdio MCP server logging every JSON-RPC method) is installed with the apm built from the SHA. Then each harness is checked with evidence other than model output:
Claude Code: the claude -p --output-format stream-json init event (plugins, skills, MCP servers), the hook marker, and the MCP initialize/tools/list log. It never reaches a model (ANTHROPIC_BASE_URL is a closed local port), and the TUI runs in tmux.
Copilot CLI: copilot plugin|skill|mcp list, the hook and MCP markers, and on schedule/dispatch one cheap model turn that calls the plugin's MCP tool.
Cells are harness x environment {TUI, git worktree, -p} x scope {user, project}, plus Claude diagnostic cells: second session, absolute path, no folder trust, native claude plugin install, and two worktree-branch cells. The pins are Claude Code 2.1.326 and 2.1.323, and Copilot CLI 1.0.106, 1.0.113 and 1.0.114-0. COPILOT_AUTO_UPDATE=false keeps Copilot on its pinned version.
scripts/real_harness/expected.json records each cell's expected verdict, including the known bugs #5176 and #5180. The last step, probe.py check, fails on any divergence. BLOCKED (missing credential, rate limit) never fails. The #5176/#5180 fix PR flips its cells to LOADS.
Trust model: contents: read, every action pinned by SHA, persist-credentials: false, no cache saved, no pull_request_target.
Copilot token (W3d R1): the environment secret REAL_HARNESS_COPILOT_TOKEN of a GitHub environment real-harness. Copilot jobs enter that environment only for schedule and workflow_dispatch on main. Pull requests, and dispatches of another branch's workflow, get no token; their Copilot session cells report BLOCKED.
Harness pins (R2):npm ci from scripts/real_harness/npm/<harness>-<version>/package-lock.json, which pins sha512 integrity for every package, the per-platform binary included. Before install, the step also fails unless npm view <pkg>@<ver> dist.integrity equals the pinned value.
Lockfile regeneration (ab0117a): the pins were rewritten by npm 10.9.9, the npm bundled with the pinned Node 22.23.5. The job fails fast unless node --version is v22.23.5 and npm --version is 10.9.9. Integrity continuity against the first lockfiles (85f82cd): every package present in both has the same sha512; only version-less stubs for unpublished platform packages dropped.
Pin
Packages in both
Same sha512
Changed
Dropped (old only)
Added (new only)
claude-2.1.326
9
9
none
none
none
claude-2.1.323
9
9
none
none
none
copilot-1.0.106
10
10
none
none
none
copilot-1.0.113
8
8
none
copilot-linuxmusl-arm64 (stub, no integrity), copilot-linuxmusl-x64 (stub, no integrity)
none
copilot-1.0.114-0
4
4
none
copilot-darwin-arm64 (stub, no integrity), copilot-darwin-x64 (stub, no integrity), copilot-linux-arm64 (stub, no integrity), copilot-linuxmusl-arm64 (stub, no integrity), copilot-linuxmusl-x64 (stub, no integrity), copilot-win32-arm64 (stub, no integrity)
none
Artifacts and summary (R3, F1, F2): the uploaded evidence is staged into one directory and scanned with probe.py scan before upload; a hit fails the job and nothing is uploaded. The public step summary is built from each cell.json verdict and reason only, and is scanned before it is written. The scan matches the token raw and base64-encoded (bare and as x-access-token:<token>) at all three byte alignments, so a prefix such as Bearer or <user>: cannot hide it, and also matches the base64 needles with line breaks removed (wrapped base64). ~/.copilot/config.json is never uploaded.
Token scope (R1'):COPILOT_TOKEN is set only on the probe step (which runs the harness) and on the summary and staging steps (which only scan with it). npm ci and uv sync never see it; Copilot pins install with --ignore-scripts.
Not a required check:gh api repos/microsoft/apm/rules/branches/main lists one required_status_checks rule, [{"context":"gate","integration_id":15368}]. Classic branch protection is not configured (gh api repos/microsoft/apm/branches/main/protection returns 404), and merge-gate.ymlEXPECTED_CHECKS names no Real Harness check.
Admin setup required (not doable from a PR):
Settings > Environments > New environment real-harness.
Deployment branches and tags: Selected branches and tags, rule main only.
Does this PR complete the issue, or what remains? It delivers the lane. #5197 is done when the nightly is green and the PR lane catches the #5176/#5180 fix (that PR flips expected.json).
Code-owner: authored under the owner's account; landing requires the owner's explicit admin authorization on this PR.
The full test suite was not run locally (shared host); CI runs it.
Changelog
One fragment per section, changelog.d/<pr>.<section>.md, holding
one line: user-visible effect first, 25 words or fewer, ending with (#PR); breaking changes only under upgrade notes; no Highlights; no
new lines under ## [Unreleased]. See changelog.d/README.md and .github/instructions/changelog.instructions.md.
… plugins
Adds .github/workflows/real-harness.yml (nightly, dispatch, path-filtered
pull_request; not required) and scripts/real_harness/probe.py. Pinned harness
releases load a fixture plugin installed by the apm built from the SHA; the
lane asserts the hook fires, the MCP server handshakes and the skill is listed.
expected.json is a red-first oracle: #5176 and #5180 cells are expected to
fail until their fix flips them.
Refs #5197
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Installation failures can be misclassified as exempt blockers and leave broken runs green, while harness packages lack the required integrity verification.
Adds a non-required Real Harness CI lane to verify that Claude Code and Copilot CLI load native plugins installed by APM, complementing existing file-deployment tests and tracking regressions from #5176 and #5180.
Changes:
Runs pinned harness versions across terminal, worktree, and headless environments at user and project scope.
Collects plugin-loading evidence and compares cell verdicts against committed expectations.
Adds verdict-gate tests and documents scheduling, credentials, and expected-result handling.
File
Description
tests/unit/scripts/test_real_harness_check.py
Tests verdict comparisons and expectation validity.
scripts/real_harness/probe.py
Creates fixtures, runs harnesses, collects evidence, and checks verdicts.
scripts/real_harness/expected.json
Records expected outcomes, including known plugin-loading bugs.
…, evidence scan, polling
- Pin each harness with a committed npm lockfile (sha512 for every package,
platform binary included) and check the registry integrity before npm ci.
- The Copilot token is the real-harness environment secret, entered only on
schedule and dispatch on main; evidence is staged and scanned before upload.
- A failed apm install is ERROR, never exempt; MCP tools/list is required;
Claude TUI cells assert the skill in the slash-command menu; the Agent
Plugin MCP server runs the deployed copy and the source is removed.
- Marker polling replaces fixed sleeps.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The probe gate can pass with absent or incomplete cell results, allowing missing evidence to produce a green result instead of an error.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Reject missing probe evidence instead of passing the gate
scripts/real_harness/probe.py:733
The gate returns success when there are no cell.json files, and also when an expected cell is absent but the remaining cells match. This lets skipped or missing probe evidence produce a green result rather than an error; missing evidence is not a credential-related BLOCKED result. Pass the job's selected harness/cell set into check() and reject missing results, while still permitting explicit BLOCKED cells.
npm ci on the runner rejected the version-less stub entries that npm 11 writes
for Copilot's unpublished musl binaries.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The artifact scan can miss symlinked token files that the uploader includes, risking credential exposure, while harness checks can pass without required tool-use or run evidence.
No open issues 🎉
3 previously missed issues
In code that hasn't changed since last review
Scan symlink targets and fail on scan errors
.github/workflows/real-harness.yml:166
cp -r preserves symlinks, but grep -r skips links encountered during traversal while the pinned uploader follows them. A staged link to a token-containing file can therefore pass this scan and expose the token in the artifact. Follow symlink targets during scanning and reject scan errors rather than treating them as a clean result.
Require MCP tool-call evidence for Copilot LOADS
scripts/real_harness/probe.py:645
An authenticated Copilot session can finish or time out without calling the requested MCP tool and still receive LOADS, because the verdict requires only startup and skill-list evidence. Require the recorded mcp_tool_called signal for Copilot LOADS so a failed tool-use probe cannot pass, while retaining credential/rate-limit BLOCKED handling.
Reject empty harness result sets
scripts/real_harness/probe.py:733
If the output directory is missing or contains no cell.json files, this loop performs no comparisons and check returns an empty problem list, so the CLI exits successfully without any harness evidence. Reject an empty result set before comparing verdicts; an absent run is not one of the explicit BLOCKED exemptions.
…and base64
- COPILOT_TOKEN moves from job env to the probe, summary and staging steps;
npm ci runs with --ignore-scripts for Copilot pins.
- The public step summary is built from cell.json verdicts only and scanned
before it is written.
- probe.py scan matches the token raw and base64-encoded (bare and as an
x-access-token pair); unit-tested.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because the gate can overlook missing coverage and new failures in known-bug cells, while the tests leave verdict classification unverified.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because missing cell results and Claude sessions without initialization can pass the gate without establishing intended coverage or valid runtime observations.
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
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.
Description
Adds a non-required Real Harness lane. It proves that pinned Claude Code and Copilot CLI releases actually load a plugin apm installs natively, not only that apm wrote the files. A fixture plugin (one skill, a SessionStart hook writing a marker, a stdio MCP server logging every JSON-RPC method) is installed with the apm built from the SHA. Then each harness is checked with evidence other than model output:
claude -p --output-format stream-jsoninit event (plugins, skills, MCP servers), the hook marker, and the MCPinitialize/tools/listlog. It never reaches a model (ANTHROPIC_BASE_URLis a closed local port), and the TUI runs in tmux.copilot plugin|skill|mcp list, the hook and MCP markers, and on schedule/dispatch one cheap model turn that calls the plugin's MCP tool.Cells are harness x environment {TUI, git worktree,
-p} x scope {user, project}, plus Claude diagnostic cells: second session, absolute path, no folder trust, nativeclaude plugin install, and two worktree-branch cells. The pins are Claude Code 2.1.326 and 2.1.323, and Copilot CLI 1.0.106, 1.0.113 and 1.0.114-0.COPILOT_AUTO_UPDATE=falsekeeps Copilot on its pinned version.scripts/real_harness/expected.jsonrecords each cell's expected verdict, including the known bugs #5176 and #5180. The last step,probe.py check, fails on any divergence. BLOCKED (missing credential, rate limit) never fails. The #5176/#5180 fix PR flips its cells to LOADS.Trust model:
contents: read, every action pinned by SHA,persist-credentials: false, no cache saved, nopull_request_target.REAL_HARNESS_COPILOT_TOKENof a GitHub environmentreal-harness. Copilot jobs enter that environment only forscheduleandworkflow_dispatchonmain. Pull requests, and dispatches of another branch's workflow, get no token; their Copilot session cells report BLOCKED.npm cifromscripts/real_harness/npm/<harness>-<version>/package-lock.json, which pins sha512 integrity for every package, the per-platform binary included. Before install, the step also fails unlessnpm view <pkg>@<ver> dist.integrityequals the pinned value.node --versionis v22.23.5 andnpm --versionis 10.9.9. Integrity continuity against the first lockfiles (85f82cd): every package present in both has the same sha512; only version-less stubs for unpublished platform packages dropped.probe.py scanbefore upload; a hit fails the job and nothing is uploaded. The public step summary is built from eachcell.jsonverdict and reason only, and is scanned before it is written. The scan matches the token raw and base64-encoded (bare and asx-access-token:<token>) at all three byte alignments, so a prefix such asBeareror<user>:cannot hide it, and also matches the base64 needles with line breaks removed (wrapped base64).~/.copilot/config.jsonis never uploaded.COPILOT_TOKENis set only on the probe step (which runs the harness) and on the summary and staging steps (which only scan with it).npm cianduv syncnever see it; Copilot pins install with--ignore-scripts.gh api repos/microsoft/apm/rules/branches/mainlists onerequired_status_checksrule,[{"context":"gate","integration_id":15368}]. Classic branch protection is not configured (gh api repos/microsoft/apm/branches/main/protectionreturns 404), andmerge-gate.ymlEXPECTED_CHECKSnames no Real Harness check.Admin setup required (not doable from a PR):
real-harness.mainonly.REAL_HARNESS_COPILOT_TOKEN: a fine-grained token of a dedicated bot account with a Copilot seat, with no repository permissions beyond what Copilot CLI needs (tracked in [FEATURE] Dedicated Copilot token for the real-harness lane #5202).Until this exists, nightly Copilot session cells report BLOCKED; nothing fails.
Issue and approved scope
Issue: Refs #5197
Human scope-approval comment: #5197 (comment)
Does this PR complete the issue, or what remains? It delivers the lane. #5197 is done when the nightly is green and the PR lane catches the #5176/#5180 fix (that PR flips
expected.json).Code-owner: authored under the owner's account; landing requires the owner's explicit admin authorization on this PR.
Type of change
Testing
Validation evidence:
pytest tests/unit/scripts/test_real_harness_check.py -p no:xdist: 4 passed (local).uvx [email protected] checkandformat --checkonscripts/real_harnessand the new test: passed.python -m apm_cli.cli audit --ci(the APM Self-Check command): 15/15 passed.python -m tests.quality.taxonomy --changed:[+] tm006: 1 changed test module(s) carry their marker and promise.checkgate passing against thisexpected.json).Changelog
changelog.d/<pr>.<section>.md, holdingone line: user-visible effect first, 25 words or fewer, ending with
(#PR); breaking changes only under upgrade notes; no Highlights; nonew lines under
## [Unreleased]. Seechangelog.d/README.mdand.github/instructions/changelog.instructions.md.Spec conformance (OpenAPM v0.1)
If this PR changes behaviour that an OpenAPM v0.1
req-XXXcovers,confirm the three-step ritual in the
development guide:
docs/src/content/docs/specs/openapm-v0.1.mdupdated(new/changed
<a id="req-XXX"></a>anchor + prose + Appendix Crow).
docs/src/content/docs/specs/manifests/openapm-v0.1.requirements.ymlupdated.
@pytest.mark.req("req-XXX")test undertests/spec_conformance/added or extended.CONFORMANCE.{md,json}regenerated viauv run --extra dev python -m tests.spec_conformance.gen_statementand committed.