Allow model catalogs to omit writable-root sentences (#64837)

## Why

The environment context already lists writable paths. An empty catalog
template previously fell back to the bundled writable-root sentence,
so a model catalog had no way to omit that repeated list.

## What changed

Treat an empty `writable_root` or `writable_roots` template as a request
to omit the corresponding sentence. Missing, null, invalid nonempty,
and oversized templates still use the bundled wording.

Suppressed roots leave the full path budget available for denied-read
paths and globs and never trigger an omitted-path warning on their own.

## Testing

Cover empty singular and plural templates and verify that suppressed
roots leave room for denied-read entries. A model-switch scenario checks
that Codex appends the updated permissions message once and preserves
the earlier conversation, filesystem permissions, and approval settings.

GitOrigin-RevId: 105819fb07ff829be8f111b3676656373aeb7892
This commit is contained in:
goodman-oai
2026-12-01 00:29:20 +00:00
committed by copyberry
parent 404eb8b39a
commit 83545f3514
8 changed files with 397 additions and 49 deletions
+4 -2
View File
@@ -909,11 +909,13 @@ pub struct PermissionMessages {
#[serde(default, skip_serializing_if = "Option::is_none")]
pub approved_command_prefix_saved: Option<CodexCachedStr>,
/// Single writable-root sentence with exactly one `{{ roots }}` placeholder.
/// Missing, null, empty, invalid, or oversized templates use the bundled sentence.
/// An empty string suppresses the sentence. Missing, null, invalid, or oversized
/// templates use the bundled sentence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub writable_root: Option<CodexCachedStr>,
/// Multiple writable-roots sentence with exactly one `{{ roots }}` placeholder.
/// Missing, null, empty, invalid, or oversized templates use the bundled sentence.
/// An empty string suppresses the sentence. Missing, null, invalid, or oversized
/// templates use the bundled sentence.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub writable_roots: Option<CodexCachedStr>,
/// Optional presentation before the harness-owned omission and no-bypass warning.