Repository navigation
fix(agent): bound transient command output replay by deadline - #46785
Merged
BeautyyuYanli merged 2 commits intoNov 20, 2026
Merged
BeautyyuYanli merged 2 commits into
BeautyyuYanli merged 2 commits into
Conversation
BeautyyuYanli
approved these changes
Nov 20, 2026
BeautyyuYanli
left a comment
Contributor
There was a problem hiding this comment.
(This message is automated while I'm responsible for it.)
Reviewed and pushed a small follow-up commit (807905991516) on top of the original fix:
- Re-raise
TimeoutErrororiginating insidecommands.read_output(...)whennot read_timeout.expired(), so provider-side read timeouts before the command deadline are not misclassified as command budget exhaustion. - Unify the completion exit (
not result.truncated and result.done) and shared_remaining_time(deadline) <= 0.0budget gate acrossread_outputandwait. - Expand
test_command_runner.pyto cover multi-page remaining-budget replay,interrupt->delete(force=True)ordering, terminal exit metadata preservation, internalTimeoutErrorpropagation, andoutput_limit/ final-page precedence.
All CI checks on 807905991516 are green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #46784
Summary
Honor the remaining command timeout while replaying truncated output.
read_outputhas no timeout argument, so this branch now checks the shared deadline before starting another read and bounds that await withasyncio.timeout.An exhausted replay returns the existing incomplete-output result with reason
timeout, preserves the captured prefix, and uses the existing interrupt/delete cleanup. Healthy replay and caller cancellation retain their behavior. The change stays in the transient command runner used by complete Shell calls and Binding file operations; no provider interface changes.Verification
The standalone issue reproduction was run against original and fixed sources. Tests use a scripted command-protocol implementation; no live remote sandbox/network coverage is claimed.
git diff --checkpassed.Commands from
dify-agent, with locked server/dev dependencies:Checklist
From Codex