Skip to content

Chore: add cmd related info to exec approval request#9659

Merged
shijie-oai merged 1 commit intomainfrom
shijie/add-cmd-to-exec-approval-request
Jan 22, 2026
Merged

Chore: add cmd related info to exec approval request#9659
shijie-oai merged 1 commit intomainfrom
shijie/add-cmd-to-exec-approval-request

Conversation

@shijie-oai
Copy link
Collaborator

Summary

We now rely purely on item/commandExecution/requestApproval item to render pending approval in VSCE and app. With v2 approach, it does not include the actual cmd that it is attempting and therefore we can only use proposedExecpolicyAmendment to render which can be incomplete.

Reproduce

  • Add prefix_rule(pattern=["echo"], decision="prompt") to your ~/.codex/rules.default.rules.
  • Ask to Run echo "approval-test" please in VSCE or app.
  • The pending approval protal does show up but with no content

Example screenshot

Screenshot 2026-01-21 at 8 23 25 PM

Sample output

  {"method":"item/commandExecution/requestApproval","id":0,"params":{
    "threadId":"019be439-5a90-7600-a7ea-2d2dcc50302a",
    "turnId":"0",
    "itemId":"call_usgnQ4qEX5U9roNdjT7fPzhb",
    "reason":"`/bin/zsh -lc 'echo \"testing\"'` requires approval by policy",
    "proposedExecpolicyAmendment":null
  }}

Fix

Inlude command string, cwd and command_actions in CommandExecutionRequestApprovalParams so that consumers can display the correct command instead of relying on exec policy output.

@shijie-oai shijie-oai marked this pull request as ready for review January 22, 2026 06:10
Copy link
Contributor

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

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: 6779e07d03

ℹ️ 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 on lines 2274 to 2277
/// Best-effort parsed command actions for friendly display.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub command_actions: Vec<CommandAction>,
Copy link
Contributor

Choose a reason for hiding this comment

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

P2 Badge Mark commandActions optional or always serialize it

Because command_actions is skipped when empty (skip_serializing_if = "Vec::is_empty") but it is not marked optional in the TS export, clients using the generated TypeScript types will treat commandActions as required even though the server will omit it whenever parsing yields no actions. That mismatch can lead to undefined at runtime for callers who follow the types and access commandActions unconditionally. Consider either removing the skip-serialize so the field is always present (possibly empty) or adding #[ts(optional)] and handling the missing field on the client side.

Useful? React with 👍 / 👎.

Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we want to skip if it's empty?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated - but essentially we will get undefined instead of an empty array on ts side. Visually it would be the same (i.e. no exec command rendered) but with undefined it is a better indicator that we have nothing to render.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah the first part makes sense - just double checking that empty array and undefined are always intended to be identical here. given we'd fallback instead, this sounds good to me.

@shijie-oai shijie-oai force-pushed the shijie/add-cmd-to-exec-approval-request branch from 6779e07 to 67ff933 Compare January 22, 2026 06:14
Copy link
Collaborator

@dylan-hurd-oai dylan-hurd-oai left a comment

Choose a reason for hiding this comment

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

Curious about the is_empty decision but not blocking, excited for this!

Comment on lines 2274 to 2277
/// Best-effort parsed command actions for friendly display.
#[serde(default, skip_serializing_if = "Vec::is_empty")]
pub command_actions: Vec<CommandAction>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do we want to skip if it's empty?

@shijie-oai shijie-oai force-pushed the shijie/add-cmd-to-exec-approval-request branch from 67ff933 to b9a19a0 Compare January 22, 2026 06:20
@shijie-oai shijie-oai force-pushed the shijie/add-cmd-to-exec-approval-request branch from b9a19a0 to b56226f Compare January 22, 2026 06:25
@shijie-oai shijie-oai merged commit a4cb97b into main Jan 22, 2026
36 of 38 checks passed
@shijie-oai shijie-oai deleted the shijie/add-cmd-to-exec-approval-request branch January 22, 2026 07:58
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 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