Skip to content

Drop the filter-override listing from the .git guard's object read (#512) - #520

Merged
renmengye merged 2 commits into
mainfrom
perf/git-check-cost
Oct 11, 2026
Merged

renmengye merged 2 commits into
mainfrom
perf/git-check-cost

Conversation

@renmengye

Copy link
Copy Markdown
Member

Fixes part of #512. Before this change, every guarded kernel git call ran four subprocesses: the .git guard's own object read (cat-file -e), a git config --get-regexp filter-override listing for that read, another listing for the real command, and the real command. The listing for the guard's read is useless. cat-file -e only resolves an object in the store and never converts working-tree files, so no filter driver can run in it.

The change: the guard's read calls _git_env(None), with no root, so no listing runs. It keeps the rest of the git environment: global and system config pinned to /dev/null, GIT_NO_REPLACE_OBJECTS, core.attributesFile=/dev/null, and the SAFE_GIT_FLAGS argv. The real command's listing is untouched, so its position and freshness are unchanged: it still runs after the config sanitize and immediately before the command. Nothing is cached, and nothing that is refused or neutralized changes.

Measured on the slowest test, test_author_sleep_wake_keeps_its_snapshot_when_the_terminal_record_fails:

  • 1,277 → 959 subprocesses
  • tests/test_attempt.py runs about 12% faster (≈134 s → 117 s)

Production saves one subprocess on every guarded git call.

Rejected alternatives:

  • A pure-Python object lookup instead of cat-file. That would weaken the guard, because cat-file -e inflates the object and rejects a corrupt one.
  • A cross-call cache of the listing, keyed on the config file. It could be made airtight, but it is more machinery than one dropped subprocess is worth.

The remaining cost in #512 is the guard's cat-file itself and the per-call listing. Both are left open.

Built by GLM-5.3 (self-reviewed, with a call-site audit), security-reviewed by Codex (clean), final read and simplification by Claude Opus 5.5. GLM's version added a pairs parameter to _git_env, which turned out to be unnecessary.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Round 1 — reviewed head 22f1981c — reviewer summarizer:hermes/gpt-5.6-terra over coverage+credentials+deployment+general+lifecycle+prose.

terra
Advisory findings from outerloop — the code owner decides. Reply to disagree; the outerloop:no-review label opts this PR out.

Verdict: nothing blocking — 1 advisory note.

1 finding attached to the lines below.

Merged verdict: one non-blocking coverage suggestion. Rejected findings: none.

Comment thread src/outerloop/github.py
@renmengye
renmengye merged commit 1e5d75e into main Oct 11, 2026
16 checks passed
@renmengye
renmengye deleted the perf/git-check-cost branch October 11, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant