Add process-scoped PSP routing for ChatGPT requests (#36986)

## What changed

- Add a hidden global `--psp` runtime flag and propagate it through TUI, exec,
  app-server, remote-control, and in-process startup paths.
- Attach the `oai-chat-psp=true` cookie to first-party ChatGPT requests when
  enabled, using a cached cookie-aware client with sensitive request logging
  disabled.
- Keep the routing selection out of persistent configuration layers while
  preserving it across config refreshes and agent role changes.

## Testing

- Cover global flag parsing, app-server propagation, config-layer isolation,
  and preservation across config rebuilds and role changes.

GitOrigin-RevId: 05cdc61ffd7162d8e48fc1e166f4732113e5a816
This commit is contained in:
stevenlee-oai authored and copyberry committed 2026-08-04 22:23:40 +00:00
1 parent 411f3f0680
commit 1d952f027e
25 files changed
+199 -16

No files matched your search

+5 -1
View File
@@ -65,6 +65,7 @@ pub(crate) async fn run(
command: RemoteControlCommand,
arg0_paths: Arg0DispatchPaths,
root_config_overrides: CliConfigOverrides,
psp: bool,
) -> anyhow::Result<()> {
match command.subcommand {
None => {
@@ -72,7 +73,8 @@ pub(crate) async fn run(
command.json,
"Starting app-server with remote control enabled...",
)?;
run_foreground_remote_control(command.json, arg0_paths, root_config_overrides).await?;
run_foreground_remote_control(command.json, arg0_paths, root_config_overrides, psp)
.await?;
}
Some(RemoteControlSubcommand::Start) => {
print_remote_control_progress(
@@ -111,6 +113,7 @@ async fn run_foreground_remote_control(
json: bool,
arg0_paths: Arg0DispatchPaths,
root_config_overrides: CliConfigOverrides,
psp: bool,
) -> anyhow::Result<()> {
let socket_dir = tempfile::Builder::new()
.prefix("codex-rc-")
@@ -126,6 +129,7 @@ async fn run_foreground_remote_control(
let runtime_options = AppServerRuntimeOptions {
remote_control_startup_mode: codex_app_server::RemoteControlStartupMode::EnabledEphemeral,
install_shutdown_signal_handler: false,
psp,
..Default::default()
};
let (stop_rx, stop_signal_task) = foreground_stop_signal();