Skip to content

fix(tui): render network approval history by target#22229

Merged
fcoury-oai merged 2 commits into
mainfrom
fcoury/red-network-approval-history
May 14, 2026
Merged

fix(tui): render network approval history by target#22229
fcoury-oai merged 2 commits into
mainfrom
fcoury/red-network-approval-history

Conversation

@fcoury-oai
Copy link
Copy Markdown
Contributor

@fcoury-oai fcoury-oai commented May 11, 2026

Why

Network approval prompts are rendered without a command string on the app-server path. After the user approves one of those prompts, the TUI history cell previously fell back to command-oriented copy and produced malformed lines such as:

You approved codex to run  every time this session

That hid the network target the user actually approved and left a visibly broken transcript entry.

What changed

  • Preserve the approval subject as either a command or a network target when recording TUI approval decisions.
  • Render target-aware history copy for network approval outcomes:
    • approve once
    • approve for the current session
    • cancel
  • Include the approval protocol and preserve the managed-proxy network-access target when present, including non-default ports such as https://example.com:8443.
  • Fall back to formatting the network approval context as protocol://host when no generated target command is available.
  • Keep ordinary command approval history, Guardian approval history, and persisted network-rule history behavior unchanged.
  • Add focused regression coverage and snapshots for the three network-history cases.

How to Test

  1. Start Codex in a flow that triggers a network approval prompt.
  2. Approve network access only for the current conversation.
  3. Confirm the transcript records the approved network target, for example:
    • You approved codex network access to https://example.com:8443 every time this session
  4. Trigger the prompt again and verify the one-time approval and cancel paths also record target-specific history text instead of an empty command gap.

Targeted automated coverage:

  • cargo test -p codex-tui network_exec_approval_history

Additional verification

  • cargo insta pending-snapshots
  • git diff --check
  • just fix -p codex-tui
  • just argument-comment-lint

Known unrelated local test noise

A full cargo test -p codex-tui run still hits a pre-existing stack overflow outside this change:

  • tests::fork_last_filters_latest_session_by_cwd_unless_show_all aborts with a stack overflow

@fcoury-oai fcoury-oai requested a review from a team as a code owner May 11, 2026 23:46
@fcoury-oai fcoury-oai force-pushed the fcoury/red-network-approval-history branch 2 times, most recently from 3a9e513 to e70dbbf Compare May 12, 2026 02:05
@fcoury-oai fcoury-oai changed the title fix(tui): render network approval history by host fix(tui): render network approval history by target May 12, 2026
@fcoury-oai fcoury-oai force-pushed the fcoury/red-network-approval-history branch from e70dbbf to ef13220 Compare May 12, 2026 02:57
@canvrno-oai
Copy link
Copy Markdown
Contributor

When testing this, the action being performed is not rendered in the message following my approval. Examples:

✔ You approved codex to run this time

✔ You approved codex to run every time this session

@fcoury-oai
Copy link
Copy Markdown
Contributor Author

When testing this, the action being performed is not rendered in the message following my approval. Examples:

✔ You approved codex to run this time

✔ You approved codex to run every time this session

Thanks for catching this. I found a fallback path where the approval history could still render an empty command subject, which produced the run this time / run every time this session messages.

Pushed d3797e1 to handle that case by rendering a generic this request fallback instead of a blank action, and by recognizing network-access <target> as a network approval target even when structured network context is missing.

Would you mind doing another pass at your convenience? Thx again.

@fcoury-oai fcoury-oai force-pushed the fcoury/red-network-approval-history branch from d3797e1 to e2db9bb Compare May 14, 2026 00:41
Copy link
Copy Markdown
Contributor

@canvrno-oai canvrno-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested with the latest changes, looks good!

@fcoury-oai fcoury-oai merged commit 5a02962 into main May 14, 2026
31 checks passed
@fcoury-oai fcoury-oai deleted the fcoury/red-network-approval-history branch May 14, 2026 17:33
@github-actions github-actions Bot locked and limited conversation to collaborators May 14, 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