Add default code-mode yield timeout (#14484)

Summary
- expose the default yield timeout through code mode runtime so the
handler, wait tool, and protocol share the same 10s value that matches
unified exec
- document the timeout change in the tool descriptions and propagate the
value all the way into the runner metadata
- adjust Cargo.lock to keep the dependency tree in sync with the added
code mode tool dependency

Testing
- Not run (not requested)
This commit is contained in:
pakrym-oai
2026-03-12 12:06:23 -07:00
committed by GitHub
parent 3e96c867fe
commit d1b03f0d7f
6 changed files with 106 additions and 1 deletions
@@ -48,6 +48,7 @@ impl CodeModeExecuteHandler {
let message = HostToNodeMessage::Start {
request_id: request_id.clone(),
session_id,
default_yield_time_ms: super::DEFAULT_EXEC_YIELD_TIME_MS,
enabled_tools,
stored_values,
source,
+1
View File
@@ -35,6 +35,7 @@ const CODE_MODE_WAIT_DESCRIPTION_TEMPLATE: &str = include_str!("wait_description
pub(crate) const PUBLIC_TOOL_NAME: &str = "exec";
pub(crate) const WAIT_TOOL_NAME: &str = "exec_wait";
pub(crate) const DEFAULT_EXEC_YIELD_TIME_MS: u64 = 10_000;
pub(crate) const DEFAULT_WAIT_YIELD_TIME_MS: u64 = 10_000;
#[derive(Clone)]
@@ -41,6 +41,7 @@ pub(super) enum HostToNodeMessage {
Start {
request_id: String,
session_id: i32,
default_yield_time_ms: u64,
enabled_tools: Vec<EnabledTool>,
stored_values: HashMap<String, JsonValue>,
source: String,
@@ -572,6 +572,7 @@ function startSession(protocol, sessions, start) {
const session = {
completed: false,
content_items: [],
default_yield_time_ms: normalizeYieldTime(start.default_yield_time_ms),
id: start.session_id,
initial_yield_timer: null,
initial_yield_triggered: false,
@@ -585,6 +586,7 @@ function startSession(protocol, sessions, start) {
}),
};
sessions.set(session.id, session);
scheduleInitialYield(protocol, session, session.default_yield_time_ms);
session.worker.on('message', (message) => {
void handleWorkerMessage(protocol, sessions, session, message).catch((error) => {
@@ -697,6 +699,9 @@ async function sendYielded(protocol, session) {
if (session.completed || session.request_id === null) {
return;
}
session.initial_yield_timer = clearTimer(session.initial_yield_timer);
session.initial_yield_triggered = true;
session.poll_yield_timer = clearTimer(session.poll_yield_timer);
const contentItems = takeContentItems(session);
const requestId = session.request_id;
try {