Commit Graph
68 Commits
Author SHA1 Message Date
Chris Bookholt 2b8ce702a7 Merge commit '97dee6c2b8' into codex/psec-4394-git-05b-stage-filters 2026-07-02 01:58:57 -07:00
Chris Bookholt 97dee6c2b8 git-utils: fix Windows test import guards 2026-07-02 01:58:34 -07:00
Chris Bookholt 3e4c7d6380 Merge commit 'fab7d5a1e6aeebabdca0cea4dd09b5f9ad1a2d4e' into codex/psec-4394-git-05b-stage-filters 2026-07-02 01:42:45 -07:00
Chris Bookholt 34f1bb3ee0 git-utils: integrate exact staging with repository authority 2026-07-02 01:42:30 -07:00
Chris Bookholt fab7d5a1e6 git-utils: fix Windows authority and test fixtures 2026-07-02 01:33:44 -07:00
Chris Bookholt 5632dfd765 git-utils: support older Git boolean ranges 2026-07-02 01:01:44 -07:00
Chris Bookholt e8b30bd7d3 git-utils: integrate filter guards with repository authority 2026-07-02 00:46:29 -07:00
Chris Bookholt 801018897f Merge repository authority into apply filter guard 2026-07-02 00:16:26 -07:00
Chris Bookholt 7a4648aff4 git-utils: normalize junction fixture paths 2026-07-01 23:42:37 -07:00
Chris Bookholt 5a95b65f57 git-utils: gate Unix-only authority fixtures 2026-07-01 23:19:38 -07:00
Chris Bookholt 4430c51039 git-utils: fix Windows repository authority tests 2026-07-01 23:07:18 -07:00
Chris Bookholt 9c0e48eba6 git-utils: fix Windows repository authority checks 2026-07-01 22:27:54 -07:00
Chris Bookholt bf70395505 git-utils: make registry retarget test deterministic 2026-07-01 21:42:21 -07:00
Chris Bookholt daca14580c git-utils: fix Windows authority build 2026-07-01 21:30:49 -07:00
Chris Bookholt bcf026cbca git-utils: centralize repository authority and trusted Git launch 2026-07-01 21:19:17 -07:00
Chris Bookholt 17f491ab67 git-utils: stage patch paths without recursive add 2026-07-01 18:57:30 -07:00
Chris Bookholt 9a21b607e3 Merge branch 'codex/psec-4394-git-02-effective-patch-paths' into codex/psec-4394-git-03-path-containment 2026-07-01 16:50:50 -07:00
Chris Bookholt f303ab00da Merge commit '300bbcbf5c' into codex/psec-4394-git-02-effective-patch-paths 2026-07-01 16:50:46 -07:00
Chris Bookholt 300bbcbf5c git-utils: clarify raw PATH rejection 2026-07-01 16:50:40 -07:00
Chris Bookholt efbd215b81 Merge branch 'codex/psec-4394-git-02-effective-patch-paths' into codex/psec-4394-git-03-path-containment 2026-07-01 16:49:45 -07:00
Chris Bookholt 1ea2e7fcc4 Merge commit 'edda59a703' into codex/psec-4394-git-02-effective-patch-paths 2026-07-01 16:49:32 -07:00
Chris Bookholt edda59a703 git-utils: fix Windows traversal regression test 2026-07-01 16:49:19 -07:00
Chris Bookholt d98e980a31 git-utils: scope filter test helpers to tests 2026-07-01 16:34:53 -07:00
Chris Bookholt f2874f80f9 Merge branch 'codex/psec-4394-git-05a-apply-filters' into codex/psec-4394-git-05b-stage-filters 2026-07-01 16:21:28 -07:00
Chris Bookholt 68da17b9d8 Merge branch 'codex/psec-4394-git-03-path-containment' into codex/psec-4394-git-05a-apply-filters 2026-07-01 16:21:13 -07:00
Chris Bookholt 21bcee35e4 Merge branch 'codex/psec-4394-git-02-effective-patch-paths' into codex/psec-4394-git-03-path-containment 2026-07-01 16:21:00 -07:00
Chris Bookholt e76a347987 Merge branch 'codex/psec-4394-trusted-git-runner' into codex/psec-4394-git-02-effective-patch-paths 2026-07-01 16:20:46 -07:00
Chris Bookholt f062f6916e git-utils: reject raw Windows PATH traversal 2026-07-01 16:20:33 -07:00
Chris Bookholt 19a85ed470 git-utils: normalize required filter booleans 2026-07-01 16:13:43 -07:00
Chris Bookholt 9dcd750de7 Merge apply filter neutralization into staging guard 2026-07-01 16:09:25 -07:00
Chris Bookholt edce1cb0c5 git-utils: refine staging filter policy 2026-07-01 16:00:25 -07:00
Chris Bookholt 98635fbb42 Merge branch 'codex/psec-4394-git-03-path-containment' into codex/psec-4394-git-05a-apply-filters 2026-07-01 15:59:00 -07:00
Chris Bookholt bed78fad06 git-utils: neutralize off-path filter helpers 2026-07-01 15:58:52 -07:00
Chris Bookholt 48fde8c368 Merge branch 'codex/psec-4394-git-02-effective-patch-paths' into codex/psec-4394-git-03-path-containment 2026-07-01 15:51:09 -07:00
Chris Bookholt 5045e45bf8 Merge branch 'codex/psec-4394-trusted-git-runner' into codex/psec-4394-git-02-effective-patch-paths 2026-07-01 15:51:00 -07:00
Chris Bookholt b262c52803 git-utils: mirror resolver roots in traversal test 2026-07-01 15:50:37 -07:00
Chris Bookholt 4bf391509e Merge branch 'codex/psec-4394-git-03-path-containment' into codex/psec-4394-git-05a-apply-filters
# Conflicts:
#	codex-rs/git-utils/src/apply.rs
2026-07-01 15:25:38 -07:00
Chris Bookholt 17920f9a57 Merge branch 'codex/psec-4394-git-02-effective-patch-paths' into codex/psec-4394-git-03-path-containment 2026-07-01 15:24:02 -07:00
Chris Bookholt 6a7530f161 Merge branch 'codex/psec-4394-trusted-git-runner' into codex/psec-4394-git-02-effective-patch-paths 2026-07-01 15:23:52 -07:00
Chris Bookholt 9ec1720f7c git-utils: reject Git from enclosing repositories 2026-07-01 15:22:59 -07:00
Chris Bookholt 5b1fe8c0f2 git-utils: fix selected filter edge cases 2026-07-01 15:17:42 -07:00
Chris Bookholt db8a0aeadf git-utils: block selected filters before staging 2026-07-01 10:43:30 -07:00
Chris Bookholt 0b84913ea8 git-utils: block selected patch filters 2026-07-01 10:21:29 -07:00
Chris Bookholt c21e78bbd6 git-utils: normalize Windows junction test paths 2026-07-01 10:20:33 -07:00
Chris Bookholt 4c0a1feded git-utils: consume confined staging candidates 2026-07-01 09:57:14 -07:00
Chris Bookholt 7cdf6b09bc git-utils: confine staged paths to the worktree 2026-07-01 09:34:06 -07:00
Chris Bookholt 843f07e265 Derive effective patch paths through Git 2026-07-01 08:37:37 -07:00
Chris Bookholt 2ca4f55c0d Bind Git worktree helpers to a trusted executable 2026-07-01 07:45:11 -07:00
Chris Bookholt f6122dbf59 Deny transport for local-only Git operations 2026-06-29 15:46:01 -07:00
jif 39aab9fc45 Pipeline bounded AGENTS.md and Git root probes (#29870)
## Why

When Codex uses a remote `ExecutorFileSystem`, every `get_metadata` call
is an exec-server round trip. Upward discovery currently pays those
round trips serially in two latency-sensitive places:

- session startup, while locating the configured project root before
loading `AGENTS.md`; and
- Git-root discovery, which runs before per-turn Git diff enrichment.

The goal is to remove the serial ancestor dependency without adding a
new filesystem RPC, JSON-RPC batch method, Git executable dependency, or
cache.

## Example

Assume this layout, with `.git` as the configured project-root marker:

```text
/workspace/repo/.git
/workspace/repo/AGENTS.md
/workspace/repo/crates/core/    <- cwd
```

The marker probes have this required precedence:

```text
1. /workspace/repo/crates/core/.git
2. /workspace/repo/crates/.git
3. /workspace/repo/.git
4. /workspace/.git
5. /.git
```

Previously, probe 2 was not sent until probe 1 returned, and probe 3 was
not sent until probe 2 returned. With this change, the client lazily
keeps up to eight ordinary `fs/getMetadata` requests in flight, but
consumes their results in the order above. Codex must still learn that
probes 1 and 2 are absent before accepting probe 3, so the nearest root
always wins. Once probe 3 succeeds, the client has its answer and stops
awaiting probes 4 and 5. Requests that were already sent may still
finish on the worker.

For the marker phase alone, with a 50 ms client-to-worker round trip and
fast local metadata calls, finding the root at probe 3 changes from
roughly three serialized round trips (150 ms) to one round trip plus
worker processing. The later `AGENTS.md` candidate phase remains
separate and ordered.

Only after `/workspace/repo` is selected does `AGENTS.md` discovery
check instruction candidates, in root-to-cwd order:

```text
/workspace/repo/AGENTS.override.md
/workspace/repo/AGENTS.md
/workspace/repo/crates/AGENTS.override.md
/workspace/repo/crates/AGENTS.md
/workspace/repo/crates/core/AGENTS.override.md
/workspace/repo/crates/core/AGENTS.md
```

The first configured candidate found in each directory wins. These
checks remain ordered and no instruction candidate above
`/workspace/repo` is issued. Git-root discovery uses the same bounded
lookup with only `.git` as the marker.

## What changed

- Added a client-side find-up helper that generates `ancestor x marker`
probes lazily, nearest directory first and configured marker order
within each directory.
- Uses an ordered concurrency window of eight scalar metadata requests.
This bounds executor load while preserving nearest-root and marker
precedence.
- Reuses the helper for both configured project-root discovery and
remote Git-root discovery.
- Keeps Git ancestor and marker construction in `AbsolutePathBuf`,
converting only each complete `.git` probe to `PathUri`. This preserves
native paths that require an opaque URI fallback, such as Windows
namespace paths.
- Preserves existing error behavior: `AGENTS.md` discovery propagates
non-`NotFound` metadata errors, while Git discovery treats a failed
marker probe as absent and continues upward.
- Reads each discovered `AGENTS.md` directly instead of statting it a
second time.

No filesystem trait or exec-server protocol method is added. An empty
`project_root_markers` list performs no ancestor-marker I/O and checks
instruction candidates only in `cwd`. This change also deliberately does
not cache roots across turns.

## Symlinks

Upward traversal remains **lexical**. The helper does not canonicalize
`cwd`; it appends marker names to the supplied path and walks that
path's textual parents. The filesystem performs the actual metadata/read
operation, and the current local and exec-server implementations follow
live symlink targets.

For example:

```text
/tmp/pkg -> /workspace/repo/packages/pkg
cwd = /tmp/pkg/src
actual Git marker = /workspace/repo/.git
```

The lexical probes are `/tmp/pkg/src/.git`, `/tmp/pkg/.git`,
`/tmp/.git`, and `/.git`. They do not jump from `/tmp/pkg` to the
target's parent `/workspace/repo`, so this spelling of `cwd` does not
discover `/workspace/repo/.git`. That is the existing behavior and is
unchanged by this PR.

Conversely, if `/tmp/repo -> /workspace/repo`, then probing
`/tmp/repo/.git` follows the directory symlink and finds
`/workspace/repo/.git`; the reported root remains the lexical path
`/tmp/repo`. A live symlink used directly as `.git`, another configured
marker, or `AGENTS.md` is also followed. A symlinked `AGENTS.md` is
loaded when its target is a regular file, while a broken symlink behaves
as `NotFound`.
2026-06-24 22:58:34 +01:00