Skip to content

Conversation

@vmotta8
Copy link
Contributor

@vmotta8 vmotta8 commented Oct 8, 2025

Fixes #4940
Fixes #4892

When selecting "No, ask me to approve edits and commands" during onboarding, the code wasn't applying the correct approval policy, causing Codex to block all write operations instead of requesting approval.

This PR fixes the issue by persisting the "DontTrust" decision in config.toml as trust_level = "untrusted" and handling it in the sandbox and approval policy logic, so Codex correctly asks for approval before making changes.

Before (bug)

bef

After (fixed)

aft

@etraut-openai
Copy link
Collaborator

Thanks for the contribution, and apologies for the slow response. We received a large number of PRs, and we're just now catching up on the backlog.

It looks like this PR has gone stale. If you'd still like to pursue this change, could you please resolve the conflicts and make sure the tests run? Thanks!

@etraut-openai etraut-openai added the needs-response Additional information is requested label Nov 7, 2025
@vmotta8
Copy link
Contributor Author

vmotta8 commented Nov 7, 2025

@etraut-openai No worries! I've updated the PR and resolved the conflicts. The implementation now persists the "DontTrust" decision in config.toml as trust_level = "untrusted" (similar to how "Trust" works) and handles it properly in both sandbox_mode and approval_policy logic. I also added tests to cover this behavior.

@etraut-openai etraut-openai removed the needs-response Additional information is requested label Nov 7, 2025
@etraut-openai
Copy link
Collaborator

@vmotta8, looks like the lint / formatting CI check is still failing. Could you fix that? Thanks!

@etraut-openai etraut-openai added the needs-response Additional information is requested label Nov 7, 2025
@vmotta8
Copy link
Contributor Author

vmotta8 commented Nov 7, 2025

@etraut-openai Sure! Just fixed it, tks!

@etraut-openai etraut-openai removed the needs-response Additional information is requested label Nov 7, 2025
@etraut-openai etraut-openai requested a review from jif-oai November 8, 2025 00:48
pub fn is_untrusted(&self) -> bool {
match &self.trust_level {
Some(trust_level) => trust_level == "untrusted",
None => false,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should think of the default, here you imply that there is a third state (other than trusted and untrusted) that is not defined anywhere

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point! I created the enum and removed the helpers as requested. For the is_untrusted() method, I followed the existing pattern from is_trusted() which also treats None as false. This third state was already implicit before my changes. Does it make sense to refactor this now, or should that be a separate change?

@etraut-openai etraut-openai added the needs-response Additional information is requested label Nov 10, 2025
// Verify that untrusted projects get WorkspaceWrite (or ReadOnly on Windows due to downgrade)
if cfg!(target_os = "windows") {
assert!(
matches!(resolution.policy, SandboxPolicy::ReadOnly),
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is no sandbox on Windows today.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Just to clarify: the test expects ReadOnly on Windows due to the downgrade logic, but since there's no actual sandbox on Windows, should I remove this assertion or handle it differently?

@etraut-openai etraut-openai removed the needs-response Additional information is requested label Nov 12, 2025
@vmotta8 vmotta8 requested review from bolinfest and jif-oai November 13, 2025 16:46
@jif-oai
Copy link
Collaborator

jif-oai commented Nov 14, 2025

@codex review

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.

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

Copy link
Collaborator

@jif-oai jif-oai left a comment

Choose a reason for hiding this comment

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

Looks way better. Thank you
The comment of Codex just above is valid so please fix this. After that, lgtm

@vmotta8
Copy link
Contributor Author

vmotta8 commented Nov 14, 2025

@jif-oai Done! Fixed the onboarding loop for untrusted projects and added a test.

@vmotta8 vmotta8 requested a review from jif-oai November 14, 2025 19:51
@etraut-openai etraut-openai merged commit 89ecc00 into openai:main Nov 14, 2025
25 checks passed
@etraut-openai
Copy link
Collaborator

Thanks again for the contribution!

@github-actions github-actions bot locked and limited conversation to collaborators Nov 14, 2025
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.

"Don't Trust" option blocks all writes instead of requesting approval Editing File in read mode (with request approval) does not Work

5 participants