Skip to content

fix(tui): stop retrying unavailable audio - #41770

Closed
muyiyr wants to merge 1 commit into
anomalyco:devfrom
muyiyr:audio-retry
Closed

muyiyr wants to merge 1 commit into
anomalyco:devfrom
muyiyr:audio-retry

Conversation

@muyiyr

@muyiyr muyiyr commented Aug 11, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #41763

Type of change

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

What does this PR do?

Stops retrying TUI audio startup after the playback device is unavailable. The failed native engine is disposed, cached sounds are cleared, and audio remains disabled until the next TUI lifecycle.

This prevents each later attention sound from re-running native ALSA device discovery and writing another diagnostics block over the terminal.

The remaining first native diagnostics block is tracked upstream in anomalyco/opentui#1358.

How did you verify your code works?

  • bun test test/audio.test.ts in packages/tui
  • bun test in packages/tui — 194 passed, 1 skipped
  • The regression test verifies one startup attempt per TUI lifecycle and confirms dispose() allows a fresh lifecycle to try again.
  • Linux ARM64 container with libasound2 and no /dev/snd: three playback attempts produced 105 ALSA stderr lines and three startup errors before the fix, versus 35 lines and one startup error after it.

Local bun typecheck is currently blocked by existing Buffer/Node type incompatibilities in unchanged files and dependencies, including @ff-labs/fff-bun, packages/core, and the existing packages/tui/src/audio.ts event typing. GitHub CI will run the required typecheck in the repository environment.

Screenshots / recordings

Not included. The Linux reproduction confirms that the change prevents repeated native ALSA stderr blocks. The first native startup attempt can still emit one diagnostics block.

Checklist

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

@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.

Sign up for free to 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.

tui: ALSA errors flood and corrupt the terminal during interaction

1 participant