Content-Length: 313806 | pFad | http://github.com/coder/coder/pull/19035

72 feat: add timeout support to workspace bash tool by ThomasK33 · Pull Request #19035 · coder/coder · GitHub
Skip to content

feat: add timeout support to workspace bash tool #19035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

ThomasK33
Copy link
Member

Add timeout support to workspace bash tool

This PR adds a timeout feature to the workspace bash tool, allowing users to specify a maximum execution time for commands. Key changes include:

  • Added a timeout_ms parameter to control command execution time (defaults to 60 seconds, with a maximum of 5 minutes)
  • Implemented a new executeCommandWithTimeout function that properly handles command timeouts
  • Added proper output capturing during timeout scenarios, returning all output collected before the timeout
  • Updated documentation to explain the timeout feature and provide usage examples
  • Added comprehensive tests for the timeout functionality, including integration tests

When a command times out, the tool now returns all captured output up to that point along with a cancellation message, making it clear to users what happened.

@ThomasK33 ThomasK33 self-assigned this Jul 24, 2025
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ThomasK33 ThomasK33 requested a review from hugodutka July 24, 2025 15:00
@ThomasK33 ThomasK33 marked this pull request as ready for review July 24, 2025 15:00
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_timeout_support_to_workspace_bash_tool branch from 023275c to f641d85 Compare July 24, 2025 16:05
t.Run("ActualTimeoutBehavior", func(t *testing.T) {
t.Parallel()

// Test the specific scenario you described: echo "123"; sleep 60; echo "456" with 5s timeout
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// Test the specific scenario you described: echo "123"; sleep 60; echo "456" with 5s timeout
// Scenario: echo "123"; sleep 60; echo "456" with 5s timeout

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah yes, AI leaking through 😂

@hugodutka
Copy link
Contributor

Approving barring the lint check

Change-Id: I996cbde4a50debb54a0a95ca5a067781719fa25a
Signed-off-by: Thomas Kosiewski <tk@coder.com>
@ThomasK33 ThomasK33 force-pushed the thomask33/feat_add_timeout_support_to_workspace_bash_tool branch from f641d85 to 00dd127 Compare July 24, 2025 16:30
@ThomasK33 ThomasK33 merged commit 398e80f into main Jul 28, 2025
52 of 53 checks passed
@ThomasK33 ThomasK33 deleted the thomask33/feat_add_timeout_support_to_workspace_bash_tool branch July 28, 2025 09:25
@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/coder/coder/pull/19035

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy