opencode icon indicating copy to clipboard operation
opencode copied to clipboard

fix(tui): prevent crash when input is undefined in prompt set

Open Zhanbingli opened this issue 1 week ago • 5 comments

I added defensive checks for the input object in set() and onSelect callbacks. While this specific race condition is hard to reproduce locally, this change directly addresses the undefined error reported in #7528 by ensuring setText is only called on a valid object.

Zhanbingli avatar Jan 10 '26 03:01 Zhanbingli

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

github-actions[bot] avatar Jan 10 '26 03:01 github-actions[bot]

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

No duplicate PRs found

github-actions[bot] avatar Jan 10 '26 03:01 github-actions[bot]

Unfortunately, this somewhat breaks message forking since the prompt text from the forked message doesn't populate in the input box anymore

itsrainingmani avatar Jan 10 '26 13:01 itsrainingmani

this one makes more sense to fix the issue: https://github.com/anomalyco/opencode/pull/7702

Leka74 avatar Jan 10 '26 23:01 Leka74

Unfortunately, this somewhat breaks message forking since the prompt text from the forked message doesn't populate in the input box anymore

Oh! Thank you! This feedback helps me think about how to improve the code.

Zhanbingli avatar Jan 11 '26 01:01 Zhanbingli