Commit Graph

7553 Commits

Author SHA1 Message Date
Celia Chen
1ee8f49175 Route exec-server HTTP through configured proxy policy (#35023)
## Why

Delegated HTTP requests need to honor the same outbound proxy policy as the
Codex process that starts the exec server.

## What changed

- Pass the configured `HttpClientFactory` through local and remote exec-server
  startup and use route-aware client pools for delegated HTTP and local MCP
  requests.
- Preserve per-request timeouts and follow-or-stop redirect behavior while
  keeping request URLs and sensitive response headers out of diagnostics.

## Testing

- Cover configured system-proxy routing across the exec-server transport.
- Cover both redirect policies and verify that success and failure logs do not
  expose request or response secrets.

GitOrigin-RevId: 4af6aec1d265c4db62dfcb6e1fb076fb31736137
2026-07-23 22:39:28 +00:00
Felipe Coury
fe0d472c4c Adapt keyboard event reporting to the terminal (#35021)
## Why

Reporting key event types can leak an exit-shortcut release into the parent
shell in iTerm2 and can cause tmux's `xterm` extended-key format to lose
Shift+Enter.

## What changed

- Select keyboard enhancement flags using the detected terminal and tmux
  extended-key format.
- Disable event-type reporting for iTerm2 and tmux's `xterm` format while
  retaining alternate-key reporting.
- Preserve event-type reporting for other terminals and tmux's `csi-u`
  format so repeat events remain distinguishable.

## Testing

Added unit coverage for iTerm2, Kitty, unknown terminals, and both tmux
extended-key formats.

GitOrigin-RevId: 03a6b9d5443f626da5279413a14933af2a0ec3e5
2026-07-23 22:35:23 +00:00
Kyle Brown
84fa68b429 Attribute command executions to trusted plugin scripts (#35020)
## What changed

- Resolve shell and unified-exec commands against the trusted plugin roots loaded for each turn.
- Add optional `pluginId` and safe plugin-relative `scriptPath` fields to command execution items and legacy execution events, and propagate them through app-server notifications.
- Include the attribution in command execution analytics while rejecting absolute, unsafe, and unattributed script paths.

## Testing

- Cover attribution for cached curated and remote plugin scripts from command execution through core and app-server events.
- Verify analytics serialization and unsafe-path filtering.

GitOrigin-RevId: 02fac3a233284ccfc6642fa502a95f1881dba83d
2026-07-23 22:31:53 +00:00
Kyle Brown
5bdbd3ee90 Add trusted plugin script attribution (#35016)
## What changed

- Build a set of active, verified curated and remote plugin roots from loaded plugins.
- Resolve direct and safely wrapped script commands to a plugin ID and normalized plugin-relative path.
- Leave complex or ambiguous commands, local overrides, missing files, overlapping roots, and symlink escapes unattributed.
- Add a shared validator for the safe cross-platform shape of serialized plugin-relative paths.

## Testing

- Cover trusted-root selection, supported interpreters and shell wrappers, normalized paths, and fail-closed cases.

GitOrigin-RevId: 6e4199a241fd6dfadfec3df0845e7cb615352a49
2026-07-23 21:50:17 +00:00
Matthew Zeng
ceb2ffb793 Align installed app duration metrics with the legacy baseline (#35015)
## Why

The snapshot-backed `apps/installed` duration metric needs dimensions that can
be compared with the legacy `app/list` baseline.

## What changed

- Label snapshot-backed duration samples with `path=installed` and add the
  legacy-compatible `reload` dimension alongside the detailed refresh fields.
- Record duration samples only for successful responses so failed requests do
  not enter the success latency distribution.

## Testing

Added unit coverage for the duration metric dimensions on refreshed and
non-refreshed requests, and for omitting samples on failed requests.

GitOrigin-RevId: 0755dcaaa94f1d973adfc62a27ea97e3e01edc8b
2026-07-23 21:31:30 +00:00
richardopenai
b834702b27 Support incremental replay of updated thread items (#35013)
## Why

Persisted item snapshots can be updated after their initial projection while retaining their creation order. Callers need a way to read those updates incrementally without replaying every item.

## What changed

- Track the rollout ordinal of each item's latest snapshot separately from its creation ordinal.
- Let thread-store callers filter items after an exclusive update watermark and sort pages by either creation or update ordinal.
- Keep existing app-server reads creation-ordered, reject incremental reads across forked lineages, and preserve compatibility with older writers.

## Testing

- Cover update-watermark filtering, pagination, sort directions, per-turn reads, cursor validation, forked lineages, migration compatibility, and refreshed item snapshots.

GitOrigin-RevId: d57de849abec27f788e9c384dbff073a0aca1053
2026-07-23 21:17:45 +00:00
kylepatel-oai
5b402270f9 Expose remote skill icon URLs through app server (#35012)
## What changed

- Add nullable `iconSmallUrl` and `iconLargeUrl` fields to the v2
  `SkillInterface` protocol and generated schemas.
- Populate the fields from remote plugin catalog metadata while returning null
  values for local skill interfaces.
- Document the new `plugin/read` response fields.

## Testing

- Extend the remote `plugin/read` test to verify both icon URLs are returned.

GitOrigin-RevId: 0a631a0121627d944a84e542728a506823ff2738
2026-07-23 21:06:37 +00:00
Eric Traut
7d4b417cd1 Keep side conversations open when switching threads (#35011)
## What changed

- Add a configurable `toggle_side_conversation` TUI action, bound to `ctrl-/` by default, to switch between a side conversation and its parent without closing either.
- Show the active binding in the footer and distinguish switching from closing with `ctrl-c`.
- Allow starting a replacement side conversation from the parent, while cleaning up the previous side thread and preserving it if cleanup fails.
- Clean up retained side conversations when shutting down the current thread.

## Testing

- Cover shortcut remapping, conflicts, and compatibility with existing `ctrl-/` and `ctrl-7` bindings.
- Cover side-thread replacement and footer states for both the parent and side conversation.

GitOrigin-RevId: a621c21e1c45ba73197d59750b2e05efa5ee1081
2026-07-23 21:03:40 +00:00
Eric Traut
62ba648136 Make TUI turn interrupts nonblocking (#35000)
## What changed

- Dispatch app-server turn interrupts in the background so the TUI can keep
  processing thread events while an interrupt is pending.
- Coalesce repeated interrupt requests for the same active turn and clear the
  pending state when the turn completes or the thread closes.
- Preserve the retry for stale active-turn IDs, surface interrupt failures as
  warning notifications instead of exiting the TUI, and reset backtrack state
  whenever an interrupt is handled.

## Testing

- Add an app-server integration test covering nonblocking event handling,
  repeated-request coalescing, and pending-state cleanup.
- Verify that interrupting without an active turn clears backtrack state.

GitOrigin-RevId: 9ada247a739e2e0a63b425f75ebd6d054167d825
2026-07-23 19:56:52 +00:00
felixxia-oai
2c92af09cf Warn when skill catalogs exceed their context budget (#34997)
## Why

Skill catalog rendering can shorten descriptions or omit enabled skills to fit
the model context budget. Surface these reductions so users know when the
model-visible catalog has lost detail.

## What changed

- Emit a warning with the omitted skill count whenever entries do not fit.
- Warn when description shortening averages more than 100 characters per skill.
- Deduplicate executor catalog warnings across repeated world-state builds in a
  turn.

## Testing

- Cover the description-shortening threshold and omission warning text.
- Verify warnings through extension and production-turn catalogs, including
  per-turn deduplication.

GitOrigin-RevId: bd7fc3482e5dfd8c79072f772a2f54aa502478d9
2026-07-23 19:44:12 +00:00
Adam Perry @ OpenAI
7bafdada8b Separate Codex error details from retry metadata (#34996)
## What changed

- Wrap `CodexErrorDetails` and an optional retry delay in `CodexErr`, allowing any mapped error to preserve server-provided retry timing.
- Generate the payload-free `CodexErrKind` classification alongside the error details and reuse it for analytics.
- Update error handling sites to inspect `CodexErr::details()` while preserving existing display, debug, protocol mapping, and retryability behavior.

## Testing

- Add coverage for legacy debug formatting, error-specific retryability, and retry-delay propagation through API error mapping.

GitOrigin-RevId: d3ab8a305f2a2ee21d0c0a8c8c388b06dda9c59a
2026-07-23 19:32:26 +00:00
Celia Chen
265cd2e100 Initialize execution environments with the final HTTP policy (#34995)
## Why

The TUI must inspect the default execution environment before loading its final
configuration. Initializing the environment manager at that point can give
startup services the bootstrap HTTP policy instead of the effective policy after
managed requirements are applied.

## What changed

- Split environment discovery from manager construction so callers can inspect
  the default environment without starting remote connections.
- Build the environment manager after final configuration loading and pass its
  resolved `HttpClientFactory` through all construction paths.
- Add shared test support for managers that use the legacy default HTTP policy.

## Testing

- Cover connection-free environment discovery and explicit HTTP policy
  propagation.
- Verify TUI startup services use the final managed `respect_system_proxy` value.

GitOrigin-RevId: 928fa31e6b4bcfbe1a121cade2f351427fdfa0f4
2026-07-23 19:24:41 +00:00
Adam Perry @ OpenAI
c769a05340 Honor the configured SQLite home across state consumers (#34994)
## Why

Codex and SQLite data can use separate home directories, but state consumers
could reconstruct database paths from the Codex home instead of consistently
using the resolved SQLite configuration.

## What changed

- Pass `SqliteConfig` through the core, rollout, state runtime, and thread store
  instead of passing a directory and rebuilding the configuration downstream.
- Use that shared configuration for state, logs, memories, goals, and paginated
  thread-history database access, including integrity checks and cleanup.
- Reject state database handles whose SQLite configuration does not match the
  requesting store.

## Testing

Add coverage with separate Codex and SQLite homes that verifies startup
backfill, thread listing, and paginated history all use the configured SQLite
directory.

GitOrigin-RevId: 1de1cdd1d6ff1d70bbb6c360c8352e6543fb8ebf
2026-07-23 19:19:35 +00:00
sayan-oai
74e9d7efc4 Allow omitting MCP tool prefixes per server (#34991)
## What changed

- Accept a table form of `features.non_prefixed_mcp_tool_names` with an
  optional `server_names` list while preserving the existing boolean form.
- Omit the legacy `mcp__` namespace prefix only for tools from selected MCP
  servers. When no server list is provided, the enabled feature continues to
  omit the prefix for every server.
- Cover configuration resolution, tool normalization, and an MCP stdio
  round trip with selected servers.

GitOrigin-RevId: bdfb7ac54226de5051f06610e2c6b78b23912ef0
2026-07-23 18:54:55 +00:00
stefanstokic-oai
0d4910331d Preserve timestamps when importing external agent sessions (#34989)
## Why

Imported sessions previously used the import time for their thread metadata,
discarding the chronology recorded by the source session.

## What changed

- Set `created_at` and `updated_at` from the earliest turn start and latest turn
  completion timestamps in the imported rollout.
- Use the latest source timestamp for thread recency, while retaining the current
  time as a fallback when the rollout has no valid turn timestamps.

## Testing

- Update the external agent import integration test to verify the persisted
  creation, update, and recency timestamps.

GitOrigin-RevId: 396d5b7e7463a305a5a828ba3a432b4a97e5d2b9
2026-07-23 18:34:51 +00:00
Owen Lin
5c94796dc9 Enforce single-writer ownership for paginated threads (#34986)
## Why

Only one app-server process should keep a paginated thread open for writing at
a time, while other processes must still be able to read it.

## What changed

- Acquire a per-thread filesystem lock when creating or resuming a paginated
  thread, and retain it for the lifetime of the live recorder.
- Reject a competing `thread/resume` request with JSON-RPC error `-32600` and
  release ownership when the writer is discarded, deleted, or shut down.
- Remove stale lock files without disturbing active writers.

## Testing

Added coverage for competing processes, ownership transfer after shutdown,
stale-lock cleanup, and lock release during discard and deletion.

GitOrigin-RevId: 81d49a2fffc73ba8135752b4944f27feafa4c0d6
2026-07-23 18:22:41 +00:00
charlesgong-openai
ce803c45ae Record externally completed agent config imports (#34981)
## Why

Clients that complete an external agent config import outside the app server need a way to include the result in import history.

## What changed

- Add `externalAgentConfig/import/recordHistory` to persist completed item results and return a generated import ID.
- Store the optional provider ID for regular imports and expose it when reading import history.
- Update the generated JSON and TypeScript protocol schemas for the new request, response, and history field.

## Testing

- Cover recording and reading an externally completed import through the app-server protocol.
- Cover provider ID persistence and updates in the state runtime.

GitOrigin-RevId: 935401e899ec9eeb38f54c182e45a16642411deb
2026-07-23 17:55:22 +00:00
charlesgong-openai
8d34c06672 Infer the bundled Claude Code plugin marketplace (#34979)
## What changed

- Treat enabled plugins from `claude-code-plugins` as coming from
  `anthropics/claude-code` when no marketplace source is already known.
- Preserve an explicitly discovered source instead of replacing it with the
  inferred source.

## Testing

- Add a migration test covering inference from `enabledPlugins`.

GitOrigin-RevId: f061963356493027968e282a51538866d2bf31f4
2026-07-23 17:51:12 +00:00
Celia Chen
ad65f016ed Honor disabled redirects in route-aware HTTP clients (#34978)
## Why

With system-proxy-aware routing, `RouteAwareClientPool` handles redirects itself so each hop can resolve its own route. That manual path must also respect clients configured not to follow redirects.

## What changed

- Add no-redirect constructors for standard and ChatGPT Cloudflare-cookie route-aware client pools.
- Skip manual redirect handling when the underlying client builder has redirects disabled, returning the redirect response to the caller.

## Testing

- Cover both outbound proxy policies and verify that a no-redirect pool returns the initial `302 Found` response after one request.

GitOrigin-RevId: 7eec73f21f506a46e5d4b82f425ddbc9761ca61c
2026-07-23 17:44:48 +00:00
rka-oai
205d37a20f Keep the sleep tool outside code mode (#34969)
## What changed

- Mark `clock.sleep` as `DirectModelOnly` so it remains directly callable in
  code-mode-only sessions without appearing in the nested code-mode tool surface.
- Cover both code mode configurations with a tool-plan test that verifies the
  sleep tool's exposure and visibility.

GitOrigin-RevId: 7ef67bea0678f27fdb17d88004368e5f1d475125
2026-07-23 16:20:30 +00:00
jif
9e1f43dc2d Move MCP connection helpers into the test module (#34962)
Keep the `McpConnectionSet` test constructors and accessors alongside the
connection manager tests instead of defining test-only helpers in the
production module.

GitOrigin-RevId: 925392f8b7d903b131ef1b49afd7e50f41226b1f
2026-07-23 15:40:03 +00:00
Philipp Spiess
7d748d3bbc Handle @ in local marketplace paths (#34959)
## Why

Relative local marketplace paths can contain `@`, but source parsing treated it as a Git ref separator.

## What changed

- Skip `@` ref parsing when the marketplace source has local path syntax.
- Cover adding a local marketplace from `./alice@example.com/marketplace` through the app-server API.

GitOrigin-RevId: aa55c8cd9838908e15b6a17f8d6058e95aa13ba5
2026-07-23 15:32:36 +00:00
jif
34b935e3e5 Replace closed MCP connections during reconciliation (#34957)
## Why

MCP connection reconciliation can otherwise reuse a client after its service or
underlying transport has stopped.

## What changed

- Add `RmcpClient::is_closed` to report closed client, service, and transport
  states.
- Exclude closed clients when selecting a reusable MCP connection so
  reconciliation starts a replacement.

## Testing

- Add a reconciliation test that disconnects an in-process MCP transport and
  verifies that its connection is replaced.

GitOrigin-RevId: 366a85c9959dbe1763923d7e33a4ecf52d9c3c6a
2026-07-23 15:29:10 +00:00
jif
e19e65317a Reuse MCP connections across runtime refreshes (#34952)
## Why

Refreshing MCP runtime state should not restart an unchanged, ready server or
relist its tools.

## What changed

- Reconcile refreshed MCP configuration against the published connection set
  and reuse connections whose transport, environment, authentication, OAuth
  credentials, and client capabilities are unchanged.
- Keep tool filters, timeouts, metadata, and plugin provenance in the published
  server view so those settings can change without reconnecting.
- Update elicitation authority in place for reused connections, and reconnect
  when connection-defining inputs or live OAuth credentials change.

## Testing

Added coverage for unchanged-server reuse, view-only and elicitation-policy
updates, connection identity changes, OAuth credential changes, and avoiding
redundant tool listing.

GitOrigin-RevId: f04f5db5fbdde127b6a14f6aa9673112c0b557e7
2026-07-23 14:55:31 +00:00
jif
808d3c2702 Keep session defaults static during config batch writes (#34940)
## What changed

- Treat batch writes containing only `model`, `model_reasoning_effort`,
  `plan_mode_reasoning_effort`, `service_tier`, or `personality` as defaults for
  future sessions, even when `reloadUserConfig` is requested.
- Keep runtime config reloads and skill/plugin cache invalidation for other
  config changes, and document which settings remain session-static.
- Preserve cached skill listings after session-default writes until a forced
  reload, with test coverage for each supported default.

GitOrigin-RevId: 6d988014cf4758ceb9422a11f7c2bd5fc6b9f90a
2026-07-23 13:11:16 +00:00
felixxia-oai
48ebbf5334 Use the API plugin marketplace for Amazon Bedrock (#34931)
## Why

Amazon Bedrock configurations can operate without Codex auth, so auth mode alone
cannot determine which curated plugin marketplace to expose.

## What changed

- Pass the resolved model provider into plugin configuration.
- Select `openai-api-curated` when the resolved provider is `amazon-bedrock`,
  while retaining API-key auth as a selection signal.
- Cover provider overrides and app-server plugin listing without an `auth.json`
  file.

GitOrigin-RevId: 972a22e19c41490d8b19d989da052302dc30e8f2
2026-07-23 11:32:47 +00:00
jif
e497325a6a Centralize thread MCP state in McpRuntime (#34930)
## What changed

- Make `McpRuntime` own the published MCP configuration, connections, elicitation routing, and selected capability roots for a thread.
- Capture immutable MCP bindings for model steps and tool calls so in-flight work keeps a consistent connection set and approval authority while refreshed state is published atomically.
- Mark MCP state dirty when relevant configuration, plugins, environments, authentication, or elicitation capabilities change, then rebuild it before the next sampling request or out-of-band MCP operation.
- Separate config reloads from server invalidation: `ReloadMcpConfig` applies resolved MCP inputs, while `RefreshMcpServers` requests reinitialization from the thread's latest state.

## Testing

- Cover refreshed state visibility for existing turns, stable step bindings, current approval authority, cancelled refresh retries, resource-client reconciliation, and Apps recovery between sampling requests.

GitOrigin-RevId: 59eabb1aa8dc083426bd18ef4d3630508f376401
2026-07-23 11:27:34 +00:00
rka-oai
4462b9deef Allow disabling the multi-agent wait tool (#34887)
## What changed

- Add a default-on `features.multi_agent_v2.wait_agent_enabled` setting.
- Omit `collaboration.wait_agent` from the tool plan when the setting is disabled, independently of `features.current_time_reminder.sleep_tool`.

## Testing

- Cover configuration parsing and tool exposure with both clock sleep states.

GitOrigin-RevId: c2f34c5edd5bc191d6a5ac41d7bbb80708da1202
2026-07-23 06:28:27 +00:00
Eric Traut
6e0455fdc4 Set a default user agent for MCP HTTP requests (#34883)
## What changed

- Send `codex-mcp-client/<version>` as the default user agent for streamable HTTP and OAuth requests.
- Preserve user agents supplied through configured HTTP headers.

## Testing

- Verify the default user agent on OAuth discovery, token refresh, and MCP initialization requests.
- Verify that a configured user agent overrides the default.

GitOrigin-RevId: 659ef8f126df97b3c1b4d01e9e542a673b5ef42b
2026-07-23 06:13:12 +00:00
Cam moten
4e0cee8030 Wait for local plugin cache refreshes in plugin/list (#34877)
## What changed

- Make `plugin/list` requests with `forceRefetch: true` wait for configured
  local plugin caches to finish reconciling before building the response.
- Track marketplace plugin sources when deduplicating refreshes so source
  changes can trigger a reinstall even when the plugin version is unchanged.
- Notify effective-plugin consumers when the awaited refresh changes the cache.

## Testing

Added coverage showing that a forced local plugin listing returns an upgraded
plugin from the same marketplace path only after the new version is installed
and the superseded cache entry is removed.

GitOrigin-RevId: c1b59f3be6cc19dac8db39aaea548ddf8e342f1d
2026-07-23 05:38:12 +00:00
Boyang Niu
44d76c6a6d Wake sleeping threads for queued agent mail (#34852)
## Why

An idle thread with an outstanding durable sleep must resume when agent work
arrives, even when that message would normally remain queued without triggering a
turn.

## What changed

- Treat any pending mailbox message as wake-up work while a durable sleep is
  attached to the thread.
- Keep requiring `trigger_turn` for idle threads that are not durably asleep.
- Cover waking a sleeping root thread from queue-only agent mail and persisting
  the message in thread history.

GitOrigin-RevId: e361ac1b104436d4d63aebfe5e2422691a1cc139
2026-07-23 01:04:01 +00:00
stevenlee-oai
b72079a2cf Use batch metadata for plugin app summaries (#34851)
## What changed

- Load app metadata for plugin read and install responses through the authenticated batch API, splitting requests into batches of 100 and retaining cached metadata if a batch fails.
- Preserve every declared app in plugin responses, using its ID as the fallback name and retaining categories from the plugin declaration when metadata is unavailable.
- Add `isEnabled`, `disabledReason`, and `isReadOnly` to `AppToolSummary`, with defaults that keep legacy responses compatible.

## Testing

- Cover plugin reads with more than 100 apps, partial batch failures, install-time authentication results, tool-state propagation, and legacy tool summaries.

GitOrigin-RevId: 14000df9c5c94dde781358e292a8bef741c5dd23
2026-07-23 01:00:35 +00:00
Won Park
0a0a9b6c8f Disable image generation for Free-plan accounts (#34850)
## What changed

Skip registering the standalone `image_generation` tool when cached
authentication identifies the account plan as Free. Leave the existing
feature, provider capability, model modality, and authorization checks intact
for other account plans.

GitOrigin-RevId: 54d3b73dc610e508db7e281c4d7a8e72961e35a6
2026-07-23 00:56:21 +00:00
brisebois-oai
83ff1c2f80 Cache remote plugin catalogs by scope (#34849)
## What changed

- Cache global, user, and workspace remote plugin catalogs on disk with a three-hour TTL and scope- and account-specific keys.
- Serve cached catalogs from `plugin/list`, refresh stale entries in the background, and warm existing caches at app-server startup without blocking list requests.
- Make `forceRefetch: true` bypass cached catalog data and replace an entry only after a successful fetch.
- Invalidate user and workspace catalog caches after remote plugin sharing changes.

## Testing

- Cover cache freshness, scope isolation, legacy global cache compatibility, identity requirements for private catalogs, forced refetches, and non-blocking startup refreshes.

GitOrigin-RevId: 7844e9dfb72e43b26d749b4afd16fd9c1793caba
2026-07-23 00:52:55 +00:00
Won Park
9d82334302 Use Guardian model limits for review sessions (#34847)
## Why

Parent context-window and auto-compaction overrides may describe a different
model than the one selected for Guardian review.

## What changed

- Clear `model_context_window` and `model_auto_compact_token_limit` when the
  effective Guardian model differs from the parent model, allowing the review
  model's own limits to apply.
- Preserve those overrides when Guardian uses the same effective model.

## Testing

Add unit coverage for both model-selection paths and verify that a Guardian
rollout records the selected review model's context window.

GitOrigin-RevId: ebc399f4eba37c7f279fd0d258154c00d45e2d00
2026-07-23 00:04:37 +00:00
sayan-oai
0f9fb40fa9 Allow custom providers to opt into standalone web search (#34846)
## What changed

- Add the `supports_standalone_web_search` model-provider setting, defaulting to `false`, and preserve it in remote thread configuration.
- Enable the standalone `web.run` tool for opted-in custom Responses providers when web search is enabled and the runtime provider supports it.
- Send standalone search requests through the custom provider's endpoint and authentication.

## Testing

- Cover opt-in, default-off, disabled-search, and unsupported-provider behavior.
- Verify custom-provider search request routing and authorization through the app server.

GitOrigin-RevId: 7c5f96b0ce924ad2b9715c45bfc635e89fc39cff
2026-07-23 00:02:15 +00:00
sayan-oai
0da13c6c99 Track multi-agent mode in world state (#34845)
## Why

Multi-agent mode instructions are durable model context and need to survive
history changes without re-emitting unrelated setup hints.

## What changed

- Add a `multi_agent_mode` world-state section that diffs, retains, and restores
  the effective mode instructions.
- Persist mode changes in world-state snapshots while keeping the legacy
  `TurnContextItem.multi_agent_mode` field for reading older rollouts.
- Keep initial mode instructions after the root-agent usage hint so the active
  mode takes precedence, and bound custom mode text before snapshotting it.

## Testing

- Add snapshot coverage for mode transitions, retained history, and custom-text
  truncation.
- Verify live mode changes preserve instruction ordering, avoid duplicating the
  usage hint, and record both modes in world state.

GitOrigin-RevId: 96b9964d6e5299b07a011c559b68e3d948a49226
2026-07-22 23:57:24 +00:00
stevenlee-oai
79500d3cc1 Remove first-party type from app metadata (#34844)
## What changed

Remove `first_party_type` from connector app metadata and the app-server v2
protocol. Update metadata conversion and merge paths, generated JSON and
TypeScript schemas, and affected test fixtures to match.

GitOrigin-RevId: 3f2e56eca68352360d8c0d99d48486ae65d664c1
2026-07-22 23:45:45 +00:00
joeytrasatti-openai
400ee190c3 Add persisted thread pinning to the app server (#34840)
## What changed

- Add `isPinned` to thread responses and allow `thread/metadata/update` to pin or unpin stored threads.
- Add an `isPinned` filter to `thread/list`, including cursor-based pagination and combinations with relationship filters.
- Persist pin state in SQLite without modifying rollout files, default existing threads to unpinned, and preserve pins through reconciliation and archive transitions.

## Testing

- Cover protocol serialization, database migration and indexing, pin updates, filtered pagination, rollout reconciliation, and archive/unarchive behavior.

GitOrigin-RevId: c2eacabd6dae465e2ae6ce8a169e00740960cdb7
2026-07-22 22:54:28 +00:00
Ahmed Ibrahim
d7e8f4c3dc Preserve user input when MCP startup is interrupted (#34839)
## Why

Interrupting a turn while MCP tools were still starting could abort before the
submitted user input was recorded in conversation history.

## What changed

- Build and retain the MCP tool list and tool router as part of each step
  snapshot, using the turn cancellation token during tool discovery.
- Record turn hooks and submitted input when cancellation occurs during startup
  prewarming, pre-sampling compaction, or first-step capture.
- Reuse the captured router for sampling, compaction, and prompt debugging so
  advertised and executable tools share the same request-scoped view.

## Testing

Add coverage that interrupts each affected MCP startup phase and verifies that
the user prompt remains in history before the turn-aborted marker.

GitOrigin-RevId: 6e96c6814357a55545d69b580e28f35933cfadf7
2026-07-22 22:50:13 +00:00
Ben Romano
bd5b55e403 Track compaction time in turn profiles (#34835)
## What changed

- Add `compaction_ms` to turn profile facts and turn analytics events.
- Measure manual and automatic compaction as an exclusive profile phase instead of including it in surrounding idle time.
- Complete the profile and total turn duration from the same instant so their elapsed times remain consistent.

## Testing

- Cover compaction phase accounting and profile-duration consistency.
- Update turn event serialization coverage for `compaction_ms`.

GitOrigin-RevId: 50f0e1cf19789a807f9f56c2ef763c620a5d641c
2026-07-22 22:13:02 +00:00
Ben Romano
88f1cd9664 Flush analytics before in-process app server shutdown (#34831)
## Why

The in-process app server can shut down while analytics for a completed turn are
still queued, preventing the completed-turn and accepted-line events from being
delivered.

## What changed

- Add a bounded analytics queue flush that waits for all preceding facts to be
  processed.
- Flush analytics after the in-process runtime drains its outbound work and
  before acknowledging shutdown.
- Extend the in-process shutdown timeout budgets to cover runtime draining and
  the best-effort analytics flush.

## Testing

- Verify that the flush waits for preceding facts and is a no-op when analytics
  is disabled.
- Verify that shutdown waits for delayed analytics delivery, including the
  completed-turn and accepted-line events produced by a file change.

GitOrigin-RevId: 57ca24e535e5e2f3f3202b2e5498f075676c910a
2026-07-22 21:35:16 +00:00
jif
12c115d558 Reduce cloning when building Responses requests (#34825)
## Why

Preparing Responses API requests rebuilt tool definitions as a generic JSON
tree, and incremental WebSocket requests cloned their full item prefix for
comparison.

## What changed

- Serialize tool definitions into shared raw JSON that can be embedded directly
  in HTTP and WebSocket requests.
- Compare incremental request prefixes in place while still ignoring internal
  message metadata.

## Testing

- Verify raw tool JSON matches the existing value encoding.
- Preserve the serialized WebSocket request payload.

GitOrigin-RevId: 66e2921792c332e8904954dafa597f6d39abcf29
2026-07-22 21:00:01 +00:00
Adam Perry @ OpenAI
bbfc3f0152 Normalize Guardian review cwd reuse keys (#34824)
## What changed

- Store the spawned session's working directory as a `PathUri` in
  `GuardianReviewSessionReuseKey` so reuse comparisons use its canonical URI
  representation.
- Assert that the reuse key contains the converted working directory.

GitOrigin-RevId: 68d440a37ebb310c610dabbb3373ed0ceff88dfa
2026-07-22 20:53:32 +00:00
jay
88eb3a2b8a Enable git attribution across Codex entry points (#34819)
## What changed

- Install the git attribution extension in the app server, MCP server, and `codex debug prompt-input` so authenticated workspace policy controls the commit and pull request attribution instructions sent to the model.
- Resolve attribution settings from the process-level ChatGPT base URL, independent of per-thread or per-tool configuration overrides.
- Treat git attribution as contextual developer content when mapping model events.

## Testing

- Cover policy fetch retries, workspace switches, rollbacks, cold thread resumes with legacy instructions, MCP tool calls, and prompt-debug output.

GitOrigin-RevId: 57d182c432c20d7c1c6c429057b6163c9f32088d
2026-07-22 20:23:35 +00:00
jiayuhuang-openai
4ebd976312 Support configurable realtime BEM channel prefixes (#34816)
## What changed

- Route realtime V3 `bemTags` handoffs using `[ANALYSIS]`, `[COMMENTARY]`, and `[FINAL]` prefixes by default.
- Add `codexResponseHandoffChannelPrefixes` to realtime start requests so clients can replace the accepted prefixes for individual channels. Each channel may accept multiple prefixes, and omitted channels retain their defaults.
- Apply the configured prefixes to both complete and streamed handoff messages, without treating empty prefixes as matches.

## Testing

- Cover request deserialization, default and custom routing, partial streamed prefixes, empty-prefix handling, and end-to-end V3 handoffs.

GitOrigin-RevId: d0aef50aa71362a5beef2c6f6d28b8633da4e529
2026-07-22 19:43:35 +00:00
pakrym-oai
08ae0fc0ce Consolidate thread startup around StartThreadOptions (#34814)
## What changed

- Add `StartThreadOptions::new` to provide the standard configuration for a new thread.
- Make `ThreadManager::start_thread` the single thread-start entry point and migrate callers from the previous convenience methods.
- Derive default environment selections when `environments` is `None`, while preserving explicit selections, including an empty list.

GitOrigin-RevId: 8977dc11aed54c5e1215a81eaed2b2cf5fc6087a
2026-07-22 19:31:54 +00:00
rhan-oai
06782eded7 Fix network access rendering in sandbox prompts (#34811)
## What changed

Use the supported `{{ network_access }}` placeholder syntax in the built-in
`danger-full-access`, `read-only`, and `workspace-write` sandbox templates so
permission instructions render the active network access state.

GitOrigin-RevId: 9f8d851016bd7fbedcfc4a9479236b46aca470e8
2026-07-22 19:14:11 +00:00
Adam Perry @ OpenAI
946ed315a4 Centralize SQLite connection configuration (#34808)
## What changed

- Add `SqliteConfig` to own the resolved SQLite home, runtime database paths,
  and shared read/write and read-only pool settings.
- Pass the configuration through state and local thread-store consumers,
  replacing standalone path helpers and duplicated connection setup.

GitOrigin-RevId: 7351b08da94b5c8b6c0bbe492f86aeeca0699d3c
2026-07-22 18:45:47 +00:00
Adam Perry @ OpenAI
a59a419afa Use path URIs in shell approval keys (#34806)
## What changed

- Store the shell approval key's `cwd` as a `PathUri`, matching the URI representation used by approval actions.
- Extend the approval-key test to verify both the URI-based working directory and environment scoping.

## Testing

- Added `approval_key_uses_path_uri_and_includes_environment_id`.

GitOrigin-RevId: 4d7ba1a2e652f4ffe317242f52beb33513b01e6a
2026-07-22 18:41:11 +00:00