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
perf(install): a converged install attests its state, so the next unchanged install skips the proof - #5383
↑ W3d ACCEPT at every head through ddd81de, and Copilot has 0 open threads at ddd81de. ↑ Red-first cells cover ordering after #5394, executable gates (positive controls), wrapped and unprefixed warnings, and a frozen retained orphan; the real-CLI differential matches the full pipeline. ↑ Local verdict, world, invariants and quality suites pass; the lint chain is clean. ↓ Linux warm +1.4-1.9% CPU, attributed by profile to the attestation writer. ↓ Full CI and QL H8 at ddd81de were pending when assessed.
Performance gain
8/10
↑ First re-install noop #2 reads 0.547 and 0.552 on Linux (tree-50); earlier reads were 0.431 on Windows and 0.504 on macOS. ↓ Warm cost as disclosed.
Description
Today a user's first unchanged apm install after an install pays the full no-op proof: about 2.1 s Linux and 4.4 s Windows CPU at tree-50. Only the third run replays the verified-state record (#4993, 0.30 s). The record is written only by a run the engine proved a no-op. This PR lets a successful, converged full install attest the state it committed, so the next unchanged install skips the proof.
Writer. At the end of a full apm install / apm install --frozen that succeeded, the record module writes an attested record. It holds no output, and it is written under the lifecycle lock over exactly the lock bytes the install committed (W3d A6). The key is the same HMAC over every live verdict input that perf(install): a no-op install replays the last verified no-op from an authenticated record #4993 uses: manifest, lock, governed listings, APM_HOME, policy cache, git config, allowlisted environment and run-read names. It also includes the build identity (A3). Nothing is attested when:
the target set announced by the run differs from a fresh resolution at its end (A1);
any warning or error line the run printed is outside the allowlist of notices the hit re-judges live, such as parked MCP servers (A2 allowlist; a kept copy, a skipped file or a retained snapshot blocks);
lifecycle scripts are declared (A4);
the lock cannot be proved.
Hit.diff_apply.try_apply runs every gate that precedes planning, as today: eligibility, policy discovery and target policy, the source scan and scope. It then checks the attested record. The check recomputes the HMAC from live inputs at the run's entry state, then re-hashes every deployed file and package copy no-follow, exactly as a replay hit does (A7). It still runs the lifecycle-script, executable and policy-check refusals. It then renders the no-op through the proven no-op's own path: _commit with an empty diff, then fast_output.render, so the policy gate and MCP/LSP services run live inside the apply journal. Any miss or doubt falls through to today's proof.
Provenance never upgrades (A5). A replay never reads an attested record. The output record a matched run writes says provenance: attested.
Equivalence
A proof of an unchanged install answers: does planning find any file or package to change, and do the gates admit the state? An attested hit answers the same question without planning:
Planning would find nothing. Run 1's committed state is the planner's fixed point (I2). The deployed bytes and package copies are not trusted from run 1: they are re-hashed against the HMAC'd lock on every hit. Any input the planner reads is in the HMAC, so a changed manifest, lock, governed file, planted link, approval, policy cache or environment misses.
The gates admit it. Every gate that re-judges a run still runs on the hit, in the same order as the proof.
The output is the proof's output by construction. The hit prints through the same renderer the proven no-op uses. Services and their notices are re-judged live. This is why only those notices may pass A2.
Human scope-approval comment: the #4939 install-performance scope; record-at-install accepted by the PERF VP and the regent (2026-11-24 19:38) and by W3d (attested-record ruling A1-A8, scope amendment).
Does this PR complete the issue, or what remains? No. Rendering the no-op output at install #1, so that install #2 is a byte replay, remains a follow-up.
Type of change
Bug fix
New feature
Documentation
Maintenance / refactor
Testing
Tested locally (guarded: tests/integration/test_verdict_record.py, test_verdict_record_attested_world.py, tests/unit/install/test_architecture_invariants.py, tests/unit/install/test_diff_apply.py, tests/unit/test_update_notice.py, tests/unit/test_console_utils.py, tests/quality/test_quality_baselines.py -> all passed at ddd81de; ruff, architecture linter, complexity ratchet, R0801, assertion-quality, tm006 and auth-signal checks clean)
All existing tests pass (CI on this PR)
Added tests for new functionality (if applicable)
Cells:
tests/integration/test_verdict_record.py:
attested, then hit, with no byte replay (A5);
every input changed after run 1 never hits: manifest, lock, deployed bytes, package copy, unmanaged file, planted link, approvals, policy cache, allowlisted env, lifecycle script;
a widened target set (A1), a deferral warning (A2) and lifecycle scripts (A4) are never attested;
a parked MCP notice still attests;
a lock changed after commit is never attested (A6);
the output recorded after an attested hit stays attested (A5).
tests/integration/test_verdict_record_attested_world.py, real CLI on the tree-10 offline world:
install Integrate copilot runtime #2 is an attested hit, and its stdout equals the full proof's stdout for the same state;
Replay reads "attested hit, recorded" on 12/12 samples on every OS. Spawns and requests are unchanged.
Runs: L 45464326641 / 45466147122, W 45464401759, M 45464458778 / 45466213508.
Disclosure: macOS warm install read 1.022 and 1.048 on two runs (9-pair band 0.987-1.110, shard-dependent). The record path adds one HMAC and one file write at the end of a full install, with no spawn or request change.
The head after bc3512d only moves code verbatim (LOC budget): verdict_write.py and verdict_attest.py.
Merge with fix(claude): keep install-only projects on the 0.37 .claude/rules layout #5394._refuse_claude_carried_rules runs before the attested branch in try_apply. Cell test_a_valid_attestation_never_skips_the_claude_carried_rules_refusal (tree-10-claude plus a root AGENTS.md) is red when the refusal is moved after the attested branch.
First no-op of the day records. A run whose daily update check printed nothing records; a run that printed the new-version notice never does, so the notice stays out of the replay surface.
Fail-safe attestation (Copilot round 3). Every warning or error message _rich_warning/_rich_error printed is judged unwrapped (console.EMITTED, O(1) per call). An unprefixed warning refuses the attestation, and the update notice is caught before any terminal wrap. A frozen install that retains a dependency apm.yml dropped is never attested (the audit's no-orphan baseline), so the next frozen install prints its notice again.
perf: strict no-op fast path for apm install / --frozen (1 s target) #4770 cells. For executable gates, the record's key is the only control, since install re-judges the lock's recorded exec_status. Ten cells, each with a positive control, cover both the output replay and the attested hit: user exec deny, project exec deny, revoked approval, user deny after approval, and org deny_all. A real-CLI differential checks that the attested hit and the output replay print what the full pipeline prints with every fast path off, and that no project byte moves.
Verbatim move.attested_gates and release_attested moved into verdict_attest.py (diff_apply.py LOC budget).
Performance at the re-merge (Linux, tree-50, vs merge-base 1e4a208, paired CPU including children):
Disclosure: Linux warm (fresh-lock) install costs +1.4-1.9% CPU, about 0.1 s at t50.
Three reads: 1.018 [0.958-1.042], 1.019 [0.969-1.036], 1.014 [1.010-1.021].
A profile at ddd81de (run 45521204838) attributes it to the attestation written at the end of every full install, about 0.14 s profiled: the lockfile parsed twice (0.045 + 0.053 s) and the key digest (0.040 s).
An A/B with the writer off read 0.994 [0.970-1.018], inside its noise.
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.
… key the update notice; cells
W3d attested-record ruling: a full install attests only when every warning or
error line it printed is a notice the attested hit re-judges live (parked MCP
servers). An attested record holds no output, so the update-check output guard
does not apply; the update-check file stays keyed and the record expires when
the check falls due. Component cells for A1, A2, A4-A6 and the tamper set; an
end-to-end cell for the hit, the stdout differential and an edited deployed file.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical attestation flaws allow stale records to bypass updated validation and unresolved-file warnings to disappear, while broken integration tests leave the new path unverified.
This PR extends the authenticated install-record mechanism so a successful, converged install can attest its committed state. The next unchanged install can skip planning while still checking live inputs, deployed content, and runtime gates.
Changes:
Adds attested records with provenance tracking and convergence checks.
Routes attested hits through the existing journaled commit and no-op renderer.
Adds invalidation and real-CLI tests, plus a user-facing changelog entry.
File
Description
tests/integration/test_verdict_record.py
Tests attestation eligibility, invalidation, and provenance.
…writes nothing; traces never recorded
The attested record MACs the exact lock bytes and the build, which passed the
lockfile-generator gate when they were committed, so a matching run skips
that gate (it composes the whole lock with the bounded YAML loader). Decide
mode on an attested match reports and returns without writing. Trace lines
are filtered from the stderr a record replays. verdict_attest.py joins the
install-deployment owner; the real-CLI cells are component cells.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Critical attestation flaws let colored warnings evade convergence checks and changed APM code reuse stale records, potentially suppressing unresolved-state diagnostics and bypassing planning and validation.
The attested hit trace is emitted after record authentication, before _attested_gates and the planning bypass execute, so this test still passes if the bypass is removed and the ordinary planner runs. Assert that the attested branch completed, for example by running this scenario in fast-path trace mode and checking no-op (attested record), or by detecting entry into planning/staging. This makes the test protect the optimization rather than only record authentication.
…f verdict_record (LOC budget)
A verbatim move: verdict_write.py holds the writer (_record_locked, _record_after,
_committed_lock, _write_at_entry, _write and the A1/A2 helpers), verdict_attest.py
the attested API (note_run_targets, note_attested_install, attested_state).
Module state stays in verdict_record, which a replay imports alone.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Critical flaws allow colored warnings to evade attestation checks, stale-build records to bypass updated validation, and post-commit output failures to restart installation and potentially repeat service side effects.
ANSI styling can hide warnings from attestation checks
src/apm_cli/install/verdict_write.py:95
On a colored terminal, _Tee captures ANSI styling before [!], so this anchored regex misses skipped-file and retained-state warnings. This allows an unsettled install to be attested, and the next attested hit can suppress its unresolved warning. Strip recognized styling before applying both matchers, fail closed on unrecognized escapes, and add a colored-output regression test.
… styled warnings, release outside the fallback
- The record keys the APM implementation, not only sys.executable: a frozen
binary's own stat, an installed distribution's RECORD, or a source/editable
tree's per-file stat, so changed code at the same version never reuses a record.
- Terminal styling (SGR) is stripped before the A2 allowlist judges a line; any
other escape sequence blocks the attestation.
- An attested no-op releases its held output outside the fallback handlers, so
an output failure after commit exits non-zero and never re-runs the pipeline.
Each with a cell that fails on the previous code.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ackage, and an unreadable tree declines
QL v2 / W3d: size and mtime miss an edit that keeps both; the implementation
identity of a source or editable tree now hashes every package file's content.
Any file that cannot be read raises, so neither a record nor a replay proceeds
(never a version-only key). Installed distributions keep the RECORD hash and
frozen binaries the executable stat.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because successive frozen installs can attest despite retained undeclared packages or obsolete files, then omit retention notices from replayable output.
…es refusal (#5394)
Red-first: with _refuse_claude_carried_rules moved after the attested branch,
install #2 commits the attested no-op (traces: attested hit, recorded); at
this head the fast path declines and the full pipeline re-attests.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…s its verdict
The record refused any run that ran the daily update check, so the first
unchanged install of each day never recorded. With nothing new that run prints
nothing, and so does the next run while the check is fresh; only a run that
printed the new-version notice stays unrecorded. The notice text is one
constant shared by its printer and the record.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…ted record
Verbatim move of _attested_gates and _release_attested from diff_apply.py to
verdict_attest.py (now attested_gates / release_attested; imports stay
function-level): the #5394 merge put diff_apply.py over its 1000-LOC budget.
The call order in try_apply is unchanged; the claude carried-rules refusal
still runs before the attested branch.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
The attestation fast path can bypass the baseline audit gate and suppress retained-dependency notices and unresolved-hook warnings on subsequent installs.
…nts the full run's output (#4770)
W3d R1 / QL: install re-judges the lock's recorded exec_status, so the
record's key is the only control for executable gates. Ten cells, each with a
positive control (run 2 hits first), for both the output replay and the
attested hit: user exec deny (config.json), project exec deny (apm.yml), a
revoked user approval, a user deny after approval, and an org deny_all in the
policy cache. Plus the #4770 differential over the real CLI: the attested hit
and the output replay print what the full pipeline (APM_INSTALL_FAST_PATH=0)
prints, timings aside, and no answer moves a project byte.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Output checks miss wrapped update notices and unprefixed hook warnings, allowing repeated notice replay and attestation of installs with unresolved warnings.
…or a retained orphan
Copilot #5383 round 3 (PERF VP ruling 02:55, fail-safe: refuse, never skip):
- console._rich_warning/_rich_error keep every message they print, unwrapped
(console.EMITTED, O(1) per call). The record clears it at entry only when
console is already loaded (the replay path imports nothing new) and the
writer judges those messages: an unprefixed warning (a hook file with no
entries) refuses the attestation, and the update notice is detected before
any terminal wrap.
- The writer refuses to attest when the audit's no-orphan baseline fails: a
frozen install that retains a dependency apm.yml dropped would otherwise let
the next hit skip its notice.
Red-first on 693df21: the wrapped notice records, the unprefixed warning
attests, and a frozen install retaining an orphan attests. The unit fixture
now declares its locked package (it was an orphan world).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because stale files retained during frozen installs can evade attestation checks and suppress the migration notice on a subsequent install.
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
full-integrationRun the full integration suite (ci-integration.yml) on this PR before merge
2 participants
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.
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
ddd81de152fd3888b8d24aa581d52d9595522872↑ Red-first cells cover ordering after #5394, executable gates (positive controls), wrapped and unprefixed warnings, and a frozen retained orphan; the real-CLI differential matches the full pipeline.
↑ Local verdict, world, invariants and quality suites pass; the lint chain is clean.
↓ Linux warm +1.4-1.9% CPU, attributed by profile to the attestation writer.
↓ Full CI and QL H8 at ddd81de were pending when assessed.
↓ Warm cost as disclosed.
Description
Today a user's first unchanged
apm installafter an install pays the full no-op proof: about 2.1 s Linux and 4.4 s Windows CPU at tree-50. Only the third run replays the verified-state record (#4993, 0.30 s). The record is written only by a run the engine proved a no-op. This PR lets a successful, converged full install attest the state it committed, so the next unchanged install skips the proof.apm install/apm install --frozenthat succeeded, the record module writes an attested record. It holds no output, and it is written under the lifecycle lock over exactly the lock bytes the install committed (W3d A6). The key is the same HMAC over every live verdict input that perf(install): a no-op install replays the last verified no-op from an authenticated record #4993 uses: manifest, lock, governed listings,APM_HOME, policy cache, git config, allowlisted environment and run-read names. It also includes the build identity (A3). Nothing is attested when:diff_apply.try_applyruns every gate that precedes planning, as today: eligibility, policy discovery and target policy, the source scan and scope. It then checks the attested record. The check recomputes the HMAC from live inputs at the run's entry state, then re-hashes every deployed file and package copy no-follow, exactly as a replay hit does (A7). It still runs the lifecycle-script, executable and policy-check refusals. It then renders the no-op through the proven no-op's own path:_commitwith an empty diff, thenfast_output.render, so the policy gate and MCP/LSP services run live inside the apply journal. Any miss or doubt falls through to today's proof.provenance: attested.Equivalence
A proof of an unchanged install answers: does planning find any file or package to change, and do the gates admit the state? An attested hit answers the same question without planning:
Issue and approved scope
Issue: Refs #4939
Human scope-approval comment: the #4939 install-performance scope; record-at-install accepted by the PERF VP and the regent (2026-11-24 19:38) and by W3d (attested-record ruling A1-A8, scope amendment).
Does this PR complete the issue, or what remains? No. Rendering the no-op output at install #1, so that install #2 is a byte replay, remains a follow-up.
Type of change
Testing
Cells:
tests/integration/test_verdict_record.py:tests/integration/test_verdict_record_attested_world.py, real CLI on the tree-10 offline world:Performance at bc3512d against merge-base c0296fa (tree-50, paired CPU including children, 6 pairs; JH's replay harness):
Since the #5394 re-merge (head ddd81de)
_refuse_claude_carried_rulesruns before the attested branch intry_apply. Celltest_a_valid_attestation_never_skips_the_claude_carried_rules_refusal(tree-10-claude plus a root AGENTS.md) is red when the refusal is moved after the attested branch._rich_warning/_rich_errorprinted is judged unwrapped (console.EMITTED, O(1) per call). An unprefixed warning refuses the attestation, and the update notice is caught before any terminal wrap. A frozen install that retains a dependency apm.yml dropped is never attested (the audit's no-orphan baseline), so the next frozen install prints its notice again.attested_gatesandrelease_attestedmoved into verdict_attest.py (diff_apply.py LOC budget).Performance at the re-merge (Linux, tree-50, vs merge-base 1e4a208, paired CPU including children):
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)
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.