Repository navigation
fix(install): the no-op replay never re-decides Claude carriers (#5434) - #5447
Merged
Daniel Meppiel (danielmeppiel) merged 6 commits intoNov 25, 2026
Merged
Conversation
The full run reads the root AGENTS.md / CLAUDE.md and every compiled AGENTS.md the compile record names (with its directory's CLAUDE.md) to decide whether a Claude rule is carried. The verdict record did not key them, so a changed carrier replayed 'up to date'. One owner, agents_md_compile_record.carrier_inputs, lists them; compiled_agents_md_may_carry shares its root names. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Per the approved scope, the replay declines and the writer records no replayable output while compiled_agents_md_may_carry holds; its body moves to the light core/agents_md_compile_record.may_carry so the replay asks it without importing the compiler. Nested carriers (W3d): a run whose Claude target had a routable instruction (static routes_to_agents_md) records nothing, and the engine fast path declines when a locked package ships one. Replaces the carrier-keying commit, which the scope put out of scope. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
requested a review
from Sergio Sisternes (sergio-sisternes-epam)
as a code owner
November 25, 2026 07:20
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
apm-spec-waiver: correctness fix, no spec surface change (#5434) Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A missing package copy can pass routing checks and later be restored from the git cache while leaving a required Claude rule absent from the locked layout.
2 open issues
What changed in this PR
This PR addresses #5434 by making install optimizations fall back to the full pipeline when Claude instruction placement may depend on changed AGENTS.md or CLAUDE.md files.
Changes:
- Centralizes carrier detection for the compiler, replay reader, and record writer.
- Prevents replay recording and engine fast-path execution when routable Claude instructions require live carrier checks.
- Adds regression coverage, a lifecycle bug record, and a changelog entry.
| File | Description |
|---|---|
| tests/integration/test_verdict_record.py | Tests carrier changes, routing refusals, and replay controls. |
| tests/integration/test_verdict_record_attested_world.py | Adds a real-CLI comparison with the full install pipeline. |
| tests/fixtures/lifecycle_bug_ledger/bugs/5434.json | Records the failure mode and regression tests. |
| src/apm_cli/integration/instruction_integrator.py | Prevents recording runs with potentially routable Claude instructions. |
| src/apm_cli/install/verdict_write.py | Avoids recording replayable output when carriers may apply. |
| src/apm_cli/install/verdict_record.py | Rejects output replay when carriers may apply. |
| src/apm_cli/install/diff_apply.py | Extends engine refusal to locked routable instructions. |
| src/apm_cli/core/agents_md_compile_record.py | Provides the shared carrier-presence predicate. |
| src/apm_cli/compilation/claude_agents_md.py | Delegates carrier detection and inspects locked instructions. |
| changelog.d/5447.fixed.md | Documents the user-visible replay fix. |
Review effort: Balanced
The engine can restore a missing copy from the git cache, so its instructions are unknown when the predicate runs: decline. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The new engine refusal disables the engine even without an existing carrier and falls outside the explicit human scope approval, requiring amended approval or removal from this PR.
1 open issue
2 resolved since last review
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Daniel Meppiel (danielmeppiel)
deleted the
danielmeppiel-replay-carriers
branch
November 25, 2026 08:29
Daniel Meppiel (danielmeppiel)
added a commit
that referenced
this pull request
Nov 25, 2026
…d-root refusal apm-spec-waiver: no-op fast-path input keying fix; install outcomes are unchanged Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
5 of 10 tasks
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
829caf72e52011e0539b8b0b6519fb396cc7f7ae↑ The real-CLI cell (tree-10-claude) shows the replay hit on main and a miss here, printing what
APM_INSTALL_FAST_PATH=0prints.↑ Only decline paths are added; the no-carrier control and the #5394 attested-refusal cell stay green.
↓ W3d ACCEPT at 3bd9908; later folds: a missing package copy counts as routable (Copilot) and the one-owner cell observes the replay (AQ003); QL ruled the engine decline in scope; full CI and Copilot at this head pending.
src/test/AGENTS.mdescaped both (W3d RT1 cells).Description
The verified no-op replay (#5383) printed "up to date" after a Claude carrier changed. The full run reads the root
AGENTS.md/CLAUDE.md, the compile record in APM home, and a directory'sAGENTS.mdfor a routable instruction to decide whether a.claude/rules/file is written or retired.The fix follows the approved scope: only decline paths are added.
compiled_agents_md_may_carrymoves tocore/agents_md_compile_record.may_carry(the record exists, or a root carrier does); the compilation function delegates to it. The replay (verdict_record._verified_stdout) declines and the writer (verdict_write._record_after) records no replayable output while it holds. Cost per replay: 2 lstat and one read of the home record, with no compiler import.verdict_record.unknown("claude routing")ininstruction_integrator._claude_rule_sources. Routable means always-on or one literal directory, using the staticroutes_to_agents_mdwith no root, so an instruction whose directory does not exist yet counts. A record therefore exists only for a state with no routable instruction, and instructions come only from keyed inputs. So no carrier anywhere can change that run's outcome, and the hit stays sound.diff_apply._refuse_claude_carried_rulesalso declines when a locked package ships a routable instruction (claude_agents_md.lock_ships_routable_instruction, through the integrator's own discovery and frontmatter parser; an unreadable file counts). This check runs before the attested branch, so attested hits are covered too.Rejected alternative: a whole-tree scan for AGENTS.md on every replay has unbounded cost in monorepos, and it declines states the carrier cannot change.
Cost: projects with a root carrier, a compile record or a routable Claude instruction lose the replay and the engine fast path. The perf-fixture instructions are path-scoped (
**/*.lang), so the benches are unaffected. Keying the routed prefixes to win this back is logged for 0.40.Issue and approved scope
Issue: Fixes #5434
Human scope-approval comment: #5434 (comment), amended for the nested-carrier and engine fast-path declines: #5434 (comment). The nested-carrier extension was requested by W3d (RT1 cells, run 45565931975) and QL v2, and W3d accepted the design with the static-routability change.
Does this PR complete the issue, or what remains? Yes.
Type of change
Testing
Evidence (CI, scratch workflow on each side; neither scratch branch is merged):
pytest tests/integration/test_verdict_record.py tests/integration/test_verdict_record_attested_world.py -k "carrier or routing or routable or root_agents_md or control_with_no or compile_record_appearing or claude"[i] verdict record: hit.ruff check/ruff format(pinned 0.15.12) on the changed files: clean.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)