Files
codex/codex-rs/cli/src/exec_args_tests.rs
T
mldangelo-oai 6b4daafdb4 Add per-turn Cyber access program selection to exec and the SDK (#49939)
## Why

`codex exec` and the TypeScript SDK need a way to request a Cyber access program for an individual turn. Resuming with an API key can also leave compaction using a saved program that the current credentials cannot access.

## What changed

- Add `--cyber-access-program` with `standard`, `daybreak_blue`, and `daybreak_red`, and expose the equivalent `cyberAccessProgram` turn option and `CyberAccessProgram` type in the TypeScript SDK.
- Apply explicit selections to new, resumed, and prompted fork turns. Override automatic Daybreak selection for that turn without changing the saved choice. Reject the flag for review and forks without a prompt.
- Filter Cyber programs by the built-in OpenAI provider when starting turns and restoring previous-turn settings for compaction.
- Allow previous-model compaction fallback with API-key authentication, comparing both model and program so a program change can trigger a retry with the current pair even when the model is unchanged.

## Testing

Add CLI help, argument parsing, exec, and SDK coverage for per-turn selection and unsupported commands. Extend core tests for API-key compaction retries, denied explicit selections, custom-provider filtering, remote compaction, and WebSocket response reuse.

GitOrigin-RevId: 586f25b621924f3bc509c9a39b39fe2020ff9cd2
2026-10-01 08:57:53 +00:00

31 lines
1.1 KiB
Rust

//! Snapshot coverage for the public exec command's argument help.
use super::MultitoolCli;
use clap::CommandFactory;
use pretty_assertions::assert_eq;
#[test]
fn exec_help_documents_cyber_access_program() {
let help = MultitoolCli::command()
.term_width(80)
.try_get_matches_from(["codex", "exec", "--help"])
.expect_err("help should short-circuit");
assert_eq!(help.kind(), clap::error::ErrorKind::DisplayHelp);
let program_help = help
.to_string()
.lines()
.skip_while(|line| !line.contains("--cyber-access-program"))
.take_while(|line| !line.is_empty())
.map(str::trim_end)
.collect::<Vec<_>>()
.join("\n");
insta::assert_snapshot!(program_help.trim(), @r"
--cyber-access-program <PROGRAM>
Request an experimental Cyber access program for this turn (OpenAI
provider only). Omit to use server defaults. Not supported with
review; fork requires a prompt
[possible values: standard, daybreak_blue, daybreak_red]
");
}