Skip to content

fix(opencode): wait for shell output capture - #36796

Closed
MaartenBaert wants to merge 2 commits into
anomalyco:devfrom
MaartenBaert:shell-output-race
Closed

fix(opencode): wait for shell output capture#36796
MaartenBaert wants to merge 2 commits into
anomalyco:devfrom
MaartenBaert:shell-output-race

Conversation

@MaartenBaert

Copy link
Copy Markdown

Issue for this PR

Closes#36795

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Retains and joins the shell output-capture fiber after the process closes or is terminated. This prevents scope cleanup from interrupting output capture before the result is constructed.

How did you verify your code works?

I can't reliably reproduce the issue so I'm not sure whether this actually fixes it. I just ran the local tests to catch obvious regressions.

Screenshots / recordings

N/A

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, here are potentially related PRs that address similar shell output issues:

Related PRs:

  1. fix: normalize carriage-return shell output #36684 - fix: normalize carriage-return shell output

    • Related to shell output handling and formatting
  2. fix: prevent UTF-8 corruption when stdout and stderr interleave #36665 - fix: prevent UTF-8 corruption when stdout and stderr interleave

    • Addresses shell output capture issues when stdout/stderr overlap
  3. fix(core): preserve shell output tail #36554 - fix(core): preserve shell output tail

    • Directly related to preserving shell output
  4. fix(shell): drain stdout before reading output to avoid "(no output)" on exit 0 #35543 - fix(shell): drain stdout before reading output to avoid "(no output)" on exit 0

These PRs are all related to shell output capture and handling. PR #35543 is particularly relevant since it also deals with timing issues between process exit and output capture completion—a concern similar to what #36796 addresses with fiber joining.

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

@MaartenBaert

Copy link
Copy Markdown
Author

Yes, I think this was closed incorrectly. I get that you guys are volunteers but really - this is an obvious bug, it has an obvious solution, I run into this race condition almost daily and it creates real issues, multiple people have independently reported this and submitted a PR with a fix for this ... clearly this is a real issue.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bash tool can return before output capture completes

1 participant

@MaartenBaert