Source async user message descriptions from the model catalog (#41461)

## What changed

- Add model message metadata for built-in tool descriptions.
- Use the active step model's catalog description for `send_user_message_async`, including after a mid-turn model change.
- Fall back to the built-in description when catalog metadata is absent, while preserving an explicitly empty description.

## Testing

- Cover catalog serialization, fallback and empty-value behavior, and model changes within a turn.

GitOrigin-RevId: 72b953214ab9708931065321debf12133f8d2d40
This commit is contained in:
rhan-oai authored and copyberry committed 2026-08-29 03:44:01 +00:00
1 parent 03861e69ef
commit 3c062df036
18 files changed
+298 -20

No files matched your search

+3 -2
View File
@@ -3467,13 +3467,14 @@ impl Session {
});
extension_data.insert(selected_plugins.clone());
turn_context.extension_data.insert(selected_plugins);
// Tool planning still uses the admitted turn. Migrating it to the
// captured model is a separate step from diagnostic activation.
// Tool availability still follows the admitted turn; the async message
// description comes from the captured step model.
let tool_router = turn::built_tools(
self.as_ref(),
turn_context.as_ref(),
// TODO(CDXENT-441): use the step scoped model
turn_context.model_info(),
settings.model_info.model_messages.as_ref(),
&environments,
&mcp,
&extension_data,
+4
View File
@@ -92,6 +92,7 @@ use codex_protocol::models::BaseInstructions;
use codex_protocol::models::ContentItem;
use codex_protocol::models::MessagePhase;
use codex_protocol::models::ResponseItem;
use codex_protocol::openai_models::ModelMessages;
use codex_protocol::protocol::AgentMessageContentDeltaEvent;
use codex_protocol::protocol::AgentReasoningSectionBreakEvent;
use codex_protocol::protocol::CodexErrorInfo;
@@ -1504,6 +1505,7 @@ pub(crate) async fn prepare_tool_recommendations(
}
}
#[allow(clippy::too_many_arguments)]
#[instrument(level = "trace",
skip_all,
fields(
@@ -1516,6 +1518,7 @@ pub(crate) async fn built_tools(
sess: &Session,
turn_context: &TurnContext,
model_info: &codex_protocol::openai_models::ModelInfo,
model_messages: Option<&ModelMessages>,
environments: &TurnEnvironmentSnapshot,
mcp: &Arc<codex_mcp::McpBinding>,
step_store: &ExtensionData,
@@ -1585,6 +1588,7 @@ pub(crate) async fn built_tools(
sess,
turn_context,
model_info,
model_messages,
environments,
mcp,
apps_enabled,