Repository navigation
fix(notes): pin pack programs with command-line flags on vault git calls - #25581
Conversation
A vault's own remote.origin.uploadpack/receivepack in .git/config won over the GIT_CONFIG_* pins, because git keeps the first value it reads for those keys. run_git now adds --upload-pack/--receive-pack to fetch, pull, push, ls-remote and clone, matching Papyrus. Fixes #24845
UX Review (Opus 5.5) — ⏭️ skippedRevision |
Design Review (Opus 5.5) — ✅ PASSDesign-level review of Design-Verdict: PASS Nothing blocks. The pin goes on as a command-line flag at the single Notes
[DESIGN-REVIEWED] 9d1d6c1 Description read[DESCRIPTION-READ] c6015febd484e51fdc7526d23bdb9cf1cf4f2d67c2a6a843b9f5cb8ea04fac33 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 |
First Principles Review (Opus 5.5) — ✅ PASSPremise-level review of First-Principles-Verdict: PASS This fixes the cause: a first-wins key that a config pin can't override. It is fixed with the command-line flag at the single Notes
What this change shipsInventory (3 items) — 2 justifiedIntent: stop a Notes vault's own
[FIRST-PRINCIPLES-REVIEWED] 9d1d6c1 Description read[DESCRIPTION-READ] da5812d2c04ec9a16b7ae9249473da1a1116afbbac98976392e00bcc65bc7ab2 That sha256 names the PR description this verdict read. Recompute it with |
Opus 5.5 Review — ✅ no blocking findingsReviewed Review detailsNo findings. Notes:
[OPUS-REVIEWED] 9d1d6c1 Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
GPT 6.1 Review — ✅ no blocking findingsGPT 6.1 completed its review of This comment is updated in place on each push. Review detailsNo findings. False positive or not applicable? A repository writer can comment: |
|
HOLD (policy-sensitive) at 9d1d6c1. The fix looks right. One point for that reviewer: Opus notes that submodule children of a recursive fetch or push read their own pack-program config. Fetch recursion is already pinned off on every AI findings judged non-blocking: First Principles' duplicated helper (identical to Papyrus today) and Design's note that a future What clears it: a human maintainer review, plus a decision on the push-recursion point. — crew-pr-reviewer (r135) |
KiroCrewCaptain
left a comment
There was a problem hiding this comment.
Approved on behalf of the watch holder (bolichen). Design and First Principles pass on this head (or skipped / author override), UX skipped or pass, no conflict, no open change request.
Problem / Motivation
Goal: a Notes vault's own
.git/configcan no longer pick the program git runs forupload-pack/receive-packwhen Notes syncs.Notes (
md_notebook) pinsremote.origin.uploadpackandremote.origin.receivepackthroughGIT_CONFIG_*and expects that to override the vault's config. For these two keys git keeps the FIRST value it reads, and.git/configis read before any-c/GIT_CONFIG_*entry. So a vault-set value wins, and on a local/file remote git executes it during sync.Why it matters
A vault is an ordinary checkout an agent can write to. A
remote.origin.uploadpack=<script>line in its.git/configruns that script with the gateway's privileges, outside any sandbox, the next time the background syncer fetches.Not a goal
Intended? / Repro
Intended? No. The comment above the pins on main says they restore git's defaults "over anything in .git/config" (
src/kiro_crew/apps/builtins/md_notebook/git_ops.py:306-311); git does not honour that order for these keys.Repro (real git 2.50.1, local bare remote):
git config remote.origin.uploadpack <script that touches a marker>in the clone.GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=remote.origin.uploadpack GIT_CONFIG_VALUE_0=git-upload-pack git fetch originprintserror: more than one uploadpack given, using the firstand the marker file is created.git fetch --upload-pack=git-upload-pack originon the same clone: no marker.The sync path uses exactly that env (
run_git→_auth_env) forfetch origin(git_ops.py:1305) andpush origin(git_ops.py:1371).Papyrus (
src/kiro_crew/apps/builtins/papyrus/backend/gitops.py:187-221) is not affected: it already passes--upload-pack/--receive-packon every remote subcommand through_pack_program_args.What changed (motivation → approach → change)
Symptom: a vault-set pack program runs during sync. Cause: a config pin cannot outrank a first-wins key already set in
.git/config. Change: pin it with the command-line flag, which beats every config file for that call.md_notebook/git_ops.py:_pack_program_argsadds--upload-pack=git-upload-packtofetch,pull,ls-remote,cloneand--receive-pack=git-receive-packtopush, right after the subcommand.run_gitapplies it, so every call site is covered at one chokepoint. Same shape as Papyrus.GIT_CONFIG_*pins stay; their comment says they are not the guarantee.Security
area: securitycode: it decides which program git may execute during an unsandboxed background sync. The change only adds argv flags that force git's own default programs; nothing that was refused becomes allowed.Backwards compatibility
Compatible: a vault with no pack-program config runs the same programs as on main (
git-upload-pack/git-receive-packare git's defaults).Removes nothing: no config key, field or error path is removed.
Tests
test/test_md_notebook_git_trust.py:test_pack_program_flags_pin_every_remote_subcommand: the flag lands afterfetch/push/clone;statusand a-c-prefixedmergeare unchanged.test_pack_program_flags_beat_a_vault_set_uploadpack_and_receivepack: real git, a cloned vault whose.git/configsets both keys to a marker-writing script;run_gitfetch and push leave no marker. On main the fetch creates the marker.Proof: not provable -- other: this host runs no local tests; CI runs them
Manual verification
The real-git repro above was run on this host against a scratch bare remote. Static gates run locally: black, isort, flake8,
scripts/check_file_line_cap.py,scripts/check_comment_history.py. Tests run in CI.Screenshots
Why no screenshot: backend git argv only; nothing rendered changes.
Related Issues
Fixes #24845
Sibling sweep
Swept: git grep -ln "remote.origin.uploadpack|remote.origin.receivepack|upload-pack=|receive-pack=" -- src/
Sibling: src/kiro_crew/apps/builtins/md_notebook/git_ops.py -- changed here
Sibling: src/kiro_crew/apps/builtins/papyrus/backend/gitops.py -- not affected (already passes the flags via
_pack_program_args)Sibling: src/kiro_crew/cli_server_update.py -- not affected (already passes
--upload-pack=git-upload-pack)Sibling: src/kiro_crew/dashboard/handlers/updates_apply.py -- not affected (already passes
--upload-pack=git-upload-pack)Sibling: src/kiro_crew/platform/update_governance.py -- not affected (refuses repo-set pack programs)
Sibling: src/kiro_crew/apps/builtins/dev_fleet/repository.py -- not affected (mentions the flag only in option-injection comments; sets no pack-program pin)
Sibling: src/kiro_crew/apps/builtins/ops_mission_control/backend/ledger_sync.py -- not affected (option-injection comments only)
Sibling: src/kiro_crew/apps/builtins/design_critique/backend/routes.py -- not affected (option-injection comment only)
Pattern harvest
Rule candidate: for git keys that are first-value-wins (
remote.<name>.uploadpack/.receivepack), a-c/GIT_CONFIG_*pin does not override repo config. Pin with the subcommand's own flag instead.Checklist
feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)Contribution License Agreement
Contributed under the project's Apache-2.0 license.