š fix(kavach): a git config read under -C passes, wherever -C points, 0.8.7
Merged
AT
7d ago+229+229+012345678901234567890123456789-4-4-0123456789
kavach 0.8.3 refused read-only git config under -C when -C pointed anywhere but the session's own worktree. It counted the -C folder as written, because git_is_read_only (packages/kavach/python/kavach/boundary.py) had no case for config. Both commands reported on 2026-11-23 now pass:
git -C <main checkout> config --show-scope --show-origin --get-all core.hooksPath, refused before for "holds ā¦/.githooks, a path worktree.protectedPaths keeps from agent sessions"git -C <another worktree> config --show-scope --show-origin --get-all core.hooksPath, refused before for "is outside this session's Claude worktree"
The change
git_config_is_readcounts a command as a read only when it is thegetorlistsubcommand, a reader option (--get,--get-all,--get-regexp,--get-urlmatch,--get-color,--get-colorbool,--list,-l) or a lone key. Every other option must be a display, type or location option, matched by exact name.- These stay writes:
--unset,--unset-all,--add,--replace-all,--remove-section,--rename-section,key value,set,unset,--edit,-eandedit. - These are not counted as reads either:
--(after it--listis a value), an abbreviation (--get-al), a short cluster (-le), a value option given an option (--file --unset) and a word the shell computes. git_is_read_onlyuses it together withgit_globals_are_inert, so--git-dir,--work-treeand-cbeforeconfigstay unproven.- kavach's README lists the new read form under "What read-only means".
- kavach and sarathi move to 0.8.7. v0.8.6 was tagged for #434 while this waited, with sarathi 0.8.6 on kavach 0.8.3; sarathi 0.8.7 depends on this kavach.
Evidence
- New
GitConfigReadUnderCTest(packages/kavach/python/tests/test_worktree_guard.py) runs each case through the adapter as sarathi runs it, with.githooks/protected:- 19 read forms pass against the main checkout, another worktree and the session's own worktree;
- 18 write forms are refused against the main checkout and another worktree.
- Red: with the
configbranch switched off, the read test fails 38 times, with exactly the two reported refusals (19 per folder). - Hand mutants, both killed: accepting two positionals fails
config core.hooksPath /dev/nullandconfig user.name corpus; accepting an option as a value's value failsconfig --file --unset core.hooksPath. - Corpus: new rows that must pass,
git -C {P} configreads (outside-write and hook-bypass); new rows that must stay refused, an--unset,--addor--replace-allofcore.hooksPathunder-C {P}, andgit -C {P} config -f pwned core.x y. The oracle confirms each row's truth. pnpm test:python: 933 tests OK.pnpm test(kavach TS and corpus): 767/767 pass.
The mutation gate's kavach lane covers only packages/kavach/src/*.ts, which this change does not touch.
Slice: #436
š¤ Generated with Claude Code