Skip to content

Conversation

@zhao-oai
Copy link
Collaborator

@zhao-oai zhao-oai commented Dec 5, 2025

Currently, we only show the “don’t ask again for commands that start with…” option when a command is immediately flagged as needing approval. However, there is another case where we ask for approval: When a command is initially auto-approved to run within sandbox, but it fails to run inside sandbox, we would like to attempt to retry running outside of sandbox. This will require a prompt to the user.

This PR addresses this latter case

@zhao-oai zhao-oai force-pushed the dev/zhao/sandbox-deny-amendment branch 3 times, most recently from 35d468b to bd130e4 Compare December 6, 2025 00:32
@zhao-oai
Copy link
Collaborator Author

zhao-oai commented Dec 6, 2025

@codex review

@chatgpt-codex-connector
Copy link
Contributor

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

ℹ️ 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".

@zhao-oai zhao-oai force-pushed the dev/zhao/sandbox-deny-amendment branch from bd130e4 to 5a520f0 Compare December 6, 2025 01:23
@zhao-oai zhao-oai requested a review from bolinfest December 6, 2025 01:25
Copy link
Collaborator

@bolinfest bolinfest left a comment

Choose a reason for hiding this comment

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

Overall looks good, but please try to tighten up the docstrings/naming.

/// we return `None` because an execpolicy prompt still applies even if we amend execpolicy to allow ["prog1", "--option1", "arg1"].
fn proposed_execpolicy_amendment(evaluation: &Evaluation) -> Option<ExecPolicyAmendment> {
if evaluation.decision != Decision::Prompt {
// - If any execpolicy rule prompts, return None, because an amendment would not skip that policy requirement.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: prefer /// for docstrings

// on `prog1`, we return `Some(vec!["prog1", "--option1", "arg1"])`.
// - execpolicy: contains a `prompt for prefix ["prog2"]` rule. For the same command as above,
// we return `None` because an execpolicy prompt still applies even if we amend execpolicy to allow ["prog1", "--option1", "arg1"].
fn prompt_execpolicy_amendment(matched_rules: &[RuleMatch]) -> Option<ExecPolicyAmendment> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Between the function name and the docstring, I'm confused what this function is for / how it works.

For example, the name starts with prompt_, but this does not do any "prompting" of its own.

I think it is about deriving a new value, so changing the name to start with create_ or derive_ would be clearer.

Unfortunately, all the names I can think of are quite long, like try_derive_execpolicy_amendment_for_prompt_rules().

/// we return `None` because an execpolicy prompt still applies even if we amend execpolicy to allow ["prog1", "--option1", "arg1"].
fn proposed_execpolicy_amendment(evaluation: &Evaluation) -> Option<ExecPolicyAmendment> {
if evaluation.decision != Decision::Prompt {
// - If any execpolicy rule prompts, return None, because an amendment would not skip that policy requirement.
Copy link
Collaborator

Choose a reason for hiding this comment

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

I thought the first line returns None if any execpolicy rule does not prompt?

})
}

// - Note: we only use this amendment when the command fails to run in sandbox and codex prompts the user to run outside the sandbox
Copy link
Collaborator

Choose a reason for hiding this comment

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

/// here, as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants