Skip to content

[codex] compact network context rendering#21875

Merged
sayan-oai merged 1 commit into
mainfrom
codex/compact-network-context-rendering
May 9, 2026
Merged

[codex] compact network context rendering#21875
sayan-oai merged 1 commit into
mainfrom
codex/compact-network-context-rendering

Conversation

@sayan-oai
Copy link
Copy Markdown
Collaborator

@sayan-oai sayan-oai commented May 9, 2026

Why

The model-visible <network> context currently repeats indentation and a pair of XML tags for every allowed or denied domain. Large domain sets spend a surprising amount of prompt budget on that scaffolding instead of the actual policy values.

What changed

  • Render allowed domains as one comma-separated <allowed> value instead of one element per domain.
  • Render denied domains the same way.
  • Keep the full allow/deny domain sets model-visible while updating the serialization and settings-update coverage for the denser shape.

Example

Before:

<network enabled="true">
  <allowed>api.example.test</allowed>
  <allowed>cdn.example.test</allowed>
  <denied>blocked.example.test</denied>
</network>

After:

<network enabled="true"><allowed>api.example.test,cdn.example.test</allowed><denied>blocked.example.test</denied></network>

Validation

  • cargo test -p codex-core environment_context
  • cargo test -p codex-core build_settings_update_items_emits_environment_item_for_network_changes
  • Ran a local codex session with a real network context containing 121 allowed domains and 42 denied domains, then inspected the raw prompt with raw_token_viewer_cli.py. With the same domain set, the rendered <network> section shrank from 7,175 characters across 161 lines to 3,666 characters on one line, and the containing environment-context block fell from 6,428 tokens to 5,379 tokens.

@sayan-oai sayan-oai requested a review from a team as a code owner May 9, 2026 03:25
@sayan-oai sayan-oai enabled auto-merge (squash) May 9, 2026 03:46
@sayan-oai sayan-oai merged commit 77d9223 into main May 9, 2026
32 of 34 checks passed
@sayan-oai sayan-oai deleted the codex/compact-network-context-rendering branch May 9, 2026 03:52
@github-actions github-actions Bot locked and limited conversation to collaborators May 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants