Add compact filesystem context for workspace-write profiles (#64164)

## Why

The filesystem context sent to the model repeats the same generated
read-only metadata entries under each writable path.

## What changed

Add the opt-in `features.compact_filesystem_context` flag. For matching
workspace-write profiles with multiple writable paths, list workspace
roots and other writable paths separately, then state the shared
read-only rule for `.git`, `.agents`, `.codex`, and `.aws` once.
Keep temporary-directory write grants explicit and use the full listing
for profiles with rules the summary cannot represent.

## Testing

Cover compact rendering and fallback for explicit metadata reads or
Windows paths with different casing. Snapshot shared and per-environment
context across two turns to verify that unchanged permissions carry
forward.

GitOrigin-RevId: 4e9f36a054a96f06c9e5d0b3882148b132233e4f
This commit is contained in:
Charlie Marsh
2026-11-26 15:09:58 +00:00
committed by copyberry
parent 61369c4e95
commit 42c320991e
10 changed files with 416 additions and 2 deletions
+8
View File
@@ -226,6 +226,8 @@ pub enum Feature {
DeferredExecutor,
/// Describe each selected environment's filesystem and permissions separately.
PerEnvironmentContext,
/// Describe uniform workspace-write permissions without repeating paths or nested XML.
CompactFilesystemContext,
/// Use the current working directory for turn diff display paths.
CwdRelativeTurnDiffs,
/// Enable runtime metrics snapshots via a manual reader.
@@ -1364,6 +1366,12 @@ pub const FEATURES: &[FeatureSpec] = &[
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::CompactFilesystemContext,
key: "compact_filesystem_context",
stage: Stage::UnderDevelopment,
default_enabled: false,
},
FeatureSpec {
id: Feature::CwdRelativeTurnDiffs,
key: "cwd_relative_turn_diffs",