Skip to content

Fix run_in_terminal timeout signaling and avoid foreground reuse after timeout#302892

Merged
meganrogge merged 4 commits intomainfrom
merogge/timeout-fix
Mar 18, 2026
Merged

Fix run_in_terminal timeout signaling and avoid foreground reuse after timeout#302892
meganrogge merged 4 commits intomainfrom
merogge/timeout-fix

Conversation

@meganrogge
Copy link
Collaborator

@meganrogge meganrogge commented Mar 18, 2026

fix #299486

When run_in_terminal hit a model-provided timeout, it could return partial output without clearly indicating timeout, which could mislead agents and cause confusing follow-up output behavior.

Now:

  1. Treats timeout as an explicit execution outcome in foreground runs.
  2. Returns a clear timeout indicator in both result text and metadata.
  3. Marks timed-out executions as background and detaches them from foreground session reuse.
  4. Updates timeout parameter wording to state that timeout returns output with an indicator.

This allows agents to reliably detect timed-out executions, and subsequent foreground runs are less likely to be polluted by timed-out command output.

cc @Tyriar

Copilot AI review requested due to automatic review settings March 18, 2026 16:29
@meganrogge meganrogge self-assigned this Mar 18, 2026
@meganrogge meganrogge added this to the 1.113.0 milestone Mar 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves run_in_terminal timeout handling so that when a model-supplied timeout is hit, the tool explicitly signals the timeout (in text + metadata) and prevents the timed-out terminal from being reused as the foreground session terminal.

Changes:

  • Updates the tool schema wording to clarify that timeouts return partial output with a timeout indicator.
  • Adds an explicit “timeout” outcome to the foreground execution race and returns partial output + timeout metadata.
  • On timeout, marks the terminal as background and detaches it from foreground session reuse to reduce output pollution on later runs.

meganrogge and others added 2 commits March 18, 2026 12:37
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@meganrogge meganrogge enabled auto-merge (squash) March 18, 2026 16:38
@meganrogge meganrogge merged commit dec2c92 into main Mar 18, 2026
20 checks passed
@meganrogge meganrogge deleted the merogge/timeout-fix branch March 18, 2026 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

run_in_terminal timeout silently truncates output with no signal to agent

3 participants