mirror of
https://github.com/openai/codex.git
synced 2026-11-03 08:22:30 +00:00
feat: add configurable write_stdin timeout (#12228)
Add max timeout as config for `write_stdin`. This is only used for empty `write_stdin`. Also increased the default value from 30s to 5mins.
This commit is contained in:
1 parent
f595e11723
commit
547f462385
5 files changed
+53
-9
No files matched your search
@@ -54,6 +54,7 @@ pub(crate) const MIN_YIELD_TIME_MS: u64 = 250;
|
||||
// Minimum yield time for an empty `write_stdin`.
|
||||
pub(crate) const MIN_EMPTY_YIELD_TIME_MS: u64 = 5_000;
|
||||
pub(crate) const MAX_YIELD_TIME_MS: u64 = 30_000;
|
||||
pub(crate) const DEFAULT_MAX_BACKGROUND_TERMINAL_TIMEOUT_MS: u64 = 300_000;
|
||||
pub(crate) const DEFAULT_MAX_OUTPUT_TOKENS: usize = 10_000;
|
||||
pub(crate) const UNIFIED_EXEC_OUTPUT_MAX_BYTES: usize = 1024 * 1024; // 1 MiB
|
||||
pub(crate) const UNIFIED_EXEC_OUTPUT_MAX_TOKENS: usize = UNIFIED_EXEC_OUTPUT_MAX_BYTES / 4;
|
||||
@@ -129,13 +130,22 @@ impl ProcessStore {
|
||||
|
||||
pub(crate) struct UnifiedExecProcessManager {
|
||||
process_store: Mutex<ProcessStore>,
|
||||
max_write_stdin_yield_time_ms: u64,
|
||||
}
|
||||
|
||||
impl UnifiedExecProcessManager {
|
||||
pub(crate) fn new(max_write_stdin_yield_time_ms: u64) -> Self {
|
||||
Self {
|
||||
process_store: Mutex::new(ProcessStore::default()),
|
||||
max_write_stdin_yield_time_ms: max_write_stdin_yield_time_ms
|
||||
.max(MIN_EMPTY_YIELD_TIME_MS),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for UnifiedExecProcessManager {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
process_store: Mutex::new(ProcessStore::default()),
|
||||
}
|
||||
Self::new(DEFAULT_MAX_BACKGROUND_TERMINAL_TIMEOUT_MS)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user