Skip to content

Conversation

@danfhernandez
Copy link
Contributor

@danfhernandez danfhernandez commented Nov 7, 2025

Summary

This PR adds two new optional boolean fields to ThreadOptions in the TypeScript SDK:

  • networkAccess: Enables network access in the sandbox by setting sandbox_workspace_write.network_access config
  • webSearch: Enables the web search tool by setting tools.web_search config

These options map to existing Codex configuration options and are properly threaded through the SDK layers:

  1. ThreadOptions (threadOptions.ts) - User-facing API
  2. CodexExecArgs (exec.ts) - Internal execution args
  3. CLI flags via --config in the codex exec command

Changes

  • sdk/typescript/src/threadOptions.ts: Added networkAccess and webSearch fields to ThreadOptions type
  • sdk/typescript/src/exec.ts: Added fields to CodexExecArgs and CLI flag generation
  • sdk/typescript/src/thread.ts: Pass options through to exec layer

Test Plan

  • Build succeeds (pnpm build)
  • Linter passes (pnpm lint)
  • Type definitions are properly exported
  • Manual testing with sample code (to be done by reviewer)

danfhernandez and others added 2 commits November 7, 2025 08:41
Add support for networkAccess and webSearch boolean options in ThreadOptions. These options enable:
- networkAccess: Controls sandbox network access via sandbox_workspace_write.network_access config
- webSearch: Enables web search tool via tools.web_search config

The options are properly threaded through ThreadOptions -> CodexExecArgs -> CLI flags.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add support for approvalPolicy option in ThreadOptions using the existing ApprovalMode type. This controls when Codex pauses to ask before running generated commands.

Values: "untrusted" | "on-failure" | "on-request" | "never"

The option is passed via the --ask-for-approval CLI flag.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Collaborator

@pakrym-oai pakrym-oai left a comment

Choose a reason for hiding this comment

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

Can you add some tests that assert values are passed down to exec? There are some existing examples you should be able to copy.

danfhernandez and others added 4 commits November 7, 2025 14:02
Addressed PR feedback to rename the boolean fields for clarity:
- networkAccess → networkAccessEnabled
- webSearch → webSearchEnabled

This makes the boolean nature of the options more explicit.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Add unit tests for the three new ThreadOptions fields following the same pattern as the existing modelReasoningEffort test:
- networkAccessEnabled: Verifies --config sandbox_workspace_write.network_access flag
- webSearchEnabled: Verifies --config tools.web_search flag
- approvalPolicy: Verifies --ask-for-approval flag

Each test uses codexExecSpy to capture command args and validates the correct CLI flags are passed.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Correct the web search parameter from `tools.web_search` to `features.web_search_request` to match the actual CLI flag.

Updated in both exec.ts and the corresponding test.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Change approvalPolicy from using --ask-for-approval flag to --config flag, since --ask-for-approval is not available in codex exec.

Now uses: --config approval_policy="<value>"

This matches the pattern for other config options like modelReasoningEffort.

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Copy link
Collaborator

@pakrym-oai pakrym-oai left a comment

Choose a reason for hiding this comment

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

Thank you!

@pakrym-oai pakrym-oai merged commit c76528c into openai:main Nov 7, 2025
25 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 7, 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.

2 participants