Skip to content

refactor(apps): compose the app registry from pipeline owners - #14674

Merged
bolichen97 merged 1 commit into
mainfrom
refactor/i08-app-registry-pipeline
Sep 28, 2026
Merged

bolichen97 merged 1 commit into
mainfrom
refactor/i08-app-registry-pipeline

Conversation

@bolichen97

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Let contributors change one App Store rule (subprocess environment, clone-target policy, caches, registry trust, checkout transport, store listing or install transaction) in the module that owns it, with every App Store behaviour, import path and test patch seam unchanged.

src/kiro_crew/apps/registry.py was one 7,769-line module holding the whole App Store pipeline. Security rules that must be reviewed together (credential-free clone posture, SSRF host gate, subdirectory containment, index-name gates) were interleaved with listing, caching and install code, so every App Store fix touched the same file and reviewers had to rediscover which part owned a rule.

Why it matters

The registry decides what code the gateway clones, builds and runs. A change to one rule in a module this size is slow to review and easy to land in the wrong place, and large concurrent changes to it collide. Owners by responsibility make each rule findable and keep a fix inside its owner.

Not a goal

  • Changing any App Store, refresh or install behaviour: error text, cache file names, trust and credential decisions, ordering and timeouts stay as they are.
  • Retiring the kiro_crew.apps.registry import path or any of its patch seams.
  • Moving _run_app_build or the two index-entry name gates out of registry.py; repository guards read them there by path.
  • Splitting the bodies of install_from_registry or _git_clone_or_pull; they move intact so the move is provably behaviour-preserving.
  • Changes to routes.py, manager.py, the app backend, or the catalog JSON.
  • Updating frontend comments that cite registry.py (logged as a docs-sync follow-up).

What changed (motivation → approach → change)

Owner under src/kiro_crew/apps/registry_pipeline/ Owns
subprocess_env.py minimal_env, anonymous_git_env, the probe env
git_targets.py clone-target parsing, userinfo stripping, unsupported forms, normalization, credential transport env, credentialed-output classes
caches.py manifest and index cache identity, paths, reads, writes, GC, legacy migration
sources.py seed and edition rows, pinned/effective registries, trust tier, clone-host trust, owner-designated carve-out
recovery.py checkout slot, move-aside, restore, stale sweep
checkout.py git fetch/clone/pull on a checkout, bounded metadata reads, timeouts, process-group kill
indexes.py external index fetch, configured-branch rule, fetch-then-swap cache, owner-tier confirmation
manifests.py subdirectory containment, app.json fetch, resolve, merge
catalog.py store listing, install status, trust fields, refresh, row and candidate resolution
install.py the install transaction

The module mixed seven responsibilities, so each moved to one owner, lowest layer first, with imports pointing only down that order. Function bodies moved unchanged: an AST comparison against the base finds 161 of 165 top-level definitions identical (docstrings aside, where the brand gate respells KiroCrew on moved lines). Three that differ are call sites that now reach a construct registry.py keeps; the fourth is _REGISTRY_FILE, whose path climbs one more directory so it still names kiro_crew/apps/app-registry.json.

registry.py is the only import path and patch surface, in the shape of the AWS Control backup facade. Every name the module bound resolves to its owner's object, and a write through the facade reaches every module that binds the name, so the existing monkeypatch.setattr(registry, ...) and mock.patch("kiro_crew.apps.registry...") sites keep reaching the moved call sites. It imports every owner at its own import, keeps the kiro_crew.apps.registry logger for every owner, and reloads the owners when it is reloaded.

Three constructs stay in registry.py because repository guards read them there: _run_app_build and the two KEBAB_RE.fullmatch index-name gates. The owners that call them resolve the facade at call time. The App Kit spec gains §20 with the owner map; Writers lines and the moved-symbol citations in other docs point at the real owners.

Backwards compatibility

Compatible: all 218 names the one-module registry.py bound still resolve from kiro_crew.apps.registry to the object their owner holds, __all__ is the same set, and moved code is unchanged. The composition-contract test pins both.

Tests

  • test/test_apps_registry_composition_contract.py (new): the frozen 218-name surface, one object per name across every holder, facade writes and undo (monkeypatch, mock.patch, nested four deep, delete/restore, builtins), downward-only imports, the exact three facade call sites, reload, star import, the TYPE_CHECKING view, and a create=True patch guard over every test module with its own reader cases.
  • test/test_apps_registry_coverage.py, test/test_apps_registry.py: characterization cases pass against the base and the split: the bundled seed path, frozen cache file names, the credentialed-output classes, the one-shot transport env, timeouts read where they are used, the index-cache migration failing closed, install-row precedence, and install log identity.
  • Oracle suites unchanged and green (test_external_registry.py, test_catalog_inventory.py, test_app_manager.py, test_apps_routes_coverage.py and 30 more).

Manual verification

  • Built the wheel and imported the facade and all ten owners from a clean virtualenv.
  • Imported kiro_crew.apps.registry, kiro_crew.apps.routes and each owner first in fresh interpreters.
  • local-gate.py --dry-run selects 1,912 backend and 873 frontend files (the new package __init__ matches most tests), over the campaign cap, so owned, oracle and 152 tree-scanning ratchet suites were run instead; CI runs the full matrix.

Shared files (entry-scoped grants)

  • src/kiro_crew/security_posture.py: NON_EGRESS_REDACTION_MODULES row apps/registry.py replaced by the four owners that call a redactor.
  • docs/request-for-change/rfc-everything-is-an-app.md: the apps/registry.py:4053 line cite, which the facade no longer reaches, now names install_from_registry.
  • .github/black-baseline.txt: registry.py pruned; the facade is black-clean.
  • Path re-points for moved symbols: docs/system-specs/modules/{security,platform-context,papyrus,dev-fleet}.md, docs/architecture/resource-protection.md, docs/app-kit/manifest-reference.md, docs/request-for-change/rfc-{appstore-official-registry,federated-app-platform}.md, src/kiro_crew/platform/interfaces.py docstrings.

Integration follow-ups (comments outside this claim that still name registry.py as the definer; every name still resolves through the facade):

  • .github/docs-lint-baseline.txt:314: the now-inert apps/registry.py:4053 triple (report-only).
  • website/src/components/appstore/types.ts:49,186,217: _apply_trust_fields → apps/registry_pipeline/catalog.py.
  • test/test_llm_pool.py:1493: _communicate_with_timeout → apps/registry_pipeline/checkout.py.
  • src/kiro_crew/apps/builtins/command_bar/tests/test_command_bar_manifest_platform.py:6: the supports_platform call → install_from_registry in apps/registry_pipeline/install.py.
  • src/kiro_crew/apps/manifest.py:2786 and test/test_app_signing_payload_resource_and_ui_fields.py:18: the clientInstall return → apps/registry_pipeline/install.py.
  • src/kiro_crew/apps/official_catalog.py:767: install-status and trust stamping → apps/registry_pipeline/catalog.py.
  • test/test_r8_s33_subprocess_env.py:263: the two detectInstalled probes → catalog.py (_detect_installed_probe) and install.py.
  • src/kiro_crew/platform/defaults.py:458: _PUBLIC_GIT_HOSTS → apps/registry_pipeline/git_targets.py (the code reads it through the facade).

Related Issues

no linked issue: structural refactor from the component-refactor campaign.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

apps/registry.py carried the whole App Store pipeline in one 7,769-line
module: subprocess environments, clone-target policy, caches, registry
trust, git checkout transport, the store listing and the install
transaction. Its rules now live in ten private owners under
apps/registry_pipeline/, one per responsibility, and registry.py stays
the only import path and patch surface.

The facade answers every name the one-module registry bound with the
object its owner holds, and a write through it reaches every module
that binds the name, so the existing monkeypatch and mock.patch seams
keep reaching the moved call sites. Owners import only lower owners
and never the facade; the build step and the two index-entry name
gates stay in registry.py, where repository guards read them by path.
Moved function bodies are unchanged.

A new composition-contract test pins the surface, the one-namespace
writes, the layering, the facade call sites, reload and a create=True
patch guard. Characterization tests pin the seed path, frozen cache
filenames and the credentialed-output classes. The App Kit spec gains
section 20 with the owner map; the security_posture allowlist, one RFC
line cite and the moved-symbol citations in other specs are updated.
@bolichen97
bolichen97 requested a review from a team as a code owner September 28, 2026 09:20
@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Sep 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Design Review (Fable 5) — ✅ PASS

Design-level review of f9f4481748294560fa0c5e509886aae087c222ae — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

Design-Verdict: PASS

Verify full CI matrix is green before merge — local-gate exceeded the campaign cap and ran only a subset, and the facade's patch-seam preservation rests entirely on that suite.

