Skip Git enrichment for prewarm and Guardian turns (#34728)

## Why

Startup prewarms and Guardian review sessions do not need workspace Git metadata. Collecting it for those requests performs redundant work, while user turns still need a fresh view of the repository.

## What changed

- Add a per-session Git enrichment policy.
- Skip enrichment for startup prewarm, preview, and Guardian review turns.
- Keep fresh enrichment enabled for regular sessions and one-shot delegated turns.

## Testing

- Cover prewarm and Guardian requests omitting workspace metadata while subsequent user turns observe repository changes.
- Cover concurrent repositories and worktrees retaining distinct metadata.
- Verify concurrent enrichment is coalesced and canceled enrichment can be retried.

GitOrigin-RevId: 4a68615288bb568c75f2e487d9c0776e3e80f191
This commit is contained in:
acrognale-oai authored and copyberry committed 2026-07-22 10:47:51 +00:00
1 parent 9fc715c086
commit 33d394c69e
12 files changed
+691 -21

No files matched your search

@@ -210,6 +210,7 @@ async fn run_codex_thread_interactive_respects_pre_cancelled_spawn() {
cancel_token,
SubAgentSource::Review,
/*initial_history*/ None,
crate::session::GitEnrichmentPolicy::Fresh,
),
)
.await