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
fix(run): apply the org dependency policy to auto-install and installed prompts - #4734
Stacked on #4724: review only the top commit; this branch merges main after #4724 lands.
apm run and apm preview read prompt and skill files from installed packages without consulting org dependency policy. apm run <owner/repo/path> also auto-installed a virtual package (download plus an apm.yml entry) without the policy check install applies.
ScriptRunner._require_dependency_policy (core/script_runner.py) now judges:
the package that owns a prompt or skill being read, whether it sits under apm_modules or is a deployed file the lock records for that package;
a package auto-install is about to fetch, before anything is downloaded or declared.
It covers prompt discovery and _auto_compile_prompts, which both run and preview use.
Under enforcement: block it refuses with each package's reason and the catalog remediation (run-dependency-denied) before compiling or downloading anything. Under warn it warns and continues.
The installed-package enumeration moves next to the dependency check, as installed_dependency_subjects in install/exec_gate.py, so compile and run judge the same set.
Issue and approved scope
Issue: none; scope set by the maintainers. Maintainer ruling: every command that writes or reads agent context through installed packages applies the dependency policy.
Human scope-approval comment: approved by the maintainers.
Does this PR complete the issue, or what remains? It completes the run/preview surface; #4724 covers compile.
a denied package's prompt, under apm_modules or as a deployed copy, is never compiled;
a project's own prompt compiles without resolving policy;
auto-install refuses before the downloader is called;
warn compiles and warns.
Four of these fail without the change.
Local results:
core, script runner and commands unit tests: 3842 passed;
runnable-prompt and script-runner integration tests: 254 passed;
lint contract: green.
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.
…led content
apm compile now applies the dependency check install, update and uninstall
apply to the packages apm.lock.yaml records, routed through the trust
policy owner. When a recorded package is no longer allowed and the policy
enforces block, compile writes nothing and exits 1 naming the package;
under warn it warns and compiles.
Co-authored-by: Copilot App <[email protected]>
…g dependency policy
Covers apm compile -g, manifest dependencies installed without a lock row,
local bundle staging, the redirected root of --root, and each --watch
recompile. The lifecycle model now expects compile to refuse, as install
does, under a dependency deny and when the org policy cannot be fetched
under fetch_failure_default: block.
Co-authored-by: Copilot App <[email protected]>
…ed prompts
apm run and apm preview now judge the package that owns a prompt or skill
they read (under apm_modules, or a deployed file the lock records) and any
package auto-install is about to download, with the dependency check
install applies. Under enforcement: block they refuse before compiling or
downloading anything; under warn they warn and continue. The installed
package enumeration moves beside that check so compile and run share it.
Co-authored-by: Copilot App <[email protected]>
apm-spec-waiver: applies the existing org dependency policy check to apm run and apm preview; no new contract.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Two critical policy bypasses remain: command tokens are checked instead of resolved prompt files, and undeclared dependency content can be discovered and executed without an attributable policy subject.
Extends the dependency-policy enforcement from #4724 to apm run and apm preview, checking installed package content and virtual-package auto-installation.
Changes:
Adds dependency-policy checks before prompt compilation and automatic downloads, with block and warn handling.
Shares installed-package enumeration between compile and run.
Adds regression tests, remediation text, and a changelog entry; the supplied diff also includes the compile-policy base changes.
…lved marketplace entries
Move the installed-package enumeration compile, run and preview share into
install/installed_dependencies.py, and skip a declared marketplace entry
before computing its install path (the lock names it once installed).
Co-authored-by: Copilot App <[email protected]>
A short prompt name resolves under .github/prompts, .apm/prompts or an
installed package; check that file's owning package, compare paths
case-insensitively, and cover the resolved forms in tests.
Co-authored-by: Copilot App <[email protected]>
…scripts
With --root the renderer combines the source manifest with the redirected
installation, so a package declared in one root and installed in the other
is judged too. Packages a pre-compile script installs are judged before
rendering. Re-anchor the compile citations the rules cite.
Co-authored-by: Copilot App <[email protected]>
… the lock's effective source
Right before rendering, under the lifecycle lock, compile judges the current
installed inventory again, whether or not pre-compile scripts ran, so a
package installed while it waited, or a source swapped under an existing
key, is judged. A warning is reported once per command. A declared entry
never replaces the lock's effective (replace:) source for the same key.
Co-authored-by: Copilot App <[email protected]>
The recheck under the lock re-reads the installed inventory with the policy
the early check resolved, so the policy outcome line prints once.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical policy bypasses allow run to consume undeclared filesystem packages and run/preview to forward installed SKILL.md content without checking whether the owning package is denied.
A watch session keeps one logger; reset the per-compilation policy cache
before each recompile so an allow-to-deny change stops the next render.
Co-authored-by: Copilot App <[email protected]>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Legacy directory ownership claims fail to match descendant prompts, allowing deployed copies outside the package root to bypass policy resolution and compile even when their recorded owner is blocked.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Apply block checks to legacy deployed-skill descendants
src/apm_cli/core/script_runner.py:841
Legacy deployed_skills entries become directory claims such as .github/skills/review/ (deps/lockfile.py:733-738), but exact-set intersection never matches a prompt below them. For a deployed copy outside the package root, run/preview therefore skip policy resolution and compile it even when its recorded owner is denied under block. Use shared ownership matching for directory descendants as well as exact files, and add a legacy-lock regression.
Generator rules cited product source as path:line (Ev(path, line, needle)
plus prose comments). A line moves on every edit to the cited file, so two
unrelated PRs that refresh it conflict in a merge train, and anchors drift.
Evidence now names a symbol: path::qualname for Python (function, class or
method with its decorators, or a module-level assignment) and path::heading
for Markdown (code fences ignored; a fence closes only with nothing after it),
resolved in tests/lifecycle/generator/anchors.py; the needle must appear
inside that symbol's span.
test_every_rule_cites_a_symbol_that_still_says_it rejects any file:line
citation in the generator sources and in the ledger's rule evidence. All 88
anchors on main (including #4711's and #4734's) were converted mechanically:
needle located, innermost enclosing symbol taken. Obligation statuses are
unchanged.
Fixes#4696
Co-authored-by: Copilot App <[email protected]>
Conflicts: tests/lifecycle/generator/rules.py (#4734aa085d6 re-anchored the
U-BIN cites) and the generated tests/quality/lifecycle_obligations.json. Kept
#4559's rules.py, re-anchored every cite to the merged tree, regenerated.
Co-authored-by: Copilot App <[email protected]>
Generator rules cited product source as path:line (Ev(path, line, needle)
plus prose comments). A line moves on every edit to the cited file, so two
unrelated PRs that refresh it conflict in a merge train, and anchors drift.
Evidence now names a symbol: path::qualname for Python (function, class or
method with its decorators, or a module-level assignment) and path::heading
for Markdown (code fences ignored; a fence closes only with nothing after it),
resolved in tests/lifecycle/generator/anchors.py; the needle must appear
inside that symbol's span.
test_every_rule_cites_a_symbol_that_still_says_it rejects any file:line
citation in the generator sources and in the ledger's rule evidence. All 88
anchors on main (including #4711's and #4734's) were converted mechanically:
needle located, innermost enclosing symbol taken. Obligation statuses are
unchanged.
Fixes#4696
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (51e2e65, main f53aa79). Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- strict known cells for an MCP entry of a runtime no longer targeted (#4784)
and a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Ledger regenerated (baseline 3, known-failing 1, required 2419).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (2e8592d, main acb0423). Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- strict known cells for an MCP entry of a runtime no longer targeted (#4784)
and a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Ledger regenerated (baseline 3, known-failing 1, required 2419).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (2e8592d) and merged with main fc1866b. Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- an MCP entry of a runtime no longer targeted (#4784) takes main's required
row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Ledger regenerated (baseline 3, known-failing 1, required 2419).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- an MCP entry of a runtime no longer targeted (#4784) takes main's required
row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Review folds: I5 admits the compile record only as a regular file and its
newly created ancestor directories; run/preview, content-types, plugin-root
hook, lane C fresh twin and source-machine bundle identity oracles tightened.
Ledger regenerated (baseline 3, known-failing 1, required 2419).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- an MCP entry of a runtime no longer targeted (#4784) takes main's required
row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Review folds: I5 admits the compile record only as a regular file and its
newly created ancestor directories; run/preview, content-types, plugin-root
hook, lane C fresh twin, source-machine bundle identity, self_defined warn and
hook bundle update oracles tightened. U-USER-SCOPE-ORG-POLICY removes explicit
user-scope cells only: the four scope-free T1 bin x denied-dependency cells are
required, witnessed by the project matrix refusals.
Ledger regenerated (baseline 3, known-failing 1, required 2423).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- an MCP entry of a runtime no longer targeted (#4784) takes main's required
row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Review folds: I5 admits the compile record only as a regular file and its
newly created ancestor directories; run/preview, content-types, plugin-root
hook, lane C fresh twin, source-machine bundle identity, self_defined warn and
hook bundle update oracles tightened; the self_defined warn row is a real
warn-mode policy now and is strict known on #5070. U-USER-SCOPE-ORG-POLICY removes explicit
user-scope cells only: the four scope-free T1 bin x denied-dependency cells are
required, witnessed by the project matrix refusals.
Ledger regenerated (baseline 3, known-failing 1, required 2423).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- an MCP entry of a runtime no longer targeted (#4784) takes main's required
row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Review folds: I5 admits the compile record only as a regular file and its
newly created ancestor directories; run/preview, content-types, plugin-root
hook, lane C fresh twin, source-machine bundle identity, self_defined warn and
hook bundle update oracles tightened; the self_defined warn row is a real
warn-mode policy now and is strict known on #5070; the #4826 refusal row checks rollback. U-USER-SCOPE-ORG-POLICY removes explicit
user-scope cells only: the four scope-free T1 bin x denied-dependency cells are
required, witnessed by the project matrix refusals.
Ledger regenerated (baseline 3, known-failing 1, required 2423).
Co-authored-by: Copilot App <[email protected]>
…C, v0.38 sweep)
Stacked on corpus train 6 (699e837) and merged with main fc1866b. Cars:
- policy promise rows in test_policy_promises.py with a control each (scripts
deny, self_defined, max_depth, require_resolution, source_attribution,
unmanaged_files, fail_on_drift, pinned constraint, explicit includes,
transitive MCP trust, content types); the #4826 install refusal is required
now that #4853 fixed it on main.
- an MCP entry of a runtime no longer targeted (#4784) takes main's required
row (its fix landed); a strict known cell for a codex hook copy that cannot read its plugin's skill (#2824).
- lane C incremental deploy differential (kit from #4849).
- v0.38.0 sweep: compile dependency-policy run and preview (#4734), a converged
install writes nothing (#4790), hook bundle approval pin (#4688), a registry
URL on a local host (#4521).
- burndown: a denied local bundle is refused unwritten (#4646), present-
provenance-unknown x denied-executable (#4767), audit --ci judges locked
content with apm_modules gone, merged-hook entry detection end to end (#4798).
Review folds: I5 admits the compile record only as a regular file and its
newly created ancestor directories; run/preview, content-types, plugin-root
hook, lane C fresh twin, source-machine bundle identity, self_defined warn and
hook bundle update oracles tightened; the self_defined warn row is a real
warn-mode policy now and is strict known on #5070; the #4826 refusal row checks rollback; no-write stamps add the POSIX change time. U-USER-SCOPE-ORG-POLICY removes explicit
user-scope cells only: the four scope-free T1 bin x denied-dependency cells are
required, witnessed by the project matrix refusals.
Ledger regenerated (baseline 3, known-failing 1, required 2423).
Co-authored-by: Copilot App <[email protected]>
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.
Description
Stacked on #4724: review only the top commit; this branch merges main after #4724 lands.
apm runandapm previewread prompt and skill files from installed packages without consulting org dependency policy.apm run <owner/repo/path>also auto-installed a virtual package (download plus an apm.yml entry) without the policy check install applies.ScriptRunner._require_dependency_policy(core/script_runner.py) now judges:apm_modulesor is a deployed file the lock records for that package;It covers prompt discovery and
_auto_compile_prompts, which bothrunandpreviewuse.Under
enforcement: blockit refuses with each package's reason and the catalog remediation (run-dependency-denied) before compiling or downloading anything. Underwarnit warns and continues.The installed-package enumeration moves next to the dependency check, as
installed_dependency_subjectsininstall/exec_gate.py, so compile and run judge the same set.Issue and approved scope
Issue: none; scope set by the maintainers. Maintainer ruling: every command that writes or reads agent context through installed packages applies the dependency policy.
Human scope-approval comment: approved by the maintainers.
Does this PR complete the issue, or what remains? It completes the run/preview surface; #4724 covers compile.
Type of change
Testing
tests/unit/test_script_runner_dependency_policy.pycovers:apm_modulesor as a deployed copy, is never compiled;warncompiles and warns.Four of these fail without the change.
Local results:
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)
apm-spec-waiver: applies the existing org dependency policy check to apm run and apm preview; no new contract.