mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
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:
@@ -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,
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user