exec: expose thread source in CLI and TypeScript SDK - #40155
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8daa0e3b54
ℹ️ 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".
|
|
||
| assert!(cli.ignore_user_config); | ||
| assert!(cli.ignore_rules); | ||
| assert_eq!(cli.thread_source, None); |
There was a problem hiding this comment.
Test the effective thread-source default
This assertion only checks the statically implied absence of the optional clap field; it does not exercise the new run_main fallback that maps absence to ThreadSource::User, so a regression in the user-visible default would still pass. Replace it with behavioral coverage that starts a thread without the flag and verifies that its persisted or request source is user.
AGENTS.md reference: AGENTS.md:L29-L30
Useful? React with 👍 / 👎.
Why
codex execcurrently classifies every new thread and fork asuser, so integrations using the CLI or TypeScript SDK cannot attribute agent work to the feature that initiated it. The app-server protocol and Python SDK already support caller-supplied thread sources.What changed
codex exec --thread-source <SOURCE>for new threads and forks, including flags supplied after theforksubcommand.threadSource?: stringto the TypeScript SDK'sThreadOptionsand forward it when the SDK creates a thread.userdefault and keep resumed threads' persisted source unchanged.x-codex-turn-metadataindependently of the existing originator override.Verification
just test -p codex-exec --lib(61 tests)just test -p codex-exec --test all exec_fork_creates_distinct_threads_with_and_without_a_promptjust test -p codex-exec --test all supports_originator_overrideDocumentation
Update the Codex CLI reference and TypeScript SDK documentation to cover
--thread-sourceandThreadOptions.threadSource.