Skip to content

Render delegated patch approval details#19709

Merged
etraut-openai merged 1 commit into
mainfrom
etraut/fix-subagent-command-bubbling
Apr 27, 2026
Merged

Render delegated patch approval details#19709
etraut-openai merged 1 commit into
mainfrom
etraut/fix-subagent-command-bubbling

Conversation

@etraut-openai

@etraut-openai etraut-openai commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

Why

Fixes #19632.

When a delegated agent requests approval for an in-progress file change, the parent TUI handles that request from an inactive thread. The app server already sent the FileChange item with the proposed diff, but the inactive-thread approval path was not recovering and rendering it the same way as the active-thread path.

The result was an inconsistent approval prompt: main-thread edits show a normal patch preview history item before the approval modal, while delegated edits did not show that preview in the transcript flow.

What Changed

  • Recover buffered or historical FileChange item changes when building inactive-thread file-change approval requests.
  • Reuse the app-server file-change conversion helper for both live transcript rendering and inactive-thread approvals.
  • Render recovered delegated patches as a normal patch preview history cell before the approval modal.
  • Keep apply-patch approval modals focused on the decision prompt and optional metadata; they do not render a synthetic command line or embed the diff body.

Manual Repro And Verification

I manually reproduced the issue using a file under ~/Desktop so the write would require approval.

Before the fix:

  1. Ask the main thread: Use apply_patch, not shell redirection or Python, to create ~/Desktop/bug1.txt with three short lines.
  2. Observe the expected TUI shape: the transcript shows a normal patch preview such as • Added ~/Desktop/bug1.txt (+N -0) above the approval modal, and the modal contains only the approval prompt/options without a synthetic command line.
  3. Ask for the delegated path: Spawn a worker. Have it use apply_patch, not shell redirection or Python, to create ~/Desktop/bug1.txt with four short lines.
  4. Observe the delegated approval is inconsistent: the parent view does not render the proposed patch as the normal transcript preview before the modal, so the diff context is missing from the stream or appears inside the modal instead of in the history flow.

After the fix:

  1. Repeat the delegated worker prompt with apply_patch.
  2. Confirm the parent view renders the same normal patch preview history cell (• Added ~/Desktop/bug1.txt (+N -0) plus the diff) immediately before the approval modal.
  3. Confirm the approval modal remains focused on the decision prompt. For delegated approvals it may show the worker thread label, but it should not show a $ apply_patch command line or embed the diff body in the modal.

@etraut-openai etraut-openai requested a review from a team as a code owner April 26, 2026 20:35
@etraut-openai etraut-openai force-pushed the etraut/fix-subagent-command-bubbling branch from bceb1d4 to e5cedd7 Compare April 26, 2026 21:04
@etraut-openai etraut-openai changed the title Show command for subagent patch approvals Render delegated patch approval details Apr 26, 2026
@etraut-openai etraut-openai force-pushed the etraut/fix-subagent-command-bubbling branch from e5cedd7 to db95df5 Compare April 26, 2026 21:17

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: db95df542a

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/bottom_pane/approval_overlay.rs Outdated
@etraut-openai etraut-openai force-pushed the etraut/fix-subagent-command-bubbling branch 3 times, most recently from 5f5f3a2 to 8703458 Compare April 26, 2026 23:58

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87034588e3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/tui/src/app/thread_routing.rs Outdated
@etraut-openai etraut-openai force-pushed the etraut/fix-subagent-command-bubbling branch from 2789968 to 0146950 Compare April 27, 2026 02:12

@fcoury-oai fcoury-oai left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for the replication instructions, it made my life much easier. I indeed replicated the issue and verified it works on this branch.

Code looks good! Approved.

@etraut-openai etraut-openai merged commit 48dd7b5 into main Apr 27, 2026
25 checks passed
@etraut-openai etraut-openai deleted the etraut/fix-subagent-command-bubbling branch April 27, 2026 17:07
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 27, 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.

Subagent hit sandbox, TUI wouldn't show me the command

2 participants