Apply model catalog overrides to history, notes, and context tools (#56313)

## What changed

- Read optional tool descriptions and parameter schemas for `history`, `notes`, `new_context`, and `get_context_remaining` from the acting model's catalog messages.
- Support catalog namespace descriptions for history and notes, preserving explicit empty and whitespace descriptions.
- Share catalog override handling across native tools and MCP resource helpers. Keep bundled schemas when overrides are invalid, preserve encrypted parameters, and leave tool identity and transport fields unchanged.

## Testing

Add coverage for sparse catalog serialization, schema fallback and encryption preservation, per-step tool definitions, and context tool updates when switching models. Extend outgoing-request tests to verify history and notes overrides while retaining history image attachments.

GitOrigin-RevId: 1adac8b5009f95c91adba491f20a4e2e2dc91475
This commit is contained in:
rhan-oai
2026-10-23 00:46:28 +00:00
committed by copyberry
parent 5b792948f9
commit e103bbc06f
35 changed files with 822 additions and 114 deletions
+8
View File
@@ -104,6 +104,7 @@ use codex_otel::auth_storage::AuthStorageOriginator;
use codex_otel::current_span_trace_id;
use codex_otel::current_span_w3c_trace_context;
use codex_otel::set_parent_from_w3c_trace_context;
use codex_prompts::ResolvedModelMessages;
use codex_prompts::render_model_instructions;
use codex_protocol::ResponseUsageMetadata;
use codex_protocol::SessionId;
@@ -4064,6 +4065,13 @@ impl Session {
{
extension_data.insert(messages.clone());
}
let model_messages = ResolvedModelMessages::from_model(&settings.model_info);
if let Some(messages) = model_messages.history() {
extension_data.insert(messages.clone());
}
if let Some(messages) = model_messages.notes() {
extension_data.insert(messages.clone());
}
let (mcp, prepared_recommendations) = tokio::join!(
// MCP refresh can be large; keep it off the sampling request's stack.
Box::pin(self.mcp_runtime_for_step(