Commit Graph

336 Commits

Author SHA1 Message Date
willwang-openai
fc6268ad38 Read plugin authentication state from AuthManager (#39087)
## What changed

- Give `PluginsManager` a shared `AuthManager` instead of a separately mutable authentication-mode snapshot.
- Read the current authentication mode and credentials from that shared manager for plugin discovery, startup tasks, CLI commands, MCP setup, and external-agent migration.
- Update test helpers and coverage to exercise plugin projections and curated marketplace selection as authentication changes.

GitOrigin-RevId: 600c94de5130eda2da5727e1a0b4d39083fefc56
2026-08-17 22:26:27 +00:00
jif
8ef139667f Apply user MCP policy to selected executor plugins (#39079)
## What changed

- Resolve MCP server policy directly from the effective user configuration for selected executor-plugin roots.
- Apply server enablement, tool allow/deny lists, and default and per-tool approval modes while preserving stricter plugin-declared restrictions.
- Cover policy merging and opaque selected-root IDs in the executor-plugin MCP integration tests.

GitOrigin-RevId: dce3021969ba71e642de52312449cab6277515c3
2026-08-17 20:55:04 +00:00
Andrew Wilkes
682f57254f Persist generated images through turn executors (#39072)
## Why

Image generation did not save its result when the extension host did not provide a host-local save root.

## What changed

- Save generated images under the turn environment's `generated_images` directory through its sandboxed filesystem executor when no host save root is configured.
- Limit executor-written images to 32 MiB, reject symlinked output directories and existing destinations, and continue returning the image if persistence fails.
- Include the saved workspace path in the tool output hint while preserving host-managed persistence when a save root is available.

## Testing

- Extend the granted-turn-permissions integration test to verify the image and path hint are written to the turn workspace without creating a host-local artifact.

GitOrigin-RevId: 3d24381a75fe4595641b5250e19fac8ed473b2cd
2026-08-17 20:32:41 +00:00
felixxia-oai
d24507a59b Remove skill model delegation support (#39068)
## What changed

- Stop parsing and exposing the `model` field from skill frontmatter.
- Remove the skill model delegation types and instruction generation.

GitOrigin-RevId: 01198c68c095da5062e8abec417cc3539099d9d5
2026-08-17 20:19:04 +00:00
Eric Traut
eeb82a156d Dispatch queued messages written by other processes (#39034)
## Why

Durable thread queues can be updated through another SQLite connection, but loaded idle threads need to notice those updates before they can dispatch the new messages.

## What changed

- Track a durable revision for each thread queue, including backfilling existing queues and updating revisions on inserts, updates, and deletes.
- Poll SQLite's data version and query revisions to find changed queues for loaded threads.
- Wake idle threads with pending external messages, discover queued work when threads are loaded or resumed, and retry each thread independently so one blocked queue does not stall others.

## Testing

- Cover cross-runtime queue writes, edits, independent dispatch, wake retries, and resumed threads.
- Cover migration backfills and revision tracking for queue updates and deletes.

GitOrigin-RevId: 906d902bbf6a760be206a1b2c08fd71427b63c46
2026-08-17 17:19:46 +00:00
jif
21cfd369ef Add task context to shadow skill selection (#39008)
## Why

Short continuation prompts such as `continue` do not contain enough context for
skill selection on their own.

## What changed

- Add the `task_context_fusion_v1` shadow selector, combining the current request
  with up to two prior substantive requests and recently relevant skills.
- Record explicit skill intent and successful skill invocations for future turns,
  while excluding same-turn observations from predictions.
- Bound retained requests, augmented queries, and skill history, including safe
  truncation at UTF-8 character boundaries.

## Testing

Add unit and extension tests for continuation prompts, explicit intent, turn
isolation, cold thread state, bounded history, and unchanged control selectors.

GitOrigin-RevId: 72eca3f0d64620a0d24e95d5675f126ac982f8c7
2026-08-17 13:29:57 +00:00
jif
def7ed5572 Wait for Guardian score progress in approval tests (#39007)
## Why

Guardian stores a `SecurityRiskScore` before advancing its scored-tool-call
counter. Waiting only for the score can therefore let the test continue while
the asynchronous sampler is still updating its progress state.

## What changed

Wait for `latest_scored_tool_call` to advance before exercising Guardian v2
approval decisions, and reuse the same progress tracker for the subsequent
assertions.

GitOrigin-RevId: 3d92c9a3ccf52f4f43a2454aac60d2479258c1c8
2026-08-17 13:26:19 +00:00
jif
8e89e98cf6 Ignore stale Guardian tool risk scores (#39001)
## What changed

- Track the latest tool call and latest scored tool call for each Guardian v2 thread.
- Skip approval review when the score lags by more than `max_tool_call_lag` tool calls.
- Add `max_tool_call_lag` to the Guardian v2 configuration and schema, with a default of three.

## Testing

- Cover approval review at, above, and after recovering from the configured lag limit.
- Cover deserialization of `max_tool_call_lag`.

GitOrigin-RevId: fd870e143d95ee76491180e2aed742717248ff78
2026-08-17 13:06:15 +00:00
jif
4885eb6c52 Retry transient Guardian sampling failures (#38997)
## Why

Guardian sampling can encounter temporary connection or service failures while
opening a WebSocket, starting a request, or consuming its response stream.

## What changed

- Retry transient transport, streaming, rate-limit, and server failures up to
  two times across the full sampling flow.
- Recover from unauthorized responses through the configured auth manager and
  discard pooled connections that may contain stale credentials.
- Allow sampler initialization to continue when its initial WebSocket prewarm
  fails, so the first sample can establish a fresh connection.

## Testing

Added coverage for recovery after prewarm failures and `503` responses, and for
stopping once the transient retry budget is exhausted.

GitOrigin-RevId: af74c2df95c4241184ca641ef4418db6aa4ab695
2026-08-17 12:45:50 +00:00
jif
ea10ae7d0f Evaluate recent and character-routed skill selection (#38993)
## What changed

- Add shadow selectors that fuse recently invoked skills with character routing-card matches using reciprocal rank fusion.
- Add a second variant that also incorporates weighted lexical matches.
- Record both variants in the existing shadow-selection experiment, capped at 50 candidates.

## Testing

- Cover cold starts, duplicate removal, short exact matches, deterministic ranking, result limits, and truncation metadata.
- Extend the skills integration test to verify both selectors recover a skill invoked on an earlier turn.

GitOrigin-RevId: 4ff9e91da8cb49ecbce54ab8e760820616e1a1d3
2026-08-17 12:13:20 +00:00
felixxia-oai
8bf50439f2 Source Guardian v2 defaults from the model catalog (#38990)
## What changed

- Add optional `guardian_v2` model-message defaults for classifier instructions,
  review thresholds, reasoning effort, transcript selection and limits, and
  action and compaction token limits.
- Apply those defaults when Guardian v2 samples a tool call, while preserving
  explicit `[features.guardianv2]` settings over catalog values.
- Preserve the new catalog configuration when applying model overrides.

## Testing

- Cover model-catalog serialization and model override behavior.
- Verify that sampling uses catalog defaults while retaining local overrides.

GitOrigin-RevId: 4ae9ec235c647acbca05a20b7c4b87a4e1331161
2026-08-17 11:44:56 +00:00
jif
37cf6c84c0 Include images in Guardian v2 transcripts (#38987)
## What changed

- Add the `features.guardianv2.transcript.include_images` opt-in setting.
- Include recent images from user and assistant messages and configured tool outputs in Guardian v2 sampling requests.
- Bound image context to the four most recent images and 8 MiB total, and omit image detail hints when constructing the sampling request.

## Testing

- Cover configuration parsing and image forwarding from messages and tool outputs.

GitOrigin-RevId: b0ae6b6182535fd084ea103ed01dc3c803d7d1f7
2026-08-17 10:56:13 +00:00
felixxia-oai
53aa7bb1aa Bound Guardian v2 parent compaction context (#38980)
## What changed

- Add `max_parent_compaction_tokens`, defaulting to 25,000 tokens, to the Guardian v2 feature configuration.
- Reuse the latest encrypted parent compaction only when its complete serialized item fits within the configured limit.
- Fail closed with the maximum action-risk score when the latest encrypted compaction is oversized, instead of sampling with older context.

## Testing

- Cover exact-boundary and oversized compaction items, including oversized passthrough metadata.
- Verify that an oversized latest compaction bypasses sampling and prevents approval.

GitOrigin-RevId: 0b308e7bec0f41d46433dfdf656948cee5cba667
2026-08-17 10:18:24 +00:00
jif
632e35ce8d Add a configurable skill catalog token budget (#38978)
## What changed

- Add `[skills].max_context_tokens` to override the token budget used to render the available-skills catalog.
- Require a positive value and cap configured budgets at 10,000 tokens.
- Preserve the existing default of 2% of the model context window when the option is unset.

## Testing

- Cover configuration parsing, override behavior, the 10,000-token cap, and catalog rendering within the configured budget.

GitOrigin-RevId: f29ddcb57fc2d800c0006d03e1c33cbe3ab6272d
2026-08-17 10:01:59 +00:00
felixxia-oai
baab1705c6 Make Guardian v2 risk classification configurable (#38628)
## What changed

- Allow `features.guardianv2` to remain a boolean toggle or specify classifier instructions, the review threshold, reasoning effort, and action and instruction token limits.
- Add transcript controls for included sources, per-entry and total token budgets, and the number of recent non-user entries.
- Validate configured ranges and relationships, expose them in the generated config schema, and apply the resolved settings throughout Guardian v2 classification and approval review.

## Testing

- Cover boolean compatibility, configuration parsing and boundaries, config-manager rejection, and the resulting classifier request and approval decision.

GitOrigin-RevId: dc018b53b782e2d6b4d6a795cca4945130a71678
2026-08-14 19:11:41 +00:00
felixxia-oai
14a6813fa8 Apply Guardian policies to v2 risk classification (#38618)
## What changed

- Include the resolved Guardian security policy in the v2 classifier's developer instructions.
- Prefer an explicit `guardian_policy_config`, then the reviewer model's catalog policy, and finally the bundled policy.
- Limit the combined classifier instructions and policy to 10,000 tokens.

## Testing

- Cover configured and catalog policies, policy truncation, and the bundled-policy fallback.

GitOrigin-RevId: 1b84d70081dd924e214636b4b470d57a63d7cb88
2026-08-14 18:21:22 +00:00
jif
f535950eaa Skip stale Guardian risk score persistence (#38612)
## Why

Concurrent Guardian samples can finish out of order. A stale result rejected by
the thread's latest-score update could still be appended to the rollout.

## What changed

Return without persisting a risk score when `insert_if` rejects it as older than
the score already stored on the thread.

GitOrigin-RevId: 7b2c895742753a19dfe48fd7f8ecd912d3cd3af6
2026-08-14 17:41:34 +00:00
jif
742edd6c16 Prioritize new Guardian classifications under load (#38596)
## What changed

- Expand the Guardian sampling pool from 8 to 16 WebSocket connections.
- When the pool is full, supersede the oldest request that has already produced a score before replacing an unfinished classification. Treat superseded classifications as a no-op in the extension.
- Stop response WebSocket work when its event consumer is dropped, including while waiting for the connection lock or draining a completed sample.
- Allow retries across both initially warmed connections for retryable stream failures.

## Testing

- Add a concurrent sampler test that fills the pool and verifies scored drains are replaced before an unfinished classification.

GitOrigin-RevId: 9e4df7b01516094726ff3e11878f8ca742d21b03
2026-08-14 15:55:01 +00:00
jif
23094236ac Let extensions resolve approval reviews before Guardian (#38592)
## What changed

- Give approval review contributors the first opportunity to resolve an action when automatic review is not required for the model.
- Return an extension's decision directly and fall back to Guardian when no extension claims the review.
- Update Guardian V2 to approve actions below its risk threshold through the review contributor API, and remove the extension approval-policy API.

## Testing

- Verify that an extension approval bypasses both the Guardian model call and the user approval prompt.
- Cover Guardian V2 review decisions for low-risk, high-risk, and disabled threads.

GitOrigin-RevId: 5be56941143aff6f358b75b5f8101b7c047147ae
2026-08-14 15:24:10 +00:00
felixxia-oai
5bc8da6d78 Bound Guardian V2 tool actions before risk classification (#38586)
## Why

Oversized tool arguments could make Guardian V2's model-visible action unbounded.

## What changed

- Cap serialized actions at 10,000 tokens while preserving the trusted tool name and `call_id`.
- Truncate nested string values evenly across the available budget.
- Omit lower-priority fields when the JSON structure alone exceeds the limit, while retaining useful action fields when they fit.

## Testing

Add coverage for oversized nested strings, arrays, and object keys, including spoofed identity fields and omission-marker collisions.

GitOrigin-RevId: 13f7dc93da3761db18a34087225196318a3b8098
2026-08-14 14:33:39 +00:00
jif
2a452d7dc1 Keep the latest Guardian risk score during concurrent sampling (#38580)
## Why

Concurrent Guardian samples can finish out of order, allowing an older sample to
replace the thread's newer in-memory security risk score.

## What changed

- Record when each `SecurityRiskScore` sample starts while preserving compatibility
  with records that have no timestamp.
- Add `ExtensionData::insert_if` so checking and replacing a typed attachment happen
  under the same lock.
- Update Guardian V2 to replace the thread's risk score only when the completed sample
  is newer than the stored one.

## Testing

- Verify concurrent conditional inserts retain the newest value.
- Verify Guardian-generated risk scores include a sampling timestamp.

GitOrigin-RevId: 6543a4e5497da4c623331050789e91613f931c4b
2026-08-14 13:44:51 +00:00
jif
1c4f42863c Require automatic review for high-risk Guardian v2 actions (#38569)
## What changed

- Add a thread-scoped extension API for requesting automatic review, resolving
  multiple contributors to the strongest requirement.
- Have Guardian v2 request automatic review when it is enabled and the latest
  `action_risk` score is at least `0.8`.
- Honor extension review requirements across tool approvals, MCP elicitation,
  and remote execution while preserving host configuration and managed-policy
  constraints.

## Testing

- Cover contributor registration and requirement resolution.
- Verify Guardian v2 requests review at the threshold, returns to the default
  below it, and does not affect threads where the extension is disabled.
- Exercise extension-requested strict review with a remote model override.

GitOrigin-RevId: 6329fc23585d5cc7173c39bb9952c3109ec3884b
2026-08-14 12:37:13 +00:00
felixxia-oai
d40dfcc3c7 Run tool start callbacks after pre-tool hooks (#38568)
## What changed

- Invoke `ToolLifecycleContributor::on_tool_start` only after pre-tool hooks
  have finalized the invocation.
- Pass hook-rewritten arguments and the post-hook conversation snapshot to the
  callback.
- Skip the start callback when a hook denies execution or supplies input that
  cannot be applied.

## Testing

Add lifecycle tests covering rewritten input, hook-added context, denied tool
calls, and invalid rewritten input.

GitOrigin-RevId: 936efaf4a8c35321f9982ff2a33bb8bece1ebf39
2026-08-14 12:21:08 +00:00
jif
aa905bb962 Store security risk scores as a snapshot (#38567)
## What changed

- Replace the single `category` and `score` fields in `SecurityRiskScore` with a
  deterministic map of category names to scores.
- Validate the full Guardian V2 classifier response before storing it as one
  thread extension value and, for non-ephemeral threads, one rollout item.
- Cover serialization and rollout loading with snapshots containing multiple
  score categories.

GitOrigin-RevId: 24525de691f96bd34ccfe04acab2f01aca309837
2026-08-14 12:16:51 +00:00
felixxia-oai
08c48e3700 Reuse compatible parent compactions in Guardian V2 (#38564)
## Why

Guardian V2 classification requests should retain compacted conversation context only when the parent and classifier model configurations can share the encrypted compaction.

## What changed

- Resolve the classifier model's compaction compatibility hash when initializing its sampler.
- Add the latest encrypted parent compaction to classification input when both models have the same non-empty compatibility hash.
- Ignore missing, empty, or unidentified compactions, and omit parent context when compatibility cannot be established.

## Testing

- Cover latest-compaction selection and invalid compaction data.
- Cover matching, mismatched, missing, empty, and changed compatibility hashes.

GitOrigin-RevId: f0fcb09fd028cd2f397fdbc3d541b4bc464b0beb
2026-08-14 11:55:10 +00:00
felixxia-oai
486df09a00 Improve Guardian transcript context selection (#38558)
## What changed

- Replace the single byte limit with token-derived per-entry and separate message and tool transcript budgets.
- Preserve the first and latest user messages, then fill the remaining budgets with recent user, assistant, and tool context while limiting retained non-user entries.
- Truncate oversized entries in the middle without splitting UTF-8 characters, and report the approximate omitted token count.
- Exclude reasoning from the default transcript sources while retaining support when it is explicitly configured.

## Testing

- Cover oversized message and tool-result truncation, user-message retention, separate tool budgeting, configured reasoning, and the resulting Guardian sampling request.

GitOrigin-RevId: aaeaa5fb5d902b5a1581a8a819bf34724bde794b
2026-08-14 11:17:50 +00:00
felixxia-oai
db5b4a4cfb Preserve Guardian transcript boundaries in sampling input (#38555)
## What changed

- Represent Guardian sampling input as an ordered list of text entries.
- Send each transcript entry and approval-request delimiter as a separate input
  content item while preserving the existing transcript byte limit.

## Testing

- Update transcript and sampler tests to verify entry boundaries, multi-item
  request serialization, and bounded transcript behavior.

GitOrigin-RevId: 433e2e6ca18ce9288025715f5956295bfe852e98
2026-08-14 11:02:01 +00:00
jif
a44f266a4a Initialize Guardian V2 samplers per thread (#38553)
## What changed

- Register Guardian V2 for thread startup as well as tool-call lifecycle events.
- When `guardianv2` is enabled, create and store a thread-local Luna sampler using the thread's model provider, authentication policy, session metadata, originator, and service tier.
- Emit a warning if sampler initialization fails, and skip tool classification when the thread has no sampler.

## Testing

- Update the extension test to enable `guardianv2`, run thread startup, and verify tool-call sampling through the initialized connection.

GitOrigin-RevId: 5ab732e85c9827495c67f57117eb5be450a7f90e
2026-08-14 10:58:56 +00:00
jif
8630bb3cae Record Guardian V2 risk scores on threads (#38540)
## What changed

- Parse and validate the structured risk scores returned for each classified tool call.
- Publish each score through thread extension data and persist it in rollout history for non-ephemeral threads.
- Report parsing, thread lookup, validation, and persistence failures through the extension warning sink.

## Testing

- Extend the Guardian V2 tool-classification test to verify that the sampled `action_risk` score is available from thread extension data and written to rollout history.

GitOrigin-RevId: 46614fe0d686736dfb1f09398c6fcd848c7d8b2c
2026-08-14 09:27:41 +00:00
Dylan Hurd
4eff3b788b Configure Guardian sampling for responses lite (#38527)
## What changed

- Opt Guardian V2 Luna sampler WebSocket connections into responses lite.
- Send `reasoning.context` as `all_turns` on sampling requests.

## Testing

- Extend sampler and extension tests to verify the connection header and reasoning context.

GitOrigin-RevId: 4b0263c01b8259ed5268c222dcf7559912baba8c
2026-08-14 08:16:23 +00:00
sayan-oai
fdbab67c66 Carry environment config in turn selections (#38521)
## What changed

- Add `EnvironmentConfigState` to `TurnEnvironmentSelection` so each environment attachment can inherit thread configuration or carry ready configuration for its login-shell policy and selected capability roots.
- Apply ready configuration during thread creation and thread-settings updates while reusing the existing environment connection.
- Validate selection configuration before applying settings, rejecting unsupported pending state and invalid capability roots.

## Testing

- Cover attachment-scoped capability roots, ready configuration at thread startup and turn updates, and rejection of invalid selections without changing existing settings.

GitOrigin-RevId: 86cf8f2148fdaa746ea0dd12890ab7b1577d7587
2026-08-14 07:52:38 +00:00
felixxia-oai
3711943d11 Parse model annotations from skill frontmatter (#38467)
## What changed

- Add an optional `model` field to parsed and loaded skill metadata.
- Recognize `model: luna` while ignoring unsupported model values without
  preventing the rest of the skill metadata from loading.

## Testing

- Cover supported, absent, unsupported, and repaired frontmatter model values.

GitOrigin-RevId: 376b65555e81d29a5eae93cc4c2633aacf7cd7c8
2026-08-14 00:54:45 +00:00
efrazer-oai
9341b38310 Add experimental thread queue APIs to app server (#38456)
## What changed

- Add experimental `thread/queue/add`, `list`, `update`, `delete`, `reorder`, and `start` requests for persistent queued user submissions.
- Automatically dispatch queued submissions in FIFO order after completed or failed turns, while leaving the queue paused after interruption.
- Emit `thread/queue/changed` notifications and expose paginated queue contents with stable submission and client message IDs.
- Export the new protocol types through the generated JSON Schema and TypeScript bindings.

## Testing

- Add app-server integration coverage for capability gating, CRUD, pagination, capacity limits, notifications, automatic dispatch, cold-thread resume, interruption, and explicit queue starts.

GitOrigin-RevId: 89caf5577192199bda77cf6c372a59d26cdd910e
2026-08-13 23:38:02 +00:00
willwang-openai
1da59ad257 Support per-server MCP OAuth callback ports (#38448)
## What changed

- Add `oauth.callback_port` to MCP server configuration and preserve it when
  serializing configuration edits.
- Accept `oauth.callbackPort` from plugin MCP declarations and skill dependency
  metadata.
- Prefer the server-specific callback port over `mcp_oauth_callback_port` for
  CLI login, app-server, plugin installation, executor, and skill dependency
  OAuth flows.

## Testing

- Cover configuration parsing, serialization, and fallback behavior.
- Verify plugin, executor, and skill OAuth registrations use their configured
  callback ports instead of the global port.

GitOrigin-RevId: 7f65e5e7869358307e49779f1b75e8672b607736
2026-08-13 22:42:12 +00:00
felixxia-oai
53eaa297e5 Give Guardian V2 full tool action context (#38441)
## Why

Guardian V2 needs the requested action and its conversation context to assess
risk; a tool name and call ID alone do not describe what the tool will do.

## What changed

- Expose the original, pre-hook `ToolPayload` to tool lifecycle contributors.
- Build Guardian V2 classifier input from the bounded conversation transcript
  and a structured planned-action object containing the tool name and arguments.
- Warn and skip classification if the planned action cannot be serialized.

## Testing

- Verify lifecycle contributors receive tool arguments.
- Verify Guardian V2 sends transcript history and planned-action JSON to the
  classifier.

GitOrigin-RevId: 28266ef7c1d2267ba705fcfbd9be4ef48e64e104
2026-08-13 21:49:32 +00:00
willwang-openai
f898ebcafd Route curated plugin catalogs by authentication mode (#38429)
## Why

The model provider does not reliably identify which curated plugin catalog is
available. ChatGPT authentication can be used with a custom provider, while an
unauthenticated session should use the API-compatible catalog regardless of its
provider.

## What changed

- Select the ChatGPT curated catalog only for authentication modes that use the
  Codex backend; use the API curated catalog for API-key and unauthenticated
  sessions.
- Initialize standalone plugin managers with the current authentication mode
  across CLI, app-server, MCP, and external-agent migration paths.
- Preserve authentication mode while detecting and importing migrated plugins.

## Testing

- Cover catalog and skill routing across ChatGPT, API-key, unauthenticated,
  Bedrock, and custom-provider configurations.
- Verify authenticated plugin migration uses the ChatGPT curated marketplace.

GitOrigin-RevId: 660a339ee8891c33aad961078d3a979242a6a166
2026-08-13 20:20:01 +00:00
hesham-oai
588e18aae5 Recover capability discovery after executor disconnects (#38420)
## Why

Transient executor disconnects could leave capability discovery and skill catalogs
stuck on a cached failure for the rest of a thread, even after the executor
reconnected.

## What changed

- Replay capability discovery after executor recovery and retry transient failures
  on later requests while continuing to cache permanent failures.
- Avoid caching skill catalogs produced from failed discovery so a later step can
  load the recovered catalog.
- Mark the MCP runtime dirty when recovered manifests change the projected MCP
  servers, and allow discovery to be cancelled with the turn.

## Testing

- Cover same-request recovery after a disconnect and recovery on a later request.
- Cover retry classification through connection-attempt errors and skill catalog
  caching after discovery recovers.

GitOrigin-RevId: a57f90844351e73ea831931f72a9ddc4e4f3335c
2026-08-13 19:14:30 +00:00
jay
9946da9af1 Apply Codex attribution to app-created commits (#38419)
## What changed

Clarify that commits created through a GitHub app or plugin must include the
Codex co-author trailer in the tool's `message` argument. This covers commits
that create, update, or delete files.

GitOrigin-RevId: 58be9302da9f8d4f11aa100c32f779fac9cc05e9
2026-08-13 18:50:43 +00:00
felixxia-oai
73862481e5 Add bounded transcript rendering for Guardian v2 (#38414)
## What changed

- Add a configurable renderer that converts conversation messages, agent
  messages, tool calls and outputs, and reasoning into a numbered plaintext
  transcript.
- Keep only relevant readable content, including manual-approval developer
  messages, while omitting media payloads, encrypted content, and unsupported
  response items.
- Limit transcripts to the most recent 320 KiB without splitting UTF-8
  characters.

## Testing

- Cover source selection, content filtering, tool-name correlation, and bounded
  UTF-8 truncation with unit tests.

GitOrigin-RevId: e2c6535f4a895862ca744258399fb36fc92e42c6
2026-08-13 18:17:03 +00:00
jif
d167a3604c Classify tool calls in the Guardian V2 extension (#38409)
## What changed

- Register a tool lifecycle contributor when Guardian V2 is installed.
- On tool start, asynchronously ask the existing Luna sampler for a low-effort
  `action_risk` score constrained to the range from `0.0` to `1.0`.
- Bound the tool metadata supplied to the classifier and treat it as untrusted
  input.
- Emit an extension warning if classification sampling fails.

## Testing

Add an integration test that verifies the contributor reuses the configured
Luna pool and sends the expected model, attribution metadata, reasoning effort,
strict output schema, and tool-call context.

GitOrigin-RevId: 6b69fcc0443086544086849c38bcdd90560a291f
2026-08-13 17:32:10 +00:00
jif
66919805ea Pool Guardian sampling WebSocket connections (#38406)
## What changed

- Prewarm two Responses WebSocket connections and grow the pool on demand, up to eight connections, so overlapping samples can run concurrently.
- Lease each connection to a single sample and return healthy connections to the idle pool after completion.
- Replace closed or 55-minute-old connections and retry a sample once after a retryable or stream error.
- Keep the sampler available when the second prewarm connection cannot be opened.

## Testing

- Cover connection reuse, partial prewarm success, concurrent pool growth, and retrying an expired connection on another warm connection.

GitOrigin-RevId: 3ee7b05adc00a2135ba7cb35f6e4455199bf3784
2026-08-13 17:00:59 +00:00
felixxia-oai
a70211249a Expose conversation history to tool lifecycle extensions (#38403)
## What changed

- Add a shared, read-only `ConversationHistorySnapshot` capability to the extension API.
- Include the snapshot in `ToolStartInput`, preserving conversation order while excluding contextual user messages.
- Avoid acquiring a history snapshot when no tool lifecycle contributors are registered.

## Testing

- Verify snapshots share existing response items, remain stable as history changes, and filter contextual user messages.
- Verify tool-start callbacks receive the history available for successive tool calls.

GitOrigin-RevId: 822cae33781dd876ea628f104be08d8a449a4900
2026-08-13 16:43:23 +00:00
jif
911012490c Return Luna samples when streamed JSON completes (#38383)
## Why

Structured output can be complete before the Responses stream emits its terminal
events. Waiting for those events unnecessarily delays the sampler and can leave it
waiting after usable output has arrived.

## What changed

- Return a Luna sample as soon as accumulated text deltas parse as a complete JSON
  object.
- Continue draining the remaining response events in the background so the
  authenticated WebSocket stays reusable for subsequent samples.
- Enforce the output-size limit while accumulating deltas on the early-return path.

## Testing

- Cover returning complete JSON without terminal response events.
- Verify that early return still allows the authenticated WebSocket to be reused.

GitOrigin-RevId: 80c9963f1540f7862356aaad3503e3071a8fb92a
2026-08-13 14:20:38 +00:00
jif
a7b8c074b5 Add the Guardian V2 Luna sampler (#38368)
## What changed

- Add a `LunaSampler` that opens an authenticated Responses WebSocket and reuses it for structured, tool-free `gpt-5.6-luna` requests.
- Carry the host's provider, authentication, proxy, attribution, and service-tier configuration into the connection and requests.
- Require strict JSON schemas, preserve per-request reasoning effort and turn metadata, and reject missing or oversized output.

## Testing

- Add a WebSocket test covering authentication and attribution headers, connection reuse, structured request fields, per-turn metadata, reasoning effort, and returned output.

GitOrigin-RevId: aef85fd8ddcfcb7c76a9ede0d3191e3a0321656b
2026-08-13 12:35:56 +00:00
jif
72fa74fbc9 Persist security risk scores in rollout history (#38363)
## What changed

- Add a `SecurityRiskScore` rollout item containing a category and numeric score.
- Persist the item in both thread history modes while excluding it from model context, user-visible thread history, search text, forks, and reconstructed conversation history.
- Re-export the score type from the extension API.

## Testing

- Cover serialization, persistence and loading, thread history projection, session reconstruction, append planning, and memory filtering.

GitOrigin-RevId: 1926fe366aeaa75052708a6da589f45a38eefb52
2026-08-13 12:04:29 +00:00
jif
4ca1af77a5 Test hook rejection for explicitly started queue items (#38361)
## What changed

- Add dedicated coverage for explicitly starting a queued item that a prompt hook rejects.
- Verify the rejected item is consumed and no model request is sent.
- Keep the automatic queue dispatch test focused on consuming a rejected item while allowing later queued input to proceed.

GitOrigin-RevId: e01cefb9d8581b0d4be05d4595f279d61e628e83
2026-08-13 11:55:10 +00:00
jif
fe614a6304 Add Guardian V2 extension scaffold (#38336)
## What changed

- Add the `codex-guardian-v2` crate with an extension install entry point that does not register contributors yet.
- Register the crate in the Cargo workspace and add its Bazel target.

GitOrigin-RevId: 7c0c9479c6722d65f0f0dad9b0fd4a756e4649b3
2026-08-13 09:00:23 +00:00
Owen Lin
cbb7e82a8b Unify turn input submission and routing (#38275)
## What changed

- Add `TurnInputRequest` and typed submission results for atomically starting a turn, steering the active turn, or declining input with a specific reason.
- Expose `start_or_steer_turn`, `start_turn_if_idle`, and `steer_turn` on `CodexThread`, and migrate Core consumers to these APIs.
- Make app-server `turn/start` steer an active regular turn and return that turn's ID. Reject incompatible output schemas and non-steerable turns without applying settings or enqueueing input.

## Testing

- Cover concurrent start-or-steer submissions, accepted and rejected settings updates, output-schema compatibility, idle-start rejection, and app-server steering.

GitOrigin-RevId: dd9b5528d76ec650c019e97af420bc13190ea86a
2026-08-13 00:00:16 +00:00
jif
5664a5c07c Expose executor skill roots from skills.read (#38268)
## Why

Executor-backed skills can include bundled scripts, so skill readers need the
skill directory in the executor filesystem to locate them.

## What changed

- Add `skill_root` to `skills.read` responses for executor-backed skills.
- Derive the root from the parent directory of the skill's main resource and
  omit the field for other skill authorities.

## Testing

- Verify executor skill reads return the expected root for both `SKILL.md` and
  a referenced resource.

GitOrigin-RevId: b7035c7e2e62155890795fb508fefe3a1c17805b
2026-08-12 22:54:35 +00:00
jif
130c7c93a9 Resolve skill package aliases in skills.read (#38261)
## Why

Skill catalogs can present shortened package locators, but callers previously had
to expand those aliases before reading a skill.

## What changed

- Resolve catalog aliases automatically when `skills.read` looks up a
  model-visible executor or orchestrator skill package.
- Update skill prompts and tool documentation to tell models to pass the listed
  package locator directly.

## Testing

- Exercise reading an executor skill through its shortened package locator when
  the skills catalog exceeds its context budget.

GitOrigin-RevId: d1cdfd64002510b616146929deb5b7077850b951
2026-08-12 22:10:55 +00:00