mirror of
https://github.com/pchuan98/codex.git
synced 2026-07-01 00:31:56 +08:00
chore: clamp min yield time for empty write_stdin (#9156)
After evals, 0 impact on performance
This commit is contained in:
committed by
GitHub
Unverified
parent
bdae0035ec
commit
32b1795ff4
@@ -45,6 +45,8 @@ pub(crate) use errors::UnifiedExecError;
|
||||
pub(crate) use process::UnifiedExecProcess;
|
||||
|
||||
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_OUTPUT_TOKENS: usize = 10_000;
|
||||
pub(crate) const UNIFIED_EXEC_OUTPUT_MAX_BYTES: usize = 1024 * 1024; // 1 MiB
|
||||
|
||||
@@ -26,6 +26,8 @@ use crate::truncate::approx_token_count;
|
||||
use crate::truncate::formatted_truncate_text;
|
||||
use crate::unified_exec::ExecCommandRequest;
|
||||
use crate::unified_exec::MAX_UNIFIED_EXEC_PROCESSES;
|
||||
use crate::unified_exec::MAX_YIELD_TIME_MS;
|
||||
use crate::unified_exec::MIN_EMPTY_YIELD_TIME_MS;
|
||||
use crate::unified_exec::ProcessEntry;
|
||||
use crate::unified_exec::ProcessStore;
|
||||
use crate::unified_exec::UnifiedExecContext;
|
||||
@@ -263,7 +265,14 @@ impl UnifiedExecProcessManager {
|
||||
}
|
||||
|
||||
let max_tokens = resolve_max_tokens(request.max_output_tokens);
|
||||
let yield_time_ms = clamp_yield_time(request.yield_time_ms);
|
||||
let yield_time_ms = {
|
||||
let time_ms = clamp_yield_time(request.yield_time_ms);
|
||||
if request.input.is_empty() {
|
||||
time_ms.clamp(MIN_EMPTY_YIELD_TIME_MS, MAX_YIELD_TIME_MS)
|
||||
} else {
|
||||
time_ms
|
||||
}
|
||||
};
|
||||
let start = Instant::now();
|
||||
let deadline = start + Duration::from_millis(yield_time_ms);
|
||||
let collected = Self::collect_output_until_deadline(
|
||||
|
||||
Reference in New Issue
Block a user