Skip to content

Remove TUI exec-policy core exports - #31179

Merged
etraut-openai merged 2 commits into
mainfrom
etraut/remove-tui-exec-policy-exports
Jul 6, 2026
Merged

Remove TUI exec-policy core exports#31179
etraut-openai merged 2 commits into
mainfrom
etraut/remove-tui-exec-policy-exports

Conversation

@etraut-openai

@etraut-openai etraut-openai commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Why

The TUI still reached through codex_app_server_client::legacy_core to validate exec-policy rules during local startup. The app server already owns this validation and reports parse failures through configWarning, so the duplicate TUI preflight preserved an unnecessary core dependency and could inspect the wrong machine when connected to a remote app server.

What changed

  • Remove the TUI's direct exec-policy startup check.
  • Remove the two exec-policy re-exports from legacy_core.
  • Rely on the app server's existing config-warning flow for malformed custom rules in both embedded and remote sessions.

@etraut-openai
etraut-openai marked this pull request as ready for review July 5, 2026 17:24

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

ℹ️ 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/lib.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: 887d2df706

ℹ️ 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/app-server/src/in_process.rs
Comment thread codex-rs/app-server/src/in_process.rs
Comment thread codex-rs/app-server/src/in_process.rs
@etraut-openai etraut-openai changed the title [codex] Remove TUI exec-policy core exports Remove TUI exec-policy core exports Jul 5, 2026

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

I manually ran smoke-tested te TUI startup with a malformed exec-policy rules file and confirmed Codex displays the expected warning and remains usable instead of exiting during startup.

Also left two issues inline found by Codex.

/// the runtime is shut down and an `InvalidData` error is returned.
pub async fn start(args: InProcessStartArgs) -> IoResult<InProcessClientHandle> {
pub async fn start(mut args: InProcessStartArgs) -> IoResult<InProcessClientHandle> {
if let Ok(Some(err)) = check_execpolicy_for_warnings(&args.config.config_layer_stack).await {

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.

[P1] A parse warning here is unsafe when managed requirements().exec_policy is present. The later thread load installs Policy::empty() before the requirements overlay can be merged, changing the embedded TUI from fail-closed to running without managed prompt/forbidden rules. Please preserve the requirements overlay when dropping malformed custom rules, or keep this case fatal.

@etraut-openai etraut-openai Jul 6, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is addressed separately in #31188. It's an existing issue that affects existing clients like the app, so it should be addressed in the app server layer or core.

/// the runtime is shut down and an `InvalidData` error is returned.
pub async fn start(args: InProcessStartArgs) -> IoResult<InProcessClientHandle> {
pub async fn start(mut args: InProcessStartArgs) -> IoResult<InProcessClientHandle> {
if let Ok(Some(err)) = check_execpolicy_for_warnings(&args.config.config_layer_stack).await {

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.

[P2] The reusable local-daemon path still lacks fresh validation. Its startup warnings are frozen, while each new thread reloads config and rereads .rules. If rules become malformed after daemon startup or come from another project, the thread silently receives an empty policy. Please validate per thread/initialize or otherwise surface a fresh warning.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is similarly an existing bug in the app server layer that affects other clients. It should be addressed in the app server or core layer. This PR exposes the problem for the TUI. I'll work on a separate PR to address this.

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

Approved after understanding how the findings will be handled.

etraut-openai added a commit that referenced this pull request Jul 6, 2026
## Why

App-server initialization captures exec-policy parse warnings only once.
Each `thread/start` then reloads config for that thread's cwd and
rereads its `.rules` files, so rules that become malformed after
initialization—or belong to a different project—are dropped without a
fresh warning to the requesting client.

## What changed

- Validate exec-policy rules against the freshly loaded per-thread
config during `thread/start`.
- Send the existing structured `configWarning` only to the connection
that requested the thread.
- Preserve nonfatal startup and avoid repeating an identical warning
already delivered during initialization.

This is intentionally separate from the TUI `legacy_core` cleanup in
#31179 and the managed-requirements fallback fix in #31188.
@etraut-openai
etraut-openai merged commit 8f5bb61 into main Jul 6, 2026
63 of 66 checks passed
@etraut-openai
etraut-openai deleted the etraut/remove-tui-exec-policy-exports branch July 6, 2026 17:22
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 6, 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