Repository navigation
fix(apps): let owner manifest, blob and art clones reach the ssh agent - #19385
Conversation
UX Review (Opus 5.5, fork) — ⏭️ skippedRevision |
First Principles Review (Opus 5.5, fork) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS Check that every path into What this change shipsInventory (5 items) — 5 justifiedIntent: on an SSH-agent-only forge, a same-repo registry app's manifest, icon and screenshots load in the store. This is a FIX for #18940's leftover after #18929.
[FIRST-PRINCIPLES-REVIEWED] f78787c Description read[DESCRIPTION-READ] d03bb670b7f957b9112dfa8284245ac001d9a15350a57f2f4f23cc31ba33b600 That sha256 names the PR description this verdict read. Recompute it with |
Design Review (Opus 5.5, fork) — ✅ PASSDesign-level review of Design-Verdict: PASS Check one thing: the owner-tier prewarm passes [DESIGN-REVIEWED] f78787c Description read[DESCRIPTION-READ] 5b15482fcab4b6bfdb04e20d0286d7e16eb4730f0588c689f7383b31786ea19f That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
Opus 5.5 Review (fork) — ✅ no blocking findingsReviewed |
GPT 6.1 Review (fork) — ✅ no blocking findingsReviewed Review detailsNo findings. |
The owner's registry index clone and install clone ask wrap_argv to keep the ssh-agent socket, so they authenticate on a host whose git server takes only agent-held keys. Three other spawns run in the same owner posture (minimal_env plus the context sandbox mode) and did not ask: the same-repo manifest fetch, the blob proxy's owner branch and the owner-tier store-art prewarm. On such a host their clone failed without the socket, so a same-repo app's manifest and art did not load. Each now passes the owner's decision as the socket request: owner_designated for the manifest fetch (plain clone and pinned fetch) and for the blob clone, True for the prewarm, whose rows are owner-tier. _git_fetch_branch gains the forward_ssh_auth_sock pass-through that _git_fetch_commit already has. wrap_argv still re-judges the request against the tier, and the anonymous branches do not ask. Fixes kirodotdev#18940
a8740d8 to
f78787c
Compare
iamwhatever
left a comment
There was a problem hiding this comment.
This PR finishes #18929. The three remaining owner-posture git spawns now ask wrap_argv to keep SSH_AUTH_SOCK: the owner-designated manifest fetch (manifests.py, pinned and plain clone), the owner branch of the blob proxy (routes.py _fetch_git_blob), and the owner-tier store-art prewarm (store_art.py through a new _git_fetch_branch pass-through). This fixes the root cause of manifest, icon and screenshot loads failing on agent-only SSH forges. I tried to get the socket into an anonymous spawn: every new request is gated on owner_designated (the byte-identical-URL carve-out), so the default index-originated path passes False and wrap_argv_async drops it. The prewarm's unconditional True runs only after its own transport allowlist, branch, subdir and is_clone_host_trusted gates and the SEL grant, the same treatment install gives an _owner_tier_confirmed entry (install.py:1748 sets index_originated=False, so forward_sock=True at checkout.py:774). So the agent is never offered to a URL that did not already get the owner's minimal_env identity. _git_fetch_ref still limits the socket to the network step, and wrap_argv still re-judges it against the tier and the consent leaf. The tests check the kwarg in both the default and owner cases, plus the network-only rule, at every site, and both AI lanes pass, checks are green and the branch is mergeable. — crew-pr-reviewer (deep re-check)
Problem / Motivation
Goal: on a git host that only takes agent-held SSH keys, a same-repo app's manifest, icon and screenshots load, because the owner's manifest fetch, blob clone and art prewarm clone keep the ssh-agent socket the way the owner's other clones do.
#18929 made the owner's registry index clone and the owner-designated install clone ask
wrap_argvto keepSSH_AUTH_SOCK.minimal_env()carries the socket into the child's environment, and the sandbox wrap removes it unless the spawn asks to keep it (wrap_argv_asyncadds the option only when it is set). Three other spawns run in the same owner posture (minimal_env()+_context_clone_sandbox_mode, each audited with a_sel_credential_grant) and still do not ask:_fetch_app_manifest(apps/registry_pipeline/manifests.py:167-169at 098df01, with its pinned fetch at:189and plain clone at:243);_fetch_git_blob(apps/routes.py:3832-3845at 098df01, clone at:3893);_fetch_owner_tier_store_assets(apps/registry_pipeline/store_art.py:1121-1133at 098df01), which clones through_git_fetch_branch, a function with no parameter for the socket.On a host where a clone cannot authenticate without the agent, each of these runs fails: the manifest fetch returns
None, the blob clone returnsFalse, and the prewarm records a clone failure for the row. #18940 names the first two ("a same-repo app's manifest and art may therefore still fail to load after #18929").Why it matters
After #18929 an operator's registry on an SSH-only forge indexes and installs, but the store lists that registry's apps without their manifest data, icon or screenshots, and the prewarm that fills the art cache fails on every refresh. The install path reads the manifest through the same fetch before it clones (
apps/registry_pipeline/install.py:1771-1779), and when that returnsNonethe admission and platform checks run with no manifest (apps/registry_pipeline/install.py:1784). Hosts reached over HTTPS, and hosts where the agent is not the only way in, are not affected.Not a goal
anonymous_git_env()+strictand never asks for the socket (the tests below pin the default case next to the owner case)._git_fetch_branchwith acredential_target) are untouched._git_fetch_refallows a credential target only for HTTP(S), which never uses the agent, and fix(apps): let an owner's SSH registry clone reach the ssh agent #18929 leaves the same branches alone.sandbox.pyor to theSSH_AUTH_SOCKconsent:wrap_argvstill re-judges the request against the tier it applies, and a tier or mask that hides~/.sshstill needs the consent leaf.is_clone_host_trusted, the SEL credential grants) are unchanged.What changed (motivation → approach → change)
_git_fetch_branchcould not carry it._fetch_app_manifest(apps/registry_pipeline/manifests.py:203,253): the pinned_git_fetch_commitand the plain clone passforward_ssh_auth_sock=owner_designated. The pinned fetch asks whether or not the URL carries an HTTP credential, as the install's pinned fetch does (apps/registry_pipeline/checkout.py:1087). The default call passesFalse, whichwrap_argv_asyncdrops, so an index-originated fetch makes the same calls it made before._fetch_git_blob(apps/routes.py:3896): the blob proxy's plain clone passesforward_ssh_auth_sock=owner_designated._git_fetch_branch(apps/registry_pipeline/checkout.py:682-712): takesforward_ssh_auth_sockand hands it to_git_fetch_ref, as_git_fetch_commitdoes since fix(apps): let an owner's SSH registry clone reach the ssh agent #18929._git_fetch_refalready limits it to the network step (apps/registry_pipeline/checkout.py:447)._fetch_owner_tier_store_assets(apps/registry_pipeline/store_art.py:1143): the prewarm passesTrue. It clones only for an owner-tier registry (TestTrustBoundary::test_an_index_tier_registry_never_clones), the same tier whose install clone asks since fix(apps): let an owner's SSH registry clone reach the ssh agent #18929.docs/system-specs/modules/security.md(theSSH_AUTH_SOCKforward paragraph now lists the five owner-chosen spawns and the credentialed-branch exception; the same-repo carve-out bullet names the socket) anddocs/system-specs/modules/app-kit-platform.md(the prewarm paragraph).Backwards compatibility
Compatible: nothing that works today stops working. An owner clone that authenticates without the agent still does, and the request only keeps
SSH_AUTH_SOCKwherewrap_argvalready keeps it for the owner's other clones, on tiers where the child can already read the key files.Removes nothing:
_git_fetch_branchgains an optional keyword whose default is the old behaviour; no key, function or branch is removed or narrowed.Tests
Red on unchanged
origin/main098df01 (the three changed test files copied into a detached checkout of it),pytest test/test_external_registry.py test/test_apps_routes_coverage.py test/test_registry_store_art_prewarm.py -k asks_for_the_agent_socket -p no:cacheprovider -n 0 --no-cov: RC=1 in 3 of 3 runs,6 failed, 3 passed, 644 deselected. Green on this branch (head a8740d8 on 098df01), the same three files in full: RC=0 in 3 of 3 runs,653 passed.The 3 that pass on main are the default cases (manifest branch and pinned, blob), which pin that an index-originated fetch does not ask; the two
_git_fetch_branchcases fail with aTypeErrorbecause main's function has no such parameter.New cases, each driving the production function with the spawn faked and asserting the keyword the sandbox wrap receives (and, for the fetches, that init and remote setup never get it):
test_external_registry.py::test_manifest_fetch_asks_for_the_agent_socket_only_for_the_owners_url: {default, owner} × {branch, pinned-commit}, on the_ssh_capturehelper fix(apps): let an owner's SSH registry clone reach the ssh agent #18929 added.test_external_registry.py::test_branch_fetch_asks_for_the_agent_socket_only_when_told_to: {default, forwarded}.test_apps_routes_coverage.py::TestFetchGitBlobCredentialPosture::test_blob_clone_asks_for_the_agent_socket_only_for_the_owners_url: {default, owner}.test_registry_store_art_prewarm.py::TestOwnerTierPrewarm::test_the_clone_asks_for_the_agent_socket.One mutation per rule, each failing exactly its own case and no other: the manifest plain clone, the manifest pinned fetch, the blob clone, the
_git_fetch_branchpass-through or the prewarm dropping the request fails[owner-branch],[owner-pinned-commit], the blob[owner]case,[forwarded]or the prewarm test; making the default manifest clone, manifest pinned fetch or blob clone ask fails[default-branch],[default-pinned-commit]or the blob[default]case. Five existingwrap_argvfakes (four intest_apps_routes_coverage.py, one intest_apps_registry_coverage.py) now accept**kwargs, because the owner path passes the new keyword; no assertion in an existing test changed. No port, sleep or real child process is used.The 17 files that name the changed functions or exercise the registry install and blob routes: 1702 passed, 5 skipped.
test_sandbox_ssh_auth_sock_forward.py, which covers whatwrap_argvdoes with the request: 31 passed.test_flake_pattern_ratchet.py: 53 passed. mypy on the four source files, flake8, isort, black on the files outside the baseline,scripts/check_black_formatting.py,COMMENT_HISTORY_BASE_REF=origin/main scripts/check_comment_history.py,scripts/check_subprocess_encoding.py,scripts/check_brand_name.py,scripts/docs-lint.sh,check_acp_frame_host_data,check_agent_sdk_boundary,check_sync_io_in_asyncandcheck_lockdown_before_publishexit 0.Manual verification
None beyond the tests: there was no run against an agent-only SSH host. Each test pins the request the spawn makes; what
wrap_argvdoes with the request is unchanged.Related Issues
Fixes #18940. Follows #18929 (merged).
Open #18621, #18004 and #16517 edit files this change edits, but they conflict with
origin/mainalready:git merge-treeagainst this head lists the same conflicting files as againstorigin/main. #19285, #19281, #17015 and #15661 merge cleanly with this head.Pattern harvest
Rule candidate: review-prompt. A spawn in the owner posture (
minimal_env()+_context_clone_sandbox_mode()+ a_sel_credential_grant) states its socket request in the same call as the posture, so the halves of the posture cannot drift apart.grep -n "_sel_credential_grant("undersrc/kiro_crew/appslists every such spawn.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)