Skip to content

Fix run_command hanging on backgrounded command lists - #99

Open
Vamsi-2581 wants to merge 3 commits into
ArtificialAnalysis:mainfrom
Vamsi-2581:codex/fix-backgrounded-compound-command-98
Open

Vamsi-2581 wants to merge 3 commits into
ArtificialAnalysis:mainfrom
Vamsi-2581:codex/fix-backgrounded-compound-command-98

Conversation

@Vamsi-2581

@Vamsi-2581 Vamsi-2581 commented Oct 27, 2026 •

Copy link
Copy Markdown

Summary

Fixes #98. run_command now captures stdout and stderr in temporary files and waits for the shell process itself, so backgrounded command lists do not keep pipe readers blocked waiting for EOF.

Root cause

The shell can exit while a background child still holds inherited stdout/stderr pipes open. The existing concurrent readers waited for those pipes to close before returning, causing run_command to block until the background job exited or the timeout fired.

Changes

  • Capture process output in temporary files so inherited descriptors do not keep the caller waiting.
  • Preserve the existing process session and timeout cleanup behavior.
  • Add a regression test for the reported echo && sleep ... & pattern, synchronized to ensure the foreground output has been written before the shell returns.

Validation

  • Added regression coverage; tests were not run locally.
  • The required lint and type-check workflows are awaiting maintainer approval for this fork PR.
  • This contribution was prepared with assistance from OpenAI Codex.

This branch has not been deployed

No deployments
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.

BUG: LocalCodeExecToolProvider.run_command blocks until a backgrounded command list exits (a && b & hangs until shell_timeout)

1 participant