Real problem (7,769-line module interleaving security rules), sound and proportionate solution: split by responsibility into owners, keep registry.py as the sole import/patch surface via a facade that forwards reads (PEP 562 __getattr__) and propagates writes to every binding-holder. The write-to-all-holders design correctly handles from X import Y binding semantics, which a naive facade would break. The shape is an established, repo-tested pattern (aws_control/backend/backup.py + test_mirrored_owner_storage.py), not novel machinery. Behaviour-preserving (AST-verified move), fully reversible, no user-visible surface — no rendered evidence required.

[DESIGN-REVIEWED] f9f4481

@github-actions

Copy link
Copy Markdown
Contributor

First Principles Review (Fable 5) — ✅ PASS

Premise-level review of f9f4481748294560fa0c5e509886aae087c222ae — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS/CONCERNS are advisory.

First-Principles-Verdict: PASS

Verify the security_posture.py redaction remap: confirm no code that needs egress redaction moved onto the non-egress-exempt list when apps/registry.py became four owner rows.

What this change ships

Inventory (8 items) — 8 justified

Intent: split the monolithic App Store registry module into responsibility owners so a contributor changes one rule in the module that owns it, behavior unchanged. This is a REFACTOR (regroup).

  1. registry.py (7,769 lines) split into 10 owner modules under registry_pipeline/ — justified
  2. registry.py becomes a re-export facade preserving all 218 names, the import path, and every monkeypatch.setattr(registry, …) / mock.patch seam — justified
  3. New registry_pipeline/ package with downward-only imports — justified
  4. New composition-contract test (2,009 lines) pinning facade name resolution and write-propagation — justified
  5. Two new characterization tests for the install streaming-log path in test_apps_registry.py — justified
  6. NON_EGRESS_REDACTION_MODULES: apps/registry.py row replaced by the four owners that call a redactor — justified
  7. App Kit spec §20 owner map added (invariant-mandated same-commit doc) — justified
  8. Doc/docstring path re-points for moved symbols across specs and RFCs — justified

[FIRST-PRINCIPLES-REVIEWED] f9f4481

@github-actions

Copy link
Copy Markdown
Contributor

GPT 5.6 Review — ✅ no blocking findings

GPT 5.6 completed its review of f9f4481748294560fa0c5e509886aae087c222ae and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] f9f4481

False positive or not applicable? A repository writer can comment:
/ai-review override gpt f9f4481748294560fa0c5e509886aae087c222ae: <one-sentence reason>

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rerun note: Backend Tests (Windows) (7) (job 108865204670, run 36402834387) failed on exactly one node, test/test_brand_name_gate.py::TestUrlBoundary::test_many_brand_names_on_one_line_stay_linear (doubling the input cost 3.0x CPU time ... assert 3.0 < 3.0); 16396 others passed. It is a CPU-time ratio check of scripts/check_brand_name.py, which this PR does not touch, and the same node passes locally at this head (1 passed). I reran that one job once, as an unrelated timing flake.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Portability findings on this head are the three lines this refactor moves verbatim from apps/registry.py at the base (6a8cb5e), each already platform-safe:

  • registry_pipeline/install.py:1518 os.killpg — inside if platform_compat.IS_POSIX:; the else branch is platform_compat.kill_process_tree_async (base registry.py:7416).
  • registry_pipeline/checkout.py:132 ref.split("/") — git ref names are always /-separated, not filesystem paths (base registry.py:4544).
  • registry_pipeline/manifests.py:79 subdir.split("/") — the manifest subdirectory is a repo-relative POSIX-spelled contract string; drive letters and absolute paths are refused on the lines above (base registry.py:1596).
    Applying posix-only-approved (same treatment as refactor: split source-provider handler into responsibility owners #14543) so the moved lines are not respelled around the regex in a behaviour-preserving move.

@bolichen97 bolichen97 added the posix-only-approved Cross-Platform Portability findings reviewed and accepted as intentionally POSIX-only label Sep 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Opus 5 Review — ✅ no blocking findings

Reviewed f9f4481748294560fa0c5e509886aae087c222ae — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] f9f4481

Verdict parsed from the review's SHA-scoped output markers for commit f9f4481748294560fa0c5e509886aae087c222ae.

False positive or not applicable? A repository writer can comment:
/ai-review override fable f9f4481748294560fa0c5e509886aae087c222ae: <one-sentence reason>

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Verify full CI matrix is green before merge (PASS headline)

rebutted (already satisfied at this head): the full CI matrix ran on f9f4481 and the rollup reads 98 checks, 0 failing.
Every Backend Tests shard (Linux, Windows, macOS) passed; Windows (7) passed on its one rerun after a CPU-ratio timing flake in test_brand_name_gate.py, a script this PR does not touch.
Local evidence before publication, beyond the capped local-gate: owned tests plus 37 registry oracle files, 3486 passed; 152 guard/ratchet files, 11316 passed; composition contract, 500 passed.
The patch-seam claim is also pinned directly: test_apps_registry_composition_contract.py drives facade patches into moved call sites and checks they reach the owner.

@bolichen97

Copy link
Copy Markdown
Contributor Author
  • Verify the security_posture.py redaction remap (PASS headline)

rebutted (verified, no egress code gained an exemption): at the base, the one row apps/registry.py covered 9 lines matching the guard's redactor-call regex.
At this head those same 9 lines sit in exactly the four listed owners: checkout 1, git_targets 3, indexes 1, sources 4. The other seven owners and registry.py itself have 0.
The functions moved unchanged, so no call site changed what it sends anywhere; the exemption covers the same code in new files.
test_security_posture.py passes unmodified, including test_every_redactor_call_site_is_a_registered_sink_or_allowlisted and test_allowlist_has_no_stale_entries.

@bolichen97

Copy link
Copy Markdown
Contributor Author

Rerun note: Automated Rule Check (Code Review run 36402834590, job 108864500720, runner label codebuild-kirocrew-gha-linux-36402834590-1) was still queued 2 hours after 09:20:12Z, while Code Review runs created after it kept completing. Its runner dispatch had been lost, so it would never start. I cancelled run 36402834590 and reran it once with --failed. Attempt 2 dispatches the job again as 108905314727 with runner label codebuild-kirocrew-gha-linux-36402834590-2. No code change and no push.

@github-actions github-actions Bot added readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running labels Sep 28, 2026
@bolichen97
bolichen97 enabled auto-merge (squash) September 28, 2026 15:40
@bolichen97
bolichen97 merged commit 1746141 into main Sep 28, 2026
154 of 157 checks passed
@bolichen97
bolichen97 deleted the refactor/i08-app-registry-pipeline branch September 28, 2026 16:15
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Sep 28, 2026
pepmach added a commit that referenced this pull request Sep 28, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 28, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 28, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 28, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

The waiver counts a backend entry only when the spawn would launch it as
Python. backend.py pip-installs the root requirements.txt for every file-style
entry but hands the tree to a Python child only (the deps_boot shim, or
PYTHONPATH on an ABI match); a shell or node child gets none of it, so a .sh or
.js entry beside a requirements.txt was waived into an install whose
dependencies land beside a process that can never import them.
manifest.spawn_launches_entry_point_as_python mirrors the spawn's dispatch
(declared type, node suffix, .sh, the shebang of an extensionless executable)
and is cross-pinned to backend._is_shell_entry; such an entry leaves only a
stdio server to waive the file, and the build pass refuses it at once.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 29, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

The waiver counts a backend entry only when the spawn would launch it as
Python. backend.py pip-installs the root requirements.txt for every file-style
entry but hands the tree to a Python child only (the deps_boot shim, or
PYTHONPATH on an ABI match); a shell or node child gets none of it, so a .sh or
.js entry beside a requirements.txt was waived into an install whose
dependencies land beside a process that can never import them.
manifest.spawn_launches_entry_point_as_python mirrors the spawn's dispatch
(declared type, node suffix, .sh, the shebang of an extensionless executable)
and is cross-pinned to backend._is_shell_entry; such an entry leaves only a
stdio server to waive the file, and the build pass refuses it at once.

Rebased onto main after #14656 owner-gated the install-stream route: the
route now reads the dashboard identity and app state before the body, so the
install-stream refusal test builds its server as the owner, exactly as the
class's sibling tests do since that commit (the fixture pins app["state"]).
The desktop refusal sentence says "Kiro Crew's desktop build" instead of
"the desktop app", which named Kiro Crew with the word the sentence is about
installing; the dashboard keys its copy on the code, so only the sentence and
its backend test copies change.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 29, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

The waiver counts a backend entry only when the spawn would launch it as
Python. backend.py pip-installs the root requirements.txt for every file-style
entry but hands the tree to a Python child only (the deps_boot shim, or
PYTHONPATH on an ABI match); a shell or node child gets none of it, so a .sh or
.js entry beside a requirements.txt was waived into an install whose
dependencies land beside a process that can never import them.
manifest.spawn_launches_entry_point_as_python mirrors the spawn's dispatch
(declared type, node suffix, .sh, the shebang of an extensionless executable)
and is cross-pinned to backend._is_shell_entry; such an entry leaves only a
stdio server to waive the file, and the build pass refuses it at once.

Rebased onto main after #14656 owner-gated the install-stream route: the
route now reads the dashboard identity and app state before the body, so the
install-stream refusal test builds its server as the owner, exactly as the
class's sibling tests do since that commit (the fixture pins app["state"]).
The desktop refusal sentence says "Kiro Crew's desktop build" instead of
"the desktop app", which named Kiro Crew with the word the sentence is about
installing; the dashboard keys its copy on the code, so only the sentence and
its backend test copies change.

The labelled dismiss control may shrink and its label wrap below md: the
control's own line at 320px is the notice's content width, and the German
label is wider than it, so shrink-0 and whitespace-nowrap hold from md up
only; the icon-only shape and the layout from md up are unchanged. The
set-aside holder is bound only once its mkdir succeeded, so a parent that
refuses the holder is named in every layout file's warning and each later
file tries a holder of its own, instead of the rename's missing-directory
error standing in for the cause.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 29, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

The waiver counts a backend entry only when the spawn would launch it as
Python. backend.py pip-installs the root requirements.txt for every file-style
entry but hands the tree to a Python child only (the deps_boot shim, or
PYTHONPATH on an ABI match); a shell or node child gets none of it, so a .sh or
.js entry beside a requirements.txt was waived into an install whose
dependencies land beside a process that can never import them.
manifest.spawn_launches_entry_point_as_python mirrors the spawn's dispatch
(declared type, node suffix, .sh, the shebang of an extensionless executable)
and is cross-pinned to backend._is_shell_entry; such an entry leaves only a
stdio server to waive the file, and the build pass refuses it at once.

Rebased onto main after #14656 owner-gated the install-stream route: the
route now reads the dashboard identity and app state before the body, so the
install-stream refusal test builds its server as the owner, exactly as the
class's sibling tests do since that commit (the fixture pins app["state"]).
The desktop refusal sentence says "Kiro Crew's desktop build" instead of
"the desktop app", which named Kiro Crew with the word the sentence is about
installing; the dashboard keys its copy on the code, so only the sentence and
its backend test copies change.

The labelled dismiss control may shrink and its label wrap below md: the
control's own line at 320px is the notice's content width, and the German
label is wider than it, so shrink-0 and whitespace-nowrap hold from md up
only; the icon-only shape and the layout from md up are unchanged. The
set-aside holder is bound only once its mkdir succeeded, so a parent that
refuses the holder is named in every layout file's warning and each later
file tries a holder of its own, instead of the rename's missing-directory
error standing in for the cause.

The consent dialog's copy is one state-keyed table (terminalCopy): each
terminal state -- consent, generic failure, granted failure, permanent desktop
refusal -- owns its headline, help line and exit sentence together, so no state
can inherit another's exit line through a missing guard. The granted failure
had rendered the consent state's "Cancel changes nothing" beside a notice
saying the app is now trusted; it now says Cancel keeps the app trusted and
switched off, the permanent refusal says no trust decision is left to make,
and the granted headline names what the retry button re-confirms.

Fixes #13446
pepmach added a commit that referenced this pull request Sep 29, 2026
The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

The waiver counts a backend entry only when the spawn would launch it as
Python. backend.py pip-installs the root requirements.txt for every file-style
entry but hands the tree to a Python child only (the deps_boot shim, or
PYTHONPATH on an ABI match); a shell or node child gets none of it, so a .sh or
.js entry beside a requirements.txt was waived into an install whose
dependencies land beside a process that can never import them.
manifest.spawn_launches_entry_point_as_python mirrors the spawn's dispatch
(declared type, node suffix, .sh, the shebang of an extensionless executable)
and is cross-pinned to backend._is_shell_entry; such an entry leaves only a
stdio server to waive the file, and the build pass refuses it at once.

Rebased onto main after #14656 owner-gated the install-stream route: the
route now reads the dashboard identity and app state before the body, so the
install-stream refusal test builds its server as the owner, exactly as the
class's sibling tests do since that commit (the fixture pins app["state"]).
The desktop refusal sentence says "Kiro Crew's desktop build" instead of
"the desktop app", which named Kiro Crew with the word the sentence is about
installing; the dashboard keys its copy on the code, so only the sentence and
its backend test copies change.

The labelled dismiss control may shrink and its label wrap below md: the
control's own line at 320px is the notice's content width, and the German
label is wider than it, so shrink-0 and whitespace-nowrap hold from md up
only; the icon-only shape and the layout from md up are unchanged. The
set-aside holder is bound only once its mkdir succeeded, so a parent that
refuses the holder is named in every layout file's warning and each later
file tries a holder of its own, instead of the rename's missing-directory
error standing in for the cause.

The consent dialog's copy is one state-keyed table (terminalCopy): each
terminal state -- consent, generic failure, granted failure, permanent desktop
refusal -- owns its headline, help line and exit sentence together, so no state
can inherit another's exit line through a missing guard. The granted failure
had rendered the consent state's "Cancel changes nothing" beside a notice
saying the app is now trusted; it now says Cancel keeps the app trusted and
switched off, the permanent refusal says no trust decision is left to make,
and the granted headline names what the retry button re-confirms.

Rebased over the backend split (#14899): the deps-provisioning hunks
(requirements_in_tree at the stamp check and the provisioner, the shared
requirements cap) now live in backend_runtime/provisioning.py, the spawn
body's predicate calls stay in the facade, and the facade's inventory and
type-checker list gain the owner-held names.

Fixes #13446
bolichen97 pushed a commit that referenced this pull request Sep 29, 2026
…#13568)

The install-time build-step gate refused EVERY Python app carrying a
root requirements.txt on the desktop build, including the apps whose
dependencies the runtime already provisions itself. An app declaring an
out-of-process backend.entryPoint (a FastAPI/uvicorn backend is the
normal shape) could therefore not be installed at all, even though the
runtime support for it shipped in #7901.

What the refusal is about is the GATEWAY's own import path:
pyproject.toml / setup.py install INTO the bundled interpreter, which
lives inside the signed application bundle and cannot be written to. A
root requirements.txt the runtime provisions out of process is a
different dependency: backend.py installs it with `pip install --target`
into the app's own deps dir when a backend.entryPoint spawns, and
bridges.py does the same at registration for an app that ships a stdio
mcpServers entry — which works on that interpreter and never touches
the bundle.

So pass the typed cloned manifest (the one the identity and admission
gates already judged) into the build and make the waiver the runtime's
own condition: pyproject.toml / setup.py keep the loud refusal; a root
requirements.txt passes when the manifest declares an out-of-process
consumer (backend.entryPoint, or a stdio mcpServers entry) AND declares
no backend.hooks, and the install-time pip step is skipped for it; a
requirements.txt with neither consumer, or beside pyproject.toml /
setup.py, keeps the refusal. Hooks decide because they import INTO the
gateway process, which the app deps tree deliberately never reaches, so
an app declaring one still has Python that must import from the
gateway's interpreter. A source install is unchanged: requirements.txt
is still pip-installed there.

The trust-and-enable modal discarded the reason on top of that. It
showed its generic copy while the install stream's error text existed
nowhere the user could reach, so Try again failed identically with the
cause only in the security event log. The server string now renders as
the ErrorNotice message with the generic copy as its title, which keeps
the raw string as the error-journal key so the ask-the-agent hand-off
still carries the endpoint, status and code in every locale.

Five sites join the link-screen baseline (test/link_screen_sites.py) as the
refuse-every-link kind, none held: manager._owned_data_dir answers False for a
symlink or a junction and every caller then refuses or skips the move, so the
name is never traversed; manager.gateway_data_dir_obstruction returns the
refusal sentence for a link at `data` and the install stops before the record;
manager.update_app refuses an installed `data` link before the transaction
opens, and every later move is a rename by name, which moves a link as a link;
registry._layout_cleanup_escaped returns the skip line for a link at the
checkout root and the cleanup writers never run;
registry._set_aside_new_layout_files moves a link under a layout name as the
link it is (`os.rename` acts on the name) and never follows it.

install_app asks gateway_data_dir_obstruction a third time, of an app
directory already standing at its destination with no record, BEFORE its
transaction opens, so a pre-existing link or file at `data` is refused with
the predicate's own sentence instead of being unlinked by the orphan cleanup
-- the same pre-transaction refusal update_app and uninstall_app make of that
shape.

Rebased over the registry split (#14674): the registry's rules now live in
apps/registry_pipeline/, so this change's registry hunks sit with their owners.
_contained_join's symlink-loop catch is in manifests.py; _stale_sibling and the
_move_checkout_aside spelling are in recovery.py; the install verb and refusal
line, _refuse_identity_mismatch, _clone_build_app(_locked), the desktop gate
(_desktop_build_refusal, _installed_tree_preview, _requirements_owned_by_the_runtime),
the post-script rollback (_layout_cleanup_escaped, _remove_new_layout_files,
_set_aside_new_layout_files, _roll_back_post_script_refusal) and
install_from_registry are in install.py. _run_app_build stays in registry.py,
which binds the names it reads; the facade's TYPE_CHECKING list and the
composition contract's frozen inventory gain the new names. The link-screen
baseline records the two refusal sites under install.py, where the gate now
finds them: both refuse every link before anything is traversed, so no hold.

update_app's preflight asks the same predicate, gateway_data_dir_obstruction,
BEFORE its transaction opens, in place of a link-only test: an installed `data`
that is a regular file (from before the refusal, or made by the app's own
runtime) passed the link test, was skipped by the move-aside, retired with the
old tree, missed by the post-copy ask (which reads the new tree) and deleted
with the retired tree on the update's success path while app_data_dir made an
empty directory in its place -- silently, with ok=True. The update-only link
sentence goes away; the refusal carries the predicate's own sentence and is
logged in the shape of install_app's pre-transaction refusal. The link-screen
baseline drops apps/manager.py::update_app: the function screens no link
itself, and the predicate it calls is already declared.

The waiver counts a backend entry only when the spawn would launch it as
Python. backend.py pip-installs the root requirements.txt for every file-style
entry but hands the tree to a Python child only (the deps_boot shim, or
PYTHONPATH on an ABI match); a shell or node child gets none of it, so a .sh or
.js entry beside a requirements.txt was waived into an install whose
dependencies land beside a process that can never import them.
manifest.spawn_launches_entry_point_as_python mirrors the spawn's dispatch
(declared type, node suffix, .sh, the shebang of an extensionless executable)
and is cross-pinned to backend._is_shell_entry; such an entry leaves only a
stdio server to waive the file, and the build pass refuses it at once.

Rebased onto main after #14656 owner-gated the install-stream route: the
route now reads the dashboard identity and app state before the body, so the
install-stream refusal test builds its server as the owner, exactly as the
class's sibling tests do since that commit (the fixture pins app["state"]).
The desktop refusal sentence says "Kiro Crew's desktop build" instead of
"the desktop app", which named Kiro Crew with the word the sentence is about
installing; the dashboard keys its copy on the code, so only the sentence and
its backend test copies change.

The labelled dismiss control may shrink and its label wrap below md: the
control's own line at 320px is the notice's content width, and the German
label is wider than it, so shrink-0 and whitespace-nowrap hold from md up
only; the icon-only shape and the layout from md up are unchanged. The
set-aside holder is bound only once its mkdir succeeded, so a parent that
refuses the holder is named in every layout file's warning and each later
file tries a holder of its own, instead of the rename's missing-directory
error standing in for the cause.

The consent dialog's copy is one state-keyed table (terminalCopy): each
terminal state -- consent, generic failure, granted failure, permanent desktop
refusal -- owns its headline, help line and exit sentence together, so no state
can inherit another's exit line through a missing guard. The granted failure
had rendered the consent state's "Cancel changes nothing" beside a notice
saying the app is now trusted; it now says Cancel keeps the app trusted and
switched off, the permanent refusal says no trust decision is left to make,
and the granted headline names what the retry button re-confirms.

Rebased over the backend split (#14899): the deps-provisioning hunks
(requirements_in_tree at the stamp check and the provisioner, the shared
requirements cap) now live in backend_runtime/provisioning.py, the spawn
body's predicate calls stay in the facade, and the facade's inventory and
type-checker list gain the owner-held names.

Fixes #13446
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

posix-only-approved Cross-Platform Portability findings reviewed and accepted as intentionally POSIX-only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants