Thread opaque identity through app-server

Add an opaque IdentityKey startup option for app-server and CLI entrypoints, and make the remote thread-store client forward identity bytes as binary metadata. Update the multi-tenancy audit plan to use IdentityKey as the tenant registry id.

Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
bryanashley
2026-04-22 16:04:35 +00:00
co-authored by Codex
parent 37bf42d5d5
commit b2d17c42db
11 changed files with 623 additions and 8 deletions
+21 -1
View File
@@ -30,6 +30,7 @@ use codex_tui::ExitReason;
use codex_tui::UpdateAction;
use codex_utils_cli::CliConfigOverrides;
use owo_colors::OwoColorize;
use std::ffi::OsString;
use std::io::IsTerminal;
use std::path::PathBuf;
use supports_color::Stream;
@@ -390,6 +391,10 @@ struct AppServerCommand {
#[command(flatten)]
auth: codex_app_server::AppServerWebsocketAuthArgs,
/// Opaque identity key forwarded to remote contract implementations.
#[arg(long = "identity-key", value_name = "KEY")]
identity_key: Option<OsString>,
}
#[derive(Debug, Parser)]
@@ -744,6 +749,7 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
listen,
analytics_default_enabled,
auth,
identity_key,
} = app_server_cli;
reject_remote_mode_for_app_server_subcommand(
root_remote.as_deref(),
@@ -754,7 +760,9 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
None => {
let transport = listen;
let auth = auth.try_into_settings()?;
codex_app_server::run_main_with_transport(
let identity_key =
identity_key.map(codex_app_server::IdentityKey::from_os_string);
codex_app_server::run_main_with_transport_options(
arg0_paths.clone(),
root_config_overrides,
codex_core::config_loader::LoaderOverrides::default(),
@@ -762,6 +770,7 @@ async fn cli_main(arg0_paths: Arg0DispatchPaths) -> anyhow::Result<()> {
transport,
codex_protocol::protocol::SessionSource::VSCode,
auth,
identity_key,
)
.await?;
}
@@ -1942,6 +1951,17 @@ mod tests {
assert!(app_server.analytics_default_enabled);
}
#[test]
fn app_server_identity_key_flag_parses() {
let app_server = app_server_from_args(
["codex", "app-server", "--identity-key", "tenant-key-123"].as_ref(),
);
assert_eq!(
app_server.identity_key.as_deref(),
Some(std::ffi::OsStr::new("tenant-key-123"))
);
}
#[test]
fn remote_flag_parses_for_interactive_root() {
let cli = MultitoolCli::try_parse_from(["codex", "--remote", "ws://127.0.0.1:4500"])