Skip to content

Draft: converge to openai/codex 343074d4 - #782

Draft
cbusillo wants to merge 488 commits into
mainfrom
code/upstream-catchup-343074d
Draft

Draft: converge to openai/codex 343074d4#782
cbusillo wants to merge 488 commits into
mainfrom
code/upstream-catchup-343074d

Conversation

@cbusillo

@cbusillo cbusillo commented Aug 22, 2026

Copy link
Copy Markdown
Owner

Summary

Creates the first exact-ref upstream catch-up candidate after the lab.5 acceptance gate.

  • Local baseline: 0eed1a86c783c474a009cb8b548ab58e18513614
  • Upstream target: 343074d4207d572809bd8cea15f4be1d09d98e0b
  • Merge base: a7b8c074b577f897111c14de3a5e127b91e2a479
  • Canonical remote: git@github.com:openai/codex.git
  • Candidate head: cb5a4375f22d3177a94bb8f546912f5ed916e668

The pinned range contains 479 upstream-only commits, 90 textual conflicts, and 1,030 residual local-influence paths. Green paths use upstream; named Codex Lab contracts retain authority for identity, state home, agents, hooks, auth, protocol additions, governance, and release provenance.

Checkpoint Evidence

  • Resolved all 90 textual conflicts with no merge markers remaining.
  • Restored three silent production reachability edges caught by the new semantic gate.
  • Reconciled Cargo/Bazel workspace dependencies and passed just bazel-lock-check.
  • Regenerated stable and experimental app-server schemas from the synthesized Rust API.
  • just test -p codex-app-server-protocol: 309 passed, 1 skipped.
  • Completed the bounded AUTH-1 / AUTH-2 / AUTH-3 synthesis: the typed fallible AuthManager API is restored, all callers handle initialization failure, and in-process app-server startup fails closed before spawning its runtime.
  • Focused login, app-server, and CLI gates now stop at the same five known codex-hooks synthesis errors rather than an auth caller mismatch.
  • Strict convergence validation: passed.
    • 7 reproducible append-only snapshots
    • 493 guarded paths
    • 25 valid waivers
    • 0 violations
    • 0 stale waivers
  • New evidence snapshot: upstream/openai-codex/a7b8c074-343074d4.

Remaining Before Review

This PR is intentionally draft and is not merge-ready.

  • Repair the bounded codex-hooks API-shape synthesis:
    • HookListEntry field mismatches
    • HandlerSourcePath wrapping
    • missing DiscoveryResult::required_load_errors
  • Restore eight displaced downstream-only protocol tests:
    • dynamic_tool_call_error_is_published_from_persisted_items
    • dynamic_tool_spec_defaults_missing_input_schema_to_empty_object
    • dynamic_tool_spec_deserializes_defer_loading
    • dynamic_tool_spec_legacy_expose_to_context_inverts_to_defer_loading
    • external_agent_capabilities_read_params_default_to_cache_only
    • external_agent_capabilities_refresh_uses_client_id
    • external_agent_capability_failure_kind_uses_stable_wire_names
    • thread_turns_items_list_legacy_shape_round_trips
  • Rerun focused app-server, core, state, login, hooks, CLI, TUI, and release/CI contract gates.
  • Complete semantic, provenance, and operations review on the repaired head.

Refs #230, #634, #664, #778.

jif-oai and others added 30 commits August 18, 2026 09:25
## What changed

Start sampling for automatic idle `UserInput` requests without adding an empty
message to the input queue. Continue queuing automatic response-item input.

GitOrigin-RevId: 5d304aed9e7e165380b29b5b59d9245e97b40659
## What changed

- Exclude descendant-authored `MESSAGE` progress updates from the history retained after remote compaction v2.
- Continue retaining descendant-authored tasks while omitting progress updates and final answers from subsequent requests.

## Testing

- Extend the remote compaction follow-up test to cover descendant progress updates and descendant-authored tasks.

GitOrigin-RevId: 3e3e60bb108d27e99e2a4c222eed4b9d02fd3829
## Why

App widgets need to read resources using the app and account context of the
tool call that produced them, including after a thread is restored.

## What changed

- Add an optional `originCallId` to `mcpServer/resource/read` requests and
  return it on successful scoped reads.
- Track bounded provenance for successful app tool calls in thread history and
  use the current tool binding, account link, and app policy when reading the
  associated widget resource.
- Reject missing, mismatched, failed, or ambiguous origins, while keeping
  app-only tools available for widget reads without exposing them to the model.

## Testing

Add app-server coverage for scoped widget reads across both history modes,
ephemeral and persistent threads, server restarts, app-only visibility, and
invalid origin cases.

GitOrigin-RevId: 11eaefc066b2a3b639599e4cbdef680233d150a2
## Why

Compaction can remove the tool-call events that associate an MCP app widget with
the tool, account, and URI needed to authorize later resource reads.

## What changed

- Store a bounded MCP resource-origin checkpoint with each compacted rollout.
- Restore the checkpoint when resuming a session so existing widgets remain
  readable after compaction and restart.
- Discard saved origins when rollback rewrites history across the compaction
  boundary, and reject oversized or invalid checkpoints during restoration.

## Testing

- Extend the app-server MCP resource-origin test to compact a paginated thread,
  continue the conversation, and read the original widgets before and after a
  restart.
- Verify rollback clears provenance that no longer matches retained history.

GitOrigin-RevId: 7f91c6202fe8d9be21c78dda42fa205937c44263
## What changed

- Export `read_sensitive_file_to_string` from `codex-exec-server`.
- Require the opened path to be a regular disk file and avoid following its
  final symlink component on Unix or reparse point on Windows.
- Read valid UTF-8 file contents asynchronously and return I/O errors for
  unsupported inputs.

## Testing

Add tests covering regular files, directories, and symlinks.

GitOrigin-RevId: 68809e94c0d3719e5685c064f9610a0455ffd8d7
## What changed

- Reject a symbolic link used as the memory root.
- Recursively remove symbolic links before preparing or seeding the memory workspace.
- Remove and reject symbolic links created during consolidation, including when the worker fails, so they cannot affect files outside the workspace.

## Testing

Add Unix startup tests covering pre-existing extension links and links created by both successful and failed consolidation workers.

GitOrigin-RevId: f96e03812773f7beaa16455dd77370ee47d8a71f
## What changed

- Add a Tree-sitter-based lowerer that converts a conservative subset of literal PowerShell commands into argument vectors.
- Reject dynamic expressions, parse recovery, unsupported value conversions, directives, and source outside recognized command nodes instead of guessing their meaning.
- Keep the lowerer alongside the existing production parser for later adoption.

## Testing

- Add fixture-driven coverage for supported literal commands and unsupported or ambiguous syntax, including a dedicated `#requires` rejection test.

GitOrigin-RevId: a6e7acc264ca40df264db4b271e38ae7d89e1ec4
## Why

Custom model providers that do not require OpenAI authentication could inherit
ambient authentication headers, including the bearer token and
`ChatGPT-Account-ID`, and send them to the custom provider endpoint.

## What changed

- Resolve providers without `requires_openai_auth` or configured `auth` as
  unauthenticated.
- Continue to honor an explicit `experimental_bearer_token` or command-resolved
  provider authentication.
- Preserve ambient authentication for OpenAI providers.

## Testing

Added unit and request-level coverage for custom, explicitly authenticated, and
OpenAI provider authentication behavior.

GitOrigin-RevId: d89a79604338bc660a3edb2af0068cfa9b694fa2
## Why

Guardian sampling WebSockets authenticate when the connection is opened. Reusing
a pooled connection after credentials change can therefore keep using the old
authorization.

## What changed

- Track authentication changes on each pooled sampling connection.
- Discard stale connections after an auth change and reject connections whose
  authentication changes while the handshake is in progress.

## Testing

- Verify the sampler reconnects with the refreshed bearer token instead of
  reusing its existing connection.
- Verify the installed Guardian extension reconnects after an external auth
  refresh.

GitOrigin-RevId: 6d2e7df776fd21c78be0928f71162f5419a8b8f0
## Why

Repository-scoped imports must not follow redirected Codex paths and write
generated configuration outside the repository.

## What changed

- Reject repository migration scopes when generated configuration paths are
  symlinks or, on Windows, reparse points.
- Recheck hook and subagent destinations during import, skipping redirected
  directories, files, and dangling links without reporting them as imported.

## Testing

Add service and app-server coverage for redirected generated destinations,
including a repository path replaced with a symlink after detection.

GitOrigin-RevId: 3afb521ead9d76250f0e967eccfdd1dc194f027a
## What changed

- Pass metrics bound to the active turn's model to approval-review contributors.
- Add counter support to `ExtensionMetrics` while preserving host session attribution.
- Record Guardian v2 tool-call score lag and count stale-score fallbacks with the `score_lag` reason.

## Testing

- Cover counter forwarding and session metadata tags.
- Verify Guardian v2 metric samples for current and stale scores.

GitOrigin-RevId: 0ec34736d29d2e37ed217a27e773b4f6230ae38a
## Why

`node_repl` screenshots are nested tool results and do not appear in the parent
conversation history, so Guardian v2 transcript image collection could miss
them.

## What changed

- Allow Guardian v2 to enable bounded, thread-scoped `node_repl` image capture
  when transcript images are configured.
- Add retained `node_repl` screenshots to review requests when transcript
  sources include tool outputs, while deduplicating images and keeping them out
  of the parent turn input.

## Testing

- Add an integration test covering screenshot capture without the synchronous
  Guardian transcript feature flags and verifying that screenshots stay out of
  the parent request.

GitOrigin-RevId: 5f70c5f2e80389aa8b2a286c3b7f9b1104865486
## What changed

- Add a `NoiseStreamHandler` abstraction that owns payload encoding, decoding,
  and connection processing while the virtual stream handles framing,
  encryption, and multiplexing.
- Reassemble authenticated payloads as opaque bytes, with the existing
  JSON-RPC processor supplied as a handler implementation.
- Have the physical relay send a reset after the current stream instance
  closes, including when its processor exits before the writer task.

## Testing

- Verify local JSON-RPC decoding creates the queued request span before queue
  admission.
- Verify a processor exit resets the corresponding Noise harness stream.

GitOrigin-RevId: 270befcc8bfbf27e46c84d6a2c6e349cb98ea3f8
…#39240)

## What changed

- Give plugin managers for the same cache root a shared semaphore that permits
  only one background installed-plugin bundle sync at a time.
- Hold the permit for the lifetime of the spawned sync task and refresh the
  installed-plugin cache after a successful local cache change.

## Testing

- Add a test that starts bundle syncs from two plugin managers sharing a Codex
  home and verifies that only one request is made.

GitOrigin-RevId: 86c39476c3a9015b9862ab75e8f11f110b0284fc
## What changed

- Emit a `codex.guardian_v2.classification` counter for each classification.
- Record classification latency in `codex.guardian_v2.classification.duration_ms`.
- Tag both metrics with `success`, `failure`, or `superseded` outcomes.

## Testing

- Verify metrics for successful classification and fail-closed handling.

GitOrigin-RevId: 021702f3b26565d6da5708d2b8f1f8881942a441
## What changed

- Add `intersect_effective_permission_profiles` to derive the permissions shared by an authority profile and a requested profile.
- Preserve the more restrictive filesystem access, read denials, protected metadata paths, temporary-directory access, and network policy.
- Canonicalize concrete paths so symlinks cannot expand authority, and fail closed for policy shapes that cannot be intersected safely.

## Testing

Add coverage for workspace intersections, nested carveouts, deny patterns, unsupported policies, temporary-directory restrictions, symlink escapes, and macOS path aliases.

GitOrigin-RevId: a35bdc47e41afad13630f92c032514b300c14a0d
## What changed

- Add an optional `connectorId` to `mcpServer/resource/read`.
- Forward the selected connector through `x-codex-turn-metadata` for threaded and threadless resource reads, restricting hosted app resources to that connector.
- Update the generated protocol schemas and app-server documentation.

GitOrigin-RevId: 5cc94d703abbbb6086665910c1c9ed5dc7075210
…ai#39246)

## Why

Guardian sampling uses a pool of WebSockets, while the bridge routes each
connection by thread ID. Each socket therefore needs its own identity instead
of reusing the source thread ID across the pool.

## What changed

- Generate a classifier thread ID for every pooled connection and use it for
  request, window, and subagent attribution.
- Preserve the originating thread ID in turn metadata alongside the Guardian
  classifier request kind.
- Build request metadata after leasing a connection so retries use the identity
  of the socket that carries the request.

## Testing

- Cover unique identities across pooled and replacement connections.
- Verify classifier attribution metadata for extension requests and retries.

GitOrigin-RevId: 1c36207125157ff05cab9487a2fa37bf85e5fdd8
## What changed

- Add `codex exec-server forward --connect ws://HOST:PORT` to register an
  existing WebSocket exec-server as a remote environment.
- Open a separate destination WebSocket for each authenticated Noise relay
  stream and forward complete payloads unchanged in both directions.
- Preserve large messages through WebSocket fragmentation and coordinate
  disconnects, close acknowledgements, and pending output delivery.

## Testing

- Cover CLI validation, opaque payload forwarding, disconnect handling, and
  destination close behavior.
- Verify commands and large file transfers through the complete relay and
  forwarding path.

GitOrigin-RevId: 6e2dccff05b9e3571865611f4d432b0e2b4cdbac
## Why

SQLite metadata can identify a rollout through a non-canonical path. When that
path resolves to a rollout already found on disk, archive and unarchive
operations could schedule the same source file to be moved twice.

## What changed

- Deduplicate archive and unarchive moves by canonical source path.
- Cover both operations with metadata-backed tests that use equivalent rollout
  paths.

GitOrigin-RevId: d190915264214413667fc2c83d360a7e8504d0aa
## What changed

- Reconnect frameless bidirectional WebRTC sideband sockets after unexpected transport loss with capped exponential backoff.
- Preserve pending text or handoff output and bounded transcript state across reconnects.
- Treat `404 Not Found` and `410 Gone` handshake responses as terminal session completion, and preserve HTTP status information from failed WebSocket handshakes.
- Bound Realtime delegation input and transcript fields while retaining the most relevant portion of each.

## Testing

- Add unit coverage for reconnect backoff, terminal status handling, transport error classification, transcript continuity and truncation, and pending outbound messages.
- Add an end-to-end WebRTC conversation test covering an unclean disconnect, reconnect, transcript reconciliation, outbound progress during sustained inbound traffic, and terminal session completion.

GitOrigin-RevId: 544fd7e542c3434d0bb42cfbcc7143604419a037
## What changed

- Return retained unified-exec output as one contiguous byte buffer.
- Use the buffer directly for sandbox-denial checks, removing intermediate
  chunk aggregation and an unnecessary owned string conversion.
- Update the output-retention test to assert the flattened snapshot.

GitOrigin-RevId: 84eacee0166b86d3cb2d6a37e96125977fad0267
## Why

When the app server reports a misalignment policy violation, the TUI must stop the affected chat rather than allow more work to continue in it.

## What changed

- Finalize the active turn, clear queued and draft input, disable the composer, and reject further operations and interactive requests for the stopped chat.
- Interrupt an active side conversation when its parent reports the violation, and prevent queued turns, forks, approvals, or goal resumption from restarting work.
- Show a non-dismissible precaution view that directs users to start a new chat or resume another one, with agent command center navigation for remote sessions.

## Testing

Added coverage for stopped-chat behavior, parent/side-thread handling, blocked goal resumption, navigation actions, and narrow and remote-session rendering.

GitOrigin-RevId: 0268c46a19294a17765ea4099f389f15ffaaf030
## Why

The Windows PTY implementation probed `conpty.dll` by bare name. Windows could
resolve that lookup to a DLL in the process current directory and load it when
creating a pseudoconsole.

## What changed

Resolve the ConPTY entry points from `kernel32.dll` without probing
`conpty.dll`.

## Testing

Add a Windows regression test that places a compatible `conpty.dll` in the
current directory, creates a ConPTY, and verifies that the DLL was not loaded.

GitOrigin-RevId: be78974362a99dce0c18186cf3e7bbd86a8de73c
## What changed

- Replace the minimal default classifier prompt with predictive security-review guidance covering authorization, action risk, untrusted evidence, and browser or computer use.
- Trigger full Guardian review at an `action_risk` score of `0.5` or higher for the new default prompt, while retaining the `0.8` calibration for custom and model-provided prompts unless they specify a threshold.
- Render security policy configuration into prompt templates before enforcing the classifier instruction token limit. Prompts without the policy placeholder retain the existing append-and-truncate behavior.

## Testing

- Cover default, custom, and model-provided prompt thresholds and precedence.
- Verify policy substitution, truncation, sampling requests, and full review at the threshold boundary.

GitOrigin-RevId: 7aad9e2d8c9fbea453dc52147a3d0a46bf191aec
## Why

A stored permission grant may allow access to a parent while explicitly denying
a child path. A later request for that child must not be treated as already
approved by the broader parent grant.

## What changed

- Compare materialized permission profiles without intersecting away denied or
  reopened paths before deciding that a request is preapproved.
- Execute preapproved commands with the stored grant itself so its denied paths
  remain enforced.
- Fail closed when permission profiles cannot be materialized.

## Testing

Added unit and integration coverage for turn and session grants across
`exec_command`, `shell_command`, and `apply_patch`, including approval-disabled
and `Never` approval modes.

GitOrigin-RevId: 5455880328a89c7958f859c7ce87805dff9704fb
## What changed

- Add a dedicated developer policy for Guardian reviews of Node REPL browser and computer-use actions.
- Inject the policy once before the first eligible Node REPL approval and retain it when the reviewer session is reused.
- Include Node REPL policy eligibility in the reviewer reuse key so sessions are not reused across incompatible model settings.
- Keep the approval request itself on the generic planned-action format.

## Testing

- Cover first-action injection, reuse after a shell review, repeated Node REPL reviews, and ineligible parent models through the production approval path.

GitOrigin-RevId: bfce190ff8599788aa85e388cc6a959d27fb489c
## Why

Legacy threads and paginated threads read their displayed names from different metadata. Moving a rollout to paginated history must carry over its legacy-visible name so renamed threads do not lose it.

## What changed

- Load legacy indexed names once for an apply run.
- When promoting a thread, preserve an existing canonical name or copy its distinct legacy title, falling back to the legacy name index.
- Repair missing names when migration encounters an already-paginated rollout.

## Testing

Added migration tests covering preservation from both legacy name sources and repair on a rerun.

GitOrigin-RevId: 5fc526570b1cf358a159ef174c159ac091ccc40f
## What changed

- Let model providers identify recoverable authentication errors and refresh their own authentication state before falling back to `AuthManager` recovery.
- Apply provider recovery to both HTTP and WebSocket response requests, with at most one provider-owned recovery attempt per request.
- Preserve existing `401 Unauthorized` handling as the default for providers that do not customize recovery.

## Testing

- Add coverage for successful and failed provider recovery, including the single-attempt bound and preservation of the original unauthorized error.

GitOrigin-RevId: 9a737e3be96354699586f97dd88e544a45082969
## What changed

- Add experimental `account/bedrock/discover` and `account/bedrock/setup`
  requests to the app-server protocol.
- Define discovery results for AWS profiles and environment credentials, plus
  setup inputs for profiles, environment credentials, and access keys.
- Export the new types in the experimental protocol schema. The app server
  currently returns `method not found` for both requests because setup is not
  yet implemented.

GitOrigin-RevId: 656b4bc11231a417e97041068cecc5dc692786e3
malsamiri-oai and others added 14 commits August 21, 2026 21:34
## What changed

- Add trace-level `turn_context.make` instrumentation around turn context
  construction.
- Add a trace-level `realtime_conversation.running_state` span around realtime
  conversation state checks.
- Skip recording function arguments in both spans.

GitOrigin-RevId: f0b905e75eb487432f56a2efdd65972f5322555d
## What changed

- Add typed `browser_use` settings for history access and per-origin access,
  download, upload, and full CDP policies.
- Add typed `computer_use` settings for default app access, macOS bundle IDs,
  Windows AUMIDs, and Windows executable identities.
- Expose the merged settings through app-server config reads and generated
  Rust, TypeScript, and JSON schemas.

## Testing

- Cover TOML serialization round trips, layered config reads with origin
  metadata, and app-server batch writes.

GitOrigin-RevId: 78065f6fec990602071fc81ff639ff97f7ad8cd5
## Testing

- Verify an executor plugin's `Stop` hook starts running after its environment
  attaches and stops after disconnection.
- Confirm hook calls carry the expected session, thread, turn, model, and request
  metadata.
- Reject hooks whose MCP server belongs to a different executor environment.
- Cover the current restriction to the first executor environment and handler.

GitOrigin-RevId: ef13baf61379997f117cc57515363cc9880d3724
## What changed

Propagate tool cancellation tokens into Guardian approval reviews so interrupting a tool also aborts its pending review. Apply the same cancellation behavior to server-initiated MCP approval elicitation.

## Testing

Add integration coverage for cancellation from direct tool calls, code-mode turns, background code-mode cells, and MCP elicitation.

GitOrigin-RevId: cbee4b422bbcbf6984e415ef6409cee705beebdc
## What changed

- Use the shared approval-policy check for unified exec sandbox escalation so
  `require_escalated` commands can prompt when granular `sandbox_approval` is
  enabled and remain rejected when it is disabled.
- Add an approval scenario covering sandbox escalation with granular approvals
  enabled.

GitOrigin-RevId: 98907960cd9df181e1b2fd9d7fea11fa3c0ed7e6
## What changed

- Emit a structured log event for each completed Guardian V2 classification with its thread, turn, tool call, risk score, review threshold, sample time, and whether the score was accepted or superseded.
- Verify that accepted async classification events appear in the reviewed thread's log export with the expected context and decision fields.

GitOrigin-RevId: a027d5991b12a1968b9327da57e2993f0a529ca1
## What changed

Propagate canonical denial, timeout, and abort responses from strict MCP
auto-review instead of replacing them with a generic decline. This preserves
the reviewer's action and metadata, including denial rationale, while still
failing closed when no canonical decision is available.

Update the fallback message to direct the agent to request explicit user
approval before proceeding.

## Testing

Add unit and app-server integration coverage for strict auto-review denials
and cancellations.

GitOrigin-RevId: d8126ab223ab546b95e2d984f6e4dd540a324a59
## Why

An active root turn needs to be stopped without marking it complete or aborted
before another runtime can recover the same turn ID.

## What changed

- Add `CodexThread::suspend_turn_and_shutdown` and `SuspendTurnOutcome`.
- Flush history, stop the active regular task, close the history writer, and
  shut down the session without recording a terminal turn event.
- Reject suspension when no supported turn is active or the loaded agent
  subtree still contains a live descendant.

## Testing

- Verify that suspension preserves unfinished history and allows the turn to be
  recovered under its original ID after the descendant guard is cleared.

GitOrigin-RevId: 1f9b019d07c51474ec2d991d263bc15cdd4f89ad
## Why

MCP inventory can be cached or collected separately from a thread's live
connections, so tool availability alone does not describe the current runtime
state.

## What changed

- Add a nullable `runtimeStatus` to `mcpServerStatus/list` for thread-scoped
  requests, covering not-started, starting, connected, authentication-required,
  failed, cancelled, and disabled connections.
- Observe published connection state without starting or reconnecting servers,
  and return an unknown status when no thread is supplied or the active
  configuration no longer matches the published registration.
- Show connection state and tool counts in the compact `/mcp` view while
  retaining the detailed inventory in `/mcp verbose` and compatibility with
  servers that omit `runtimeStatus`.

## Testing

- Cover runtime status transitions, deferred and disabled servers, closed
  transports, configuration changes, protocol compatibility, and TUI rendering.

GitOrigin-RevId: e3bb6efe652f0fa8b3c97d5c53e4729b3a87cd91
…tream-catchup-343074d

# Conflicts:
#	.github/workflows/repo-checks.yml
#	.github/workflows/rust-ci-full-nextest-platform.yml
#	.github/workflows/rust-ci-full.yml
#	.github/workflows/rust-release.yml
#	.github/workflows/rusty-v8-release.yml
#	.github/workflows/v8-canary.yml
#	MODULE.bazel.lock
#	codex-rs/Cargo.lock
#	codex-rs/Cargo.toml
#	codex-rs/app-server-client/src/lib.rs
#	codex-rs/app-server-protocol/schema/json/ServerNotification.json
#	codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.schemas.json
#	codex-rs/app-server-protocol/schema/json/codex_app_server_protocol.v2.schemas.json
#	codex-rs/app-server-protocol/schema/precomputed/app-server-exports-experimental.json.zst
#	codex-rs/app-server-protocol/schema/precomputed/app-server-exports-stable.json.zst
#	codex-rs/app-server-protocol/schema/typescript/ServerNotification.ts
#	codex-rs/app-server-protocol/schema/typescript/ServerNotificationEnvelope.ts
#	codex-rs/app-server-protocol/schema/typescript/v2/Thread.ts
#	codex-rs/app-server-protocol/schema/typescript/v2/index.ts
#	codex-rs/app-server-protocol/src/protocol/thread_history_projection_tests.rs
#	codex-rs/app-server-protocol/src/protocol/v2/mod.rs
#	codex-rs/app-server-protocol/src/protocol/v2/tests.rs
#	codex-rs/app-server-protocol/src/protocol/v2/thread.rs
#	codex-rs/app-server/Cargo.toml
#	codex-rs/app-server/README.md
#	codex-rs/app-server/src/config_manager.rs
#	codex-rs/app-server/src/in_process.rs
#	codex-rs/app-server/src/message_processor.rs
#	codex-rs/app-server/src/message_processor_tracing_tests.rs
#	codex-rs/app-server/src/request_processors/account_processor.rs
#	codex-rs/app-server/src/request_processors/catalog_processor.rs
#	codex-rs/app-server/src/request_processors/thread_processor.rs
#	codex-rs/app-server/src/request_processors/thread_processor_tests.rs
#	codex-rs/app-server/tests/suite/logging.rs
#	codex-rs/app-server/tests/suite/v2/config_rpc.rs
#	codex-rs/app-server/tests/suite/v2/mod.rs
#	codex-rs/app-server/tests/suite/v2/review.rs
#	codex-rs/app-server/tests/suite/v2/skills_list.rs
#	codex-rs/cli/src/login.rs
#	codex-rs/cli/src/main.rs
#	codex-rs/config/src/config_toml.rs
#	codex-rs/core-plugins/src/manager.rs
#	codex-rs/core/BUILD.bazel
#	codex-rs/core/Cargo.toml
#	codex-rs/core/src/agent/control.rs
#	codex-rs/core/src/agent/control/spawn.rs
#	codex-rs/core/src/agent/control_tests.rs
#	codex-rs/core/src/agent/role.rs
#	codex-rs/core/src/client.rs
#	codex-rs/core/src/codex_delegate.rs
#	codex-rs/core/src/compact_remote_v2.rs
#	codex-rs/core/src/config/config_tests.rs
#	codex-rs/core/src/config/mod.rs
#	codex-rs/core/src/context_manager/history_tests.rs
#	codex-rs/core/src/guardian/review_session.rs
#	codex-rs/core/src/session/mcp.rs
#	codex-rs/core/src/session/mcp_runtime.rs
#	codex-rs/core/src/session/mod.rs
#	codex-rs/core/src/session/session.rs
#	codex-rs/core/src/session/tests.rs
#	codex-rs/core/src/session/turn.rs
#	codex-rs/core/src/session/turn_context.rs
#	codex-rs/core/src/tools/handlers/multi_agents/spawn.rs
#	codex-rs/core/src/tools/handlers/multi_agents_tests.rs
#	codex-rs/core/src/tools/handlers/multi_agents_v2/spawn.rs
#	codex-rs/core/src/tools/spec_plan_tests.rs
#	codex-rs/core/tests/common/test_codex.rs
#	codex-rs/core/tests/suite/agent_execution.rs
#	codex-rs/core/tests/suite/compact.rs
#	codex-rs/core/tests/suite/mod.rs
#	codex-rs/core/tests/suite/plugins.rs
#	codex-rs/core/tests/suite/spawn_agent_description.rs
#	codex-rs/core/tests/suite/tools.rs
#	codex-rs/deny.toml
#	codex-rs/exec/src/lib.rs
#	codex-rs/ext/guardian-v2/src/sampler.rs
#	codex-rs/hooks/src/engine/discovery.rs
#	codex-rs/hooks/src/engine/mod_tests.rs
#	codex-rs/linux-sandbox/tests/suite/managed_proxy.rs
#	codex-rs/login/src/auth/auth_tests.rs
#	codex-rs/login/src/auth/manager.rs
#	codex-rs/model-provider/src/provider.rs
#	codex-rs/protocol/src/protocol.rs
#	codex-rs/state/src/runtime/threads.rs
#	codex-rs/tui/src/app.rs
#	codex-rs/tui/src/app/tests/safety_buffering.rs
#	codex-rs/tui/src/app/thread_events.rs
#	codex-rs/tui/src/app/thread_routing.rs
#	codex-rs/tui/src/lib.rs
#	codex-rs/windows-sandbox-rs/BUILD.bazel
@cbusillo

cbusillo commented Aug 22, 2026

Copy link
Copy Markdown
Owner Author

Auth Compatibility Slice

Work only in the existing draft catch-up branch and worktree.

Environment

Objective

Complete one bounded AUTH-1 / AUTH-2 / AUTH-3 synthesis slice in codex-rs/login so the upstream catch-up preserves Codex Lab account privacy, account override precedence, and testability while adopting the new upstream auth initialization API.

Reproduce with:

cd codex-rs
just test -p codex-app-server

The known login blockers are:

  1. login/src/lib.rs exports AuthManagerInitializationError, but the merged auth module no longer defines it.
  2. WorkloadIdentityExternalAuth::from_process_config now accepts one argument while the downstream manager still passes enable_codex_api_key_env.
  3. login/src/test_support.rs expects AuthManager::from_optional_auth_for_testing, which disappeared during synthesis.

Required Approach

  1. Confirm branch, head, clean status, default branch, and PR before editing.
  2. Read the applicable AGENTS.md, this PR body, and Sync Codex Lab with current openai/codex substrate #230 Current Status.
  3. Compare the exact local and upstream implementations with git show; do not guess from compile errors alone.
  4. Use /Users/cbusillo/Developer/code-prealign-new-skills/code-rs as the first product-behavior reference for account/login semantics.
  5. Use additional agents only when they materially improve the work. Resolve model/provider choices through the live capability inventory rather than assuming fixed selector versions.
  6. Reconcile evidence yourself; do not paste either side wholesale.
  7. Use apply_patch, keep the change scoped to auth compatibility, and avoid unrelated catch-up repairs.

Acceptance Criteria

  • codex-login compiles against the adopted upstream auth/workload-identity API.
  • Initialization errors remain typed and actionable; no silent fallback or credential leakage is introduced.
  • enable_codex_api_key_env behavior is either preserved through the new API or removed only with direct evidence that upstream now owns equivalent behavior.
  • Test support uses the smallest idiomatic constructor seam; do not add a broad test-only production API if an existing constructor can express the state.
  • These contract tests compile and pass where present:
    • file_storage_save_repairs_private_auth_file_permissions
    • saved_accounts_file_is_private_after_rewrite
    • current_account_override_takes_precedence_over_stored_active_account
    • current_account_override_is_not_reselected
  • Run just test -p codex-login first.
  • Then run just test -p codex-app-server; success means it progresses beyond the login blockers, even if a different catch-up area fails next.
  • Run just fmt after the final code change and do not rerun tests afterward.
  • Commit and push only this branch, then update this PR with exact tests and the next remaining blocker.

Stop Conditions

Stop and report rather than guessing if resolving the API requires changing account-selection precedence, auth-file privacy, credential-source priority, or the meaning of enable_codex_api_key_env.

Do not attempt to finish all of PR #782, create a release, update the installed runtime, or start #778 in this session.

@shiny-code-bot

Copy link
Copy Markdown
Collaborator

Auth Compatibility Slice Complete

Implemented and pushed commit de00c66929770358fb0257029ebb68b2893f0711 on code/upstream-catchup-343074d.

Scope

  • Restored the typed AuthManagerInitializationError and fail-closed workload-identity initialization path.
  • Aligned WorkloadIdentityExternalAuth::from_process_config with the adopted one-argument upstream API.
  • Kept enable_codex_api_key_env on ordinary auth loading; the existing precedence test remains unchanged.
  • Added only the crate-private optional-auth constructor used by login/src/test_support.rs.
  • Left AUTH-1 privacy and AUTH-2 account-selection implementations and contract tests unchanged.

Validation

  • cargo check -p codex-login --lib: passed.
  • just test -p codex-login: the codex-login crate compiled; the test build then stopped in unrelated codex-hooks synthesis errors before tests could execute.
  • just test -p codex-app-server: progressed beyond all three login blockers, then stopped on the same unrelated codex-hooks errors.
  • just fmt: passed after the final code change; tests were not rerun afterward.
  • IntelliJ changed-files inspection: RED with three pre-existing findings outside the changed hunks (manager.rs return-lifting warnings and fedramp spellcheck); no changed-hunk finding.

The four AUTH-1/AUTH-2 contract tests named in the slice remain present and unchanged, but could not execute because codex-hooks fails during the shared test build.

Next blocker

The next compile blocker is the codex-hooks API-shape synthesis: HookListEntry field mismatches, HandlerSourcePath wrapping, and missing DiscoveryResult::required_load_errors. This slice did not modify hooks or attempt the remaining protocol-test restoration.

@cbusillo cbusillo added the code-reviewed Completed required multi-agent code review label Aug 23, 2026
@shiny-code-bot

Copy link
Copy Markdown
Collaborator

AuthManager Caller Migration Complete

Pushed commit cb5a4375f22d3177a94bb8f546912f5ed916e668.

Scope

  • Migrated the remaining three codex-cli callers to propagate AuthManager::shared_from_config initialization errors.
  • Updated the app-server tracing test helper to require successful test auth-manager initialization explicitly.
  • Moved in-process app-server auth-manager construction before channel creation and tokio::spawn, mapping initialization failure to io::Error so startup fails closed before a runtime handle can escape.
  • Preserved auth-file privacy, account-selection precedence, credential-source priority, and enable_codex_api_key_env behavior unchanged.
  • Did not modify codex-hooks or restore the remaining protocol tests.

Validation

  • just test -p codex-login: codex-login compiled, then the shared build stopped on the five known codex-hooks API-shape errors.
  • just test -p codex-app-server: stopped on the same five known codex-hooks errors; no AuthManager caller error surfaced first.
  • just test -p codex-cli: compiled through codex-cli, codex-login, and the surrounding auth consumers, then stopped on the same five known codex-hooks errors.
  • just fmt: passed after the final code change; tests were not rerun afterward.
  • IntelliJ changed-files inspection: RED with nine pre-existing findings in cli/src/main.rs outside the changed hunks; no finding in any changed hunk.
  • Manual breaking-change, change-size, model-context, and testing review: no findings. The dedicated collaboration-agent interface was unavailable in this runtime, so the code-review skill's subagent fan-out did not run.
  • Automatic Validation and Automatic Background Review: no current-head lifecycle result was observable at this checkpoint. PR checks are newly queued/in progress with zero failures reported so far.

Next blocker

The AUTH-1/AUTH-2/AUTH-3 caller migration is complete. The next bounded repair is the existing codex-hooks API-shape synthesis in HookListEntry, HandlerSourcePath, and DiscoveryResult::required_load_errors; after that, rerun the three focused auth gates before restoring the eight named downstream-only protocol tests.

@cbusillo

Copy link
Copy Markdown
Owner Author

Indirect Auth/Launch Compatibility Slice

Work only in the existing draft catch-up branch and worktree.

Environment

Objective

Complete one bounded indirect fallible-auth and app-server-launch compatibility slice in codex-exec and TUI before entering codex-hooks.

The direct AuthManager::shared_from_* callers are fixed. Post-session review found the remaining upstream auth/launch migration is masked by the earlier hooks failure:

  1. codex-rs/exec/src/lib.rs retains the Result from cloud_config_bundle_loader_for_storage instead of propagating it.
  2. TUI still defines the old three-argument infallible app_server_target_for_launch, while a compiled caller already uses the four-argument fallible workload-identity contract.
  3. The upstream cloud_config_bundle_for_app_server_target helper is missing from the compiled TUI root module even though session-archive code calls it.
  4. Several TUI cloud-loader calls retain unhandled Result values.

Required Approach

  1. Confirm branch, head, clean status, default branch, and PR before editing.
  2. Read the applicable AGENTS.md, this handoff, the PR body, and Sync Codex Lab with current openai/codex substrate #230 Current Status.
  3. Compare each exact current implementation with upstream target 343074d4207d572809bd8cea15f4be1d09d98e0b; do not infer the migration only from compiler errors.
  4. Preserve Every Code account/login UX and downstream remote-session behavior except where the adopted upstream workload-identity contract explicitly requires fail-closed embedded app-server routing.
  5. Reconcile the smallest coherent implementation. Use additional agents only when they materially improve the work and the live runtime exposes the required interface.
  6. Use apply_patch; do not modify codex-hooks or unrelated convergence areas.

Acceptance Criteria

  • codex-exec propagates cloud-config/auth initialization failures rather than retaining a Result as the loader.
  • TUI uses the workload-identity-aware, fallible app-server target contract.
  • Workload identity forces embedded app-server operation and rejects an explicit remote endpoint with an actionable error, matching the pinned upstream behavior.
  • The missing cloud-config helper and all affected TUI result propagation are restored without duplicating startup logic.
  • Restore or align the focused upstream tests for app-server target selection; add no unrelated UI snapshots unless rendered output actually changes.
  • Run, in order, just test -p codex-exec, just test -p codex-tui, just test -p codex-login, just test -p codex-app-server, and just test -p codex-cli. If the known codex-hooks errors remain the first shared blocker, record that exact boundary rather than repairing hooks.
  • Run just fmt after the final code change and do not rerun tests afterward.
  • Run the configured changed-files IntelliJ inspection and report changed-hunk findings separately from pre-existing noise.
  • Commit and push only this branch, then update this PR and Sync Codex Lab with current openai/codex substrate #230 with exact validation, Automatic Validation, Background Review, and the next blocker.

Stop Conditions

Stop and report rather than guessing if the pinned upstream behavior conflicts with Every Code account privacy, account-selection precedence, credential-source priority, or deliberate remote-session behavior outside workload identity.

Do not modify codex-hooks, restore the displaced protocol tests, create a release, or update the installed runtime in this slice.

@shiny-code-bot

Copy link
Copy Markdown
Collaborator

Indirect Auth/Launch Compatibility Slice Complete

Implemented and pushed commit f6ce09ffce0e65d18e301ab30c4df1864ba2f457 on code/upstream-catchup-343074d.

Scope

  • Propagated cloud_config_bundle_loader_for_storage initialization failures from codex-exec.
  • Restored the workload-identity-aware, fallible TUI app-server target contract from pinned upstream 343074d4207d572809bd8cea15f4be1d09d98e0b.
  • Workload identity now disables implicit daemon reuse, forces the embedded app-server, and rejects an explicit remote endpoint with the upstream actionable error.
  • Restored the shared TUI cloud-config helper used by both normal startup and session-archive startup.
  • Propagated every affected compiled TUI cloud-loader result, while retaining the initial workload-identity bundle and avoiding an ordinary onboarding refresh under workload identity.
  • Preserved Every Code auth-profile handling, account/login UX, ordinary remote-session routing, auth-file privacy, account-selection precedence, credential-source priority, and enable_codex_api_key_env behavior.
  • Aligned the three existing app-server target tests and restored the focused workload-identity target-selection test. No rendered UI changed, so no snapshot update was added.
  • Did not modify codex-hooks, restore protocol tests, create a release, or update the installed runtime.

Validation

The required package gates ran in order:

  1. just test -p codex-exec
  2. just test -p codex-tui
  3. just test -p codex-login
  4. just test -p codex-app-server
  5. just test -p codex-cli

Each build stopped at the same five pre-existing codex-hooks errors before its package tests could execute:

  • three HookListEntry field mismatches (handler_type, command, execution_mode),
  • AbsolutePathBuf requiring HandlerSourcePath::Local,
  • missing DiscoveryResult::required_load_errors.

No new exec, TUI, login, app-server, or CLI error surfaced before that boundary. Hooks were not repaired.

  • just fmt: passed after the final code change; tests were not rerun afterward.
  • IntelliJ changed-files inspection: RED with 11 spellcheck findings (otel, cwds, chatwidget) on unchanged lines and an execution_not_proven proof gap. Changed-hunk findings: zero. The helper closed its opened project cleanly.
  • Current-head GitHub checks at this checkpoint: 10 pending, 0 failing; the authorization check succeeded and CLA skipped.
  • Automatic Validation: no current-head lifecycle result is observable yet.
  • Automatic Background Review: no current-head lifecycle result or finding is observable yet.

Next blocker

The indirect auth/launch compatibility slice is complete. The next bounded convergence repair remains the known codex-hooks API-shape synthesis. After hooks, rerun these focused gates before restoring the eight displaced downstream-only protocol tests.

@cbusillo

Copy link
Copy Markdown
Owner Author

TUI Workload-Identity Startup Isolation Slice

Work only in the existing draft catch-up branch and worktree.

Environment

Objective

Complete the final bounded TUI workload-identity startup-isolation slice before entering codex-hooks.

The preceding slice correctly restored app-server target selection and cloud-loader propagation. Post-session review found three remaining TUI startup omissions masked by the earlier hooks failure:

  1. run_ratatui_app references workload_identity_selected without defining or receiving it.
  2. The active TUI path still applies ordinary persisted-login restrictions when workload identity is selected.
  3. The active TUI path still performs ordinary account detection and login onboarding when workload identity is selected.

Required Approach

  1. Confirm branch, head, clean status, default branch, and PR before editing.
  2. Read the applicable AGENTS.md, this handoff, the PR body, and Sync Codex Lab with current openai/codex substrate #230 Current Status.
  3. Compare the exact current TUI startup implementation with pinned upstream 343074d4207d572809bd8cea15f4be1d09d98e0b; inspect the complete upstream workload-identity TUI commit rather than only compiler errors or changed hunks.
  4. Preserve Every Code auth-profile behavior, account privacy, ordinary account switching, ordinary onboarding, and non-workload-identity remote-session routing.
  5. Use apply_patch; do not modify codex-hooks, protocol tests, Validation, Background Review, or unrelated convergence areas.

Acceptance Criteria

  • The active run_ratatui_app scope has an explicit workload-identity selection value and compiles once prior blockers are removed.
  • Persisted login restrictions are not evaluated or allowed to mutate credentials when workload identity is selected.
  • Workload identity is treated as authenticated ChatGPT for startup status and cannot enter ordinary login onboarding.
  • Ordinary API-key, ChatGPT, auth-profile, trust-screen, and remote-workspace flows remain unchanged.
  • Add or align focused tests for workload-identity login restriction/onboarding isolation where the current test architecture permits; do not add static-value tests.
  • Search all relevant TUI workload-identity call paths after editing rather than reviewing changed hunks alone.
  • Run just test -p codex-tui, just test -p codex-login, just test -p codex-exec, just test -p codex-app-server, and just test -p codex-cli. If codex-hooks remains the first shared blocker, record the exact boundary without repairing it.
  • Run just fmt after the final code change and do not rerun tests afterward.
  • Run changed-files IntelliJ inspection and distinguish changed-hunk findings from pre-existing noise.
  • Before declaring completion, explicitly report the terminal Automatic Validation and Background Review states. If they are still pending, do not call the broader auth convergence complete; record them as pending and leave the final readiness statement conditional.
  • Commit and push only this branch, then update PR Draft: converge to openai/codex 343074d4 #782 and Sync Codex Lab with current openai/codex substrate #230 with exact evidence and the next blocker.

Stop Conditions

Stop and report rather than guessing if the pinned upstream behavior conflicts with Every Code account privacy, auth-profile isolation, account-selection precedence, credential-source priority, or ordinary non-workload-identity remote sessions.

Do not enter codex-hooks, restore displaced protocol tests, create a release, or update the installed runtime in this slice.

@shiny-code-bot

Copy link
Copy Markdown
Collaborator

TUI workload-identity startup isolation complete

Commit 15b9c8f373982767f741911e32179c5851d5c171 completes the bounded TUI slice from the August 23 handoff.

  • run_ratatui_app now resolves an explicit workload-identity selection value in its active scope.
  • Workload identity bypasses the persisted-login restriction closure entirely, so ordinary restrictions cannot inspect, reject, or mutate stored credentials.
  • Workload identity resolves startup status as authenticated ChatGPT before account detection and cannot enter ordinary login onboarding.
  • Focused tests cover account-detection/onboarding isolation, retained trust onboarding, workload-identity and remote-session restriction isolation, and unchanged ordinary embedded restriction evaluation.
  • A complete TUI workload-identity call-path search covered the active startup path plus startup_orchestration, startup preflight, session archive commands, and agents overview. No conflicting Every Code auth-profile, account privacy, account switching, trust, or non-workload-identity remote behavior was found.

Validation

  • just test -p codex-tui: blocked before TUI compilation by the five known codex-hooks errors.
  • just test -p codex-login: same first blocker.
  • just test -p codex-exec: same first blocker.
  • just test -p codex-app-server: same first blocker.
  • just test -p codex-cli: same first blocker.
  • Exact shared blocker: three obsolete HookListEntry fields (handler_type, command, execution_mode), an unwrapped HandlerSourcePath, and missing DiscoveryResult::required_load_errors.
  • just fmt: passed after the final code change; tests were not rerun afterward.
  • IntelliJ changed-files inspection: RED with six pre-existing typo findings on unchanged lib.rs lines (chatwidget once, otel five times), zero changed-hunk findings, cleanup closed successfully.

PR-head checks at the post-push snapshot were pending: 9 pending, 1 successful, 1 skipped, and 0 failing.

Automatic Validation for this head: not yet observable (pending). Background Review for this head: not yet observable (pending). The broader auth convergence remains conditional on terminal lifecycle evidence; this comment does not call it complete.

Next blocker: repair the bounded codex-hooks API-shape synthesis. This slice did not enter hooks, restore protocol tests, or touch unrelated convergence areas.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

code-reviewed Completed required multi-agent code review

Projects

None yet

Development

Successfully merging this pull request may close these issues.