codex - 💡(How to fix) Fix fix: unified_exec yield_time_ms behaves as floor instead of ceiling [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openai/codex#17233Fetched 2026-04-10 03:43:37
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
1
Author
Timeline (top)
labeled ×3closed ×1commented ×1unlabeled ×1

unified_exec yield timeouts act as a minimum wait (floor) rather than a maximum wait (ceiling). Every shell tool call blocks for the full yield_time_ms even after the child process has exited and output is available.

Root Cause

In codex-rs/core/src/unified_exec/process_manager.rs, collect_output_until_deadline only breaks when Instant::now() >= deadline:

exit_signal_received |= cancellation_token.is_cancelled();
if Instant::now() >= deadline {
    break;
}

Chunks are collected but the loop continues waiting for the full timeout.

Code Example

exit_signal_received |= cancellation_token.is_cancelled();
if Instant::now() >= deadline {
    break;
}

---

if !collected.is_empty() {
    break;
}
RAW_BUFFERClick to expand / collapse

Summary

unified_exec yield timeouts act as a minimum wait (floor) rather than a maximum wait (ceiling). Every shell tool call blocks for the full yield_time_ms even after the child process has exited and output is available.

Steps to reproduce

  1. Run any fast command (e.g. echo hello) via the shell tool with yield_time_ms=5000
  2. Observe the yield always takes ~5 seconds despite echo completing in <10ms

Root cause

In codex-rs/core/src/unified_exec/process_manager.rs, collect_output_until_deadline only breaks when Instant::now() >= deadline:

exit_signal_received |= cancellation_token.is_cancelled();
if Instant::now() >= deadline {
    break;
}

Chunks are collected but the loop continues waiting for the full timeout.

Proposed fix

Break as soon as output is available:

if !collected.is_empty() {
    break;
}

This treats yield_time_ms as a ceiling — return immediately when data is ready, wait up to the timeout if the process hasn't produced anything yet.

Diff

2 files, +28 / -3: zazula/codex-1#fix/yield-time-ceiling

Impact

  • All fast shell commands return instantly instead of blocking for the full yield timeout
  • Commands that genuinely need the timeout to produce output are unaffected
  • Cancellation handling is preserved

Test

Added unified_exec_yield_time_is_ceiling_not_floor — runs echo done with a 5s yield and asserts wall time < 1.5s. Fails under the current behavior (~5s).

extent analysis

TL;DR

Modify the collect_output_until_deadline loop in process_manager.rs to break as soon as output is available, treating yield_time_ms as a maximum wait time instead of a minimum.

Guidance

  • Review the proposed fix in the codex-1#fix/yield-time-ceiling diff to understand the specific code changes required.
  • Verify the fix by running the added test unified_exec_yield_time_is_ceiling_not_floor, which should pass if the issue is resolved.
  • Consider the impact on existing code that relies on the current behavior, as fast shell commands will now return instantly instead of blocking for the full yield timeout.
  • Test the fix with various shell commands and yield timeouts to ensure it works as expected in different scenarios.

Example

The proposed fix involves changing the loop condition in collect_output_until_deadline to:

if !collected.is_empty() {
    break;
}

This change allows the loop to exit as soon as output is available, rather than waiting for the full timeout.

Notes

The fix assumes that the collected variable is correctly updated when output is available. If this is not the case, additional changes may be needed to ensure the loop exits correctly.

Recommendation

Apply the proposed workaround by modifying the collect_output_until_deadline loop as described, as it correctly treats yield_time_ms as a maximum wait time and allows fast shell commands to return instantly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING