Skip to content

Add /ide context support to the TUI#20294

Merged
etraut-openai merged 37 commits into
mainfrom
etraut/tui-ide-command
May 1, 2026
Merged

Add /ide context support to the TUI#20294
etraut-openai merged 37 commits into
mainfrom
etraut/tui-ide-command

Conversation

@etraut-openai

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

Copy link
Copy Markdown
Collaborator

Why

Users have asked for a /ide command in the TUI so Codex can use the active IDE session for live context such as the current file, open tabs, and selected ranges. We already support a similar feature in the Codex desktop app, so bringing it to the TUI makes sense.

One subtle compatibility constraint is that the injected prompt wrapper and transcript stripping should match the desktop app and IDE extension. By using the same ## My request for Codex: delimiter and hiding the injected context from transcript rendering the same way, threads created in the TUI render correctly in desktop and IDE surfaces, and threads created there replay correctly in the TUI, even when IDE context was included.

Addresses #13834.

What changed

Summary

This PR consists of four four pieces:

  1. An IPC client that uses a socket (Mac/Linux) or named pipe (Windows) to talk to the IDE Extension
  2. Logic that establishes the IPC connection and requests IDE context (open files, selection) on demand
  3. Logic that injects this context into the user prompt (using the same technique as the desktop app) and hides the added context when rendering the prompt in the TUI transcript
  4. A new slash command for enabling/disabling this mode and text within the footer to indicate when it's enabled

Details

  • Added /ide [on|off|status] to the TUI, with bare /ide toggling IDE context on or off.
  • Added a Rust IDE context client that connects to the local Codex IDE IPC route as a client and requests context from the IDE extension flow.
  • Injected IDE context using the same prompt delimiter and transcript-stripping convention as the desktop app and IDE extension so shared threads render consistently across surfaces.
  • Added an IDE context status-line indicator while the feature is active and cleared it when enabling or fetching context fails.
  • Added handling for multiple selection ranges, oversized selections, interleaved IPC messages, and transient reconnect timing after quick toggles.

Verification

Did extensive manual testing in addition to running automated unit and regression tests.

To test:

  • Launch VS Code (or Cursor) with the IDE extension.
  • Open one or more files in the IDE and select a range of text within one of them.
  • Start the TUI.
  • Ask the agent which files you have open in your IDE, and it should say that it does not know.
  • Enable /ide mode; note that IDE context appears in the lower right.
  • Ask the agent what files you have open in your IDE and what text is selected.

@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: 3e37c2e6e9

ℹ️ 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/ide_context/ipc.rs Outdated
Comment thread codex-rs/tui/src/ide_context/ipc.rs

@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: 3085ffbf6a

ℹ️ 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/ide_context/prompt.rs
Comment thread codex-rs/tui/src/ide_context/ipc.rs Outdated
Comment thread codex-rs/tui/src/ide_context/ipc.rs Outdated

@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: 2dffc00f9a

ℹ️ 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/chatwidget/ide_context.rs Outdated

@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: 5f243d476b

ℹ️ 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/ide_context/ipc.rs Outdated

@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: b5d9e05b9c

ℹ️ 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/ide_context/ipc.rs
Comment thread codex-rs/tui/src/ide_context/ipc.rs Outdated
Comment thread codex-rs/tui/src/ide_context/ipc.rs

@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: 3a25942095

ℹ️ 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/ide_context/windows_pipe.rs
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@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: 239b32c1aa

ℹ️ 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/ide_context/ipc.rs Outdated

@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: 8d23554a8b

ℹ️ 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/ide_context/windows_pipe.rs Outdated
Comment thread codex-rs/tui/src/chatwidget.rs Outdated
Comment thread codex-rs/tui/src/ide_context/ipc.rs Outdated
Addresses #13834 by removing the prompt-time background reader path and fetching IDE context synchronously over the persistent IPC connection.
Use a request-scoped IPC socket for each IDE context fetch so the TUI does not register for router broadcasts. This keeps /ide prompt injection responsive while still using the existing ide-context request route.

Addresses #13834.
Remove the leftover persistent-client state now that IDE context uses request-scoped IPC sockets. Also collapse the single-state status-line indicator to a boolean and drop a helper-only deadline test.

Addresses #13834.
Document the desktop-compatible prompt delimiter behavior and fix the review issues around Windows overlapped timeouts and hidden-context history rendering.

Addresses #13834
Add the active permission profile field to the new TUI session configuration test initializer after rebasing onto the latest main.

Addresses #13834
@etraut-openai etraut-openai force-pushed the etraut/tui-ide-command branch from a741386 to b23dcb9 Compare April 30, 2026 08:23
Update history replay coverage so local-image-only user messages are rendered, matching the IDE-context hidden prompt behavior fixed in this PR.

Addresses #13834

@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: b23dcb91ac

ℹ️ 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/ide_context/prompt.rs Outdated
Comment thread codex-rs/tui/src/ide_context/prompt.rs
Comment thread codex-rs/tui/src/ide_context/ipc.rs Outdated
Bound injected IDE context size and parse IPC frames before classifying broadcasts.

Addresses #13834

@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: b58e7239a4

ℹ️ 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/ide_context/ipc.rs Outdated
Comment thread codex-rs/tui/src/ide_context/ipc.rs

@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: 62bdcad487

ℹ️ 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/ide_context/windows_pipe.rs Outdated
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@etraut-openai

Copy link
Copy Markdown
Collaborator Author

[codex] Addressed the Codex review about pending-steer compare keys in 2ea29eb. ThreadInputState now carries each pending steer compare key through capture/restore, so hidden IDE prompt context used for matching committed user messages is preserved across thread switches/restores.

@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: 2ea29ebe8b

ℹ️ 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/ide_context/prompt.rs Outdated

@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.

Manually tested the following features on Windows 11:

  • Running /ide with on, off and status with and without VSCode Extension running
  • Asking Codex about files open, tabs open and question about the selected snippet
  • Ran those tests both from the bundled VSCode terminal and from regular Windows Terminal

Everything worked as expected.

Code looks good. Approved.

@etraut-openai etraut-openai merged commit 6784db5 into main May 1, 2026
25 checks passed
@etraut-openai etraut-openai deleted the etraut/tui-ide-command branch May 1, 2026 16:39
@github-actions github-actions Bot locked and limited conversation to collaborators May 1, 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