Repository navigation
Bound gitleaks scans on macOS: per-user lock and 6 GiB footprint watchdog (Jetsam 2026-09-24) - #193
Merged
Conversation
…hdog The 2026-09-24 09:45/09:46 Jetsam events (three gitleaks processes at 52.8, then 58.2 GiB) came from gitleaks 8.30.1 redaction: filter() calls Finding.Redact for every finding, and Redact copies the finding's whole line. A git-mode hunk holds whole lines, so the generated explorer's 2,335 findings on one 12.9 MB line retain about 28 GiB. The global pre-commit hook hit it on test scratch commits (before #181); the recipe's all-refs history scan hits it on the 240 commits that touch the explorer. adoption/tools/gitleaks-guarded-macos gives macOS the Linux launcher's caps without a cgroup: one scan per user through a flock that waits up to 60 s (exit 75), a watchdog that sums the scan tree's physical footprint every 50 ms and kills it above 6 GiB (exit 137) or after 600 s (exit 124), and refusals (exit 78) before any scan. Gitleaks arguments, output and exit codes are otherwise unchanged. --max-target-megabytes and path exclusions were measured and rejected: the size skip turned 2,335 findings into "no leaks found". Before/after peaks for every candidate invocation on this Mac are in evidence/receipts/gitleaks-macos-memory-bound-20260924.json. The global hook belongs to agent-ecosystem and is handed off to its owner, not edited here. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
tests/test_stack_lifecycle requires every stack.json evidence id to appear in the token-native saturation audit's public_receipts row, which another lane owns. The receipt stays registered in manifests/evidence.json on its own; stack.json is back to its base bytes and hash. Co-Authored-By: Claude Opus 5.5 <[email protected]>
seathatflowsinourveins
deleted the
claude/mystifying-franklin-12a679
branch
September 24, 2026 15:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
At 09:45 and 09:46 EDT on 2026-09-24, Jetsam on the 24 GB MacBook Pro (M5 Pro, macOS 26.5.1) recorded three concurrent gitleaks 8.30.1 processes. Together they used 52.8 GiB, then 58.2 GiB, with the compressor holding about 80 to 84 GiB of data. macOS killed 405 processes, then 4,255.
Root cause. gitleaks'
filter()callsreport.Finding.Redactfor every finding.Redactrunsstrings.ReplaceAlloverFinding.Line, so it keeps one full copy of the matched line per finding. In git mode, a-U0hunk holds whole lines. The generated explorer (docs/ecosystem/index.html) is one 12,889,851-byte line with 2,335 findings. That is about 30 GB, or 28 GiB, matching the 28.25 GiB process in the Jetsam report.gitleaks git --pre-commit --staged --redact …. The hook ran on scratch commits fromtests/test_catalog_freshness_propose.py, whoseTrackedExplorerSubprocessTestsforce-adds the explorer. These runs happened before Make tests hermetic against global and system git config #181 made the tests' git config hermetic.gitleaks git --redact=100hits the same problem: 240 commits in the history touch the explorer.dirmode reads files in bounded chunks, so it stays near 0.13 GiB.What changes
adoption/tools/gitleaks-guarded-macosis a macOS counterpart togitleaks-guarded, using only the Python standard library. It keeps upstream arguments, output and exit codes.flockon~/.local/state/ecosystem-gitleaks.lock. A read-only descriptor is enough, so sandboxed clients can take it. A second scan waits up to 60 s, then exits 75.tests/test_gitleaks_guarded_macos.py: structural checks on every host, a refusal check off macOS, and on macOS integration checks against stub binaries. They cover exit codes, the memory cap on a grandchild, the runtime cap, lock busy/wait/serialisation/holding, and each refusal.evidence/receipts/gitleaks-macos-memory-bound-20260924.jsonholds sanitized before/after measurements, registered inmanifests/evidence.json. It is not added to the gitleaks component'sevidence_ids, becausetests/test_stack_lifecyclewould then require a row in the token-native saturation audit, which belongs to another lane. The harness is underevidence/artifacts/gitleaks-macos-memory-bound-20260924/.adoption/tools/README.mdgets a macOS section that replaces "macOS has no equivalent".recipes/README.mdandadoption/update.mdpoint macOS runs at the guard.Measurements (this Mac, one scan at a time)
Peak is the sampled physical footprint of the process group (gitleaks + git + guard). The "before" runs were stopped by the measurement harness at its own cap, not by gitleaks.
git committhrough the installed hook, explorer stagedgitleaks git --redact=100, all refs--log-opts=HEAD --max-target-megabytes 2)gitleaks dir … "${PROJECT_ROOT}"(worktree)gitleaks dir .(worktree)gitleaks dir .in the main checkout (714 MB incl. nested worktrees)gitleaks dir .in a worktree with a 979 MB.runtimeRejected alternatives, all measured on the same host:
--max-target-megabytesfails open. It skips the oversized fragment at debug log level, so the staged explorer's 2,335 findings came back asno leaks foundwith exit 0..gitleaks.tomlheader), anddirmemory was already bounded.GOMEMLIMIT=4GiBstill crossed the cap, because the growth is live findings.memorystatus_control) returns EPERM.Limits. This is a user-space watchdog, not a kernel limit: measured overshoot was 0.04–0.20 GiB. If the guard itself is SIGKILLed, the scan runs on unwatched, though it keeps the lock. There is no CPU or task cap. A scan stopped at the cap produces no result. That is fail-closed, not coverage: this repository's all-refs history still has no complete redacted pass on macOS.
Hand-off (not edited here)
The global hook (
~/.config/git/hooks/pre-commit) is managed by agent-ecosystem'sconfig/git/hooks/dispatch. Its owner under the single-writer decision in seathatflowsinourveins/agent-ecosystem#28 is the foundation-lane-setup session. The change is handed off in seathatflowsinourveins/agent-ecosystem#40, which that session has taken. It reviewed this guard at b8cc293 and will vendor it pinned at the merge commit. The hand-off covers installing the guard, creating the lock once outside any sandbox, having the dispatcher call the guard, and routing the history-mirror scans through it. Nothing was installed on this host's PATH, no lock was created at the default path, and nothing global was edited.Checks
python3 scripts/validate.py: passed (69 components, 144 receipts, 5,239 hashed files).GITLEAKS_TESTS_REQUIRED=1 python3 -m unittest tests.test_gitleaks_config tests.test_adoption_guarded_runners tests.test_gitleaks_guarded_macos: 66 tests OK, 13 skipped (12 need a systemd--userscope; one runs only off macOS). Passes both sandboxed and unsandboxed.python3 -m unittest discover -s tests(unsandboxed, this Mac, head a1d446b): 3,958 tests, 1 failure, 511 skipped. The failure isLlamaWrapperQuotingTests.test_install_path_with_shell_syntax_is_data_in_the_wrapper, the known real-Mac failure (SIP stripsDYLD_LIBRARY_PATH) that Make the llama wrapper quoting test pass on SIP-enabled Macs (wrapper unaffected) #178 addresses; this PR doesn't touch it.tests/test_stack_lifecyclebecause of the component evidence link, fixed in a1d446b. That run also had 21 guard-test errors: an aborted local rebase briefly deleted the guard while it ran, so those errors are not results.Follow-ups
scripts/git-hooks/pre-commit, which runs the same--pre-commit --staged --redactscan without a bound. Routing it through this guard on macOS is flagged as a separate task."${PROJECT_ROOT}"reports 219 findings in a clean worktree, because the path-scoped allowlists and.gitleaksignorefingerprints are relative.gitleaks dir .from the main checkout also descends into the nested.claude/worktrees. This is flagged as a separate task.🤖 Generated with Claude Code