Add turn trigger metadata (#40665)

## What changed

- Add an optional `turnTrigger` field to app-server `turn/start` requests and
  expose it in the generated protocol schemas.
- Propagate non-empty trigger values to Responses request metadata as the
  reserved `turn_trigger` field, while preserving the original value when a
  request steers an active turn.
- Classify turns started by queue dispatch, goal continuation, retry recovery,
  and realtime handoff.

## Testing

- Cover HTTP and WebSocket metadata forwarding, steering behavior, reserved
  metadata handling, and the built-in trigger classifications.

GitOrigin-RevId: c12fe2c522286db21b76081ae6154fbf6bfb3639
This commit is contained in:
pakrym-oai authored and copyberry committed 2026-08-25 18:11:04 +00:00
1 parent ba9567daf3
commit 538900ee76
29 files changed
+189 -11

No files matched your search

+7 -1
View File
@@ -7,6 +7,7 @@ use codex_core::StartIfIdleSubmission;
use codex_core::ThreadManager;
use codex_core::TurnInput;
use codex_core::TurnInputRequest;
use codex_core::TurnStartOptions;
use codex_protocol::ThreadId;
use codex_protocol::models::ResponseItem;
use codex_protocol::protocol::ThreadGoal;
@@ -406,7 +407,12 @@ impl GoalRuntimeHandle {
let item = continuation_steering_item(&protocol_goal_from_state(goal));
match thread
.start_turn_if_idle(TurnInputRequest::new(TurnInput::ResponseItem(item)))
.start_turn_if_idle(
TurnInputRequest::new(TurnInput::ResponseItem(item)).on_start(TurnStartOptions {
turn_trigger: Some("goal".to_string()),
..Default::default()
}),
)
.await
{
Ok(StartIfIdleSubmission::Started { .. }) => {}