fix: fully revert agent identity runtime wiring (#18757)

## Summary

This PR fully reverts the previously merged Agent Identity runtime
integration from the old stack:
https://github.com/openai/codex/pull/17387/changes

It removes the Codex-side task lifecycle wiring, rollout/session
persistence, feature flag plumbing, lazy `auth.json` mutation,
background task auth paths, and request callsite changes introduced by
that stack.

This leaves the repo in a clean pre-AgentIdentity integration state so
the follow-up PRs can reintroduce the pieces in smaller reviewable
layers.

## Stack

1. This PR: full revert
2. https://github.com/openai/codex/pull/18871: move Agent Identity
business logic into a crate
3. https://github.com/openai/codex/pull/18785: add explicit
AgentIdentity auth mode and startup task allocation
4. https://github.com/openai/codex/pull/18811: migrate auth callsites
through AuthProvider

## Testing

Tests: targeted Rust checks, cargo-shear, Bazel lock check, and CI.
This commit is contained in:
efrazer-oai
2026-04-21 14:30:55 -07:00
committed by GitHub
parent 69c3d12274
commit be75785504
85 changed files with 334 additions and 5409 deletions

View File

@@ -15,7 +15,6 @@ use codex_protocol::protocol::ConversationStartTransport;
use codex_protocol::protocol::ConversationTextParams;
use codex_protocol::protocol::ErrorEvent;
use codex_protocol::protocol::EventMsg;
use codex_protocol::protocol::GitInfo;
use codex_protocol::protocol::InitialHistory;
use codex_protocol::protocol::Op;
use codex_protocol::protocol::RealtimeAudioFrame;
@@ -26,11 +25,7 @@ use codex_protocol::protocol::RealtimeNoopRequested;
use codex_protocol::protocol::RealtimeOutputModality;
use codex_protocol::protocol::RealtimeVoice;
use codex_protocol::protocol::RolloutItem;
use codex_protocol::protocol::RolloutLine;
use codex_protocol::protocol::SessionMeta;
use codex_protocol::protocol::SessionMetaLine;
use codex_protocol::protocol::SessionSource;
use codex_protocol::protocol::UserMessageEvent;
use codex_protocol::user_input::UserInput;
use codex_utils_output_truncation::approx_token_count;
use core_test_support::responses;
@@ -71,7 +66,6 @@ const MEMORY_PROMPT_PHRASE: &str =
"You have access to a memory folder with guidance from prior runs.";
const REALTIME_CONVERSATION_TEST_SUBPROCESS_ENV_VAR: &str =
"CODEX_REALTIME_CONVERSATION_TEST_SUBPROCESS";
const WEBSOCKET_REQUEST_TIMEOUT: Duration = Duration::from_secs(30);
#[derive(Debug, Clone)]
struct RealtimeCallRequestCapture {
@@ -148,7 +142,7 @@ async fn wait_for_matching_websocket_request<F>(
where
F: Fn(&core_test_support::responses::WebSocketRequest) -> bool,
{
let deadline = tokio::time::Instant::now() + WEBSOCKET_REQUEST_TIMEOUT;
let deadline = tokio::time::Instant::now() + Duration::from_secs(10);
loop {
if let Some(request) = server
.connections()
@@ -208,18 +202,16 @@ async fn seed_recent_thread(
let db = test.codex.state_db().context("state db enabled")?;
let thread_id = ThreadId::new();
let updated_at = Utc::now();
let rollout_dir = test
let rollout_path = test
.codex_home_path()
.join("sessions")
.join(updated_at.format("%Y/%m/%d").to_string());
fs::create_dir_all(&rollout_dir)?;
let rollout_path = rollout_dir.join(format!(
"rollout-{}-{thread_id}.jsonl",
updated_at.format("%Y-%m-%dT%H-%M-%S")
));
.join(format!("rollout-{thread_id}.jsonl"));
// This helper seeds SQLite metadata directly. Local listing drops stale metadata rows whose
// rollout path no longer exists, so create the placeholder path that the test metadata points
// at without exercising rollout writing in this realtime-context test.
std::fs::write(&rollout_path, "")?;
let mut metadata_builder = codex_state::ThreadMetadataBuilder::new(
thread_id,
rollout_path.clone(),
rollout_path,
updated_at,
SessionSource::Cli,
);
@@ -229,45 +221,6 @@ async fn seed_recent_thread(
let mut metadata = metadata_builder.build("test-provider");
metadata.title = title.to_string();
metadata.first_user_message = Some(first_user_message.to_string());
let timestamp = updated_at.to_rfc3339();
let session_meta = RolloutLine {
timestamp: timestamp.clone(),
item: RolloutItem::SessionMeta(SessionMetaLine {
meta: SessionMeta {
id: thread_id,
timestamp: timestamp.clone(),
cwd: metadata.cwd.clone(),
originator: "cli".to_string(),
cli_version: "0.0.0".to_string(),
source: SessionSource::Cli,
model_provider: Some("test-provider".to_string()),
..Default::default()
},
git: Some(GitInfo {
commit_hash: None,
branch: metadata.git_branch.clone(),
repository_url: None,
}),
}),
};
let user_message = RolloutLine {
timestamp,
item: RolloutItem::EventMsg(EventMsg::UserMessage(UserMessageEvent {
message: first_user_message.to_string(),
images: None,
local_images: Vec::new(),
text_elements: Vec::new(),
})),
};
fs::write(
&rollout_path,
format!(
"{}\n{}\n",
serde_json::to_string(&session_meta)?,
serde_json::to_string(&user_message)?
),
)?;
db.upsert_thread(&metadata).await?;
Ok(())