ui.matches/string waitFor hangs the run when screen() hits OpenTUI OutputBusy

未关闭 适合新手
#142 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
69/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
testing

调研方向

从 packages/simulation/src/frontend/actions.ts 开始,issue 指出 screen() 和 matches() 是出错路径;将其与 ui.capture 使用的渲染空闲等待路径进行比较。使用 issue 中描述的连续两次 ui.waitFor() 调用重现问题,并检查缓冲区读取失败时模拟端点是否会响应。完成标准是 matches 等待渲染进入空闲状态,并且发生错误时会返回响应,而不是让 RPC 没有应答。

由索引模型根据 Issue 内容生成。

描述

bug

Summary

ui.matches (and therefore ui.waitFor("some text"), which polls it) can fail permanently on a current V2 checkout:

opencode drive ui websocket: request failed cause="NativeError: ot_session_acquire_buffer_lease failed: OutputBusy"
    at withResolvedChars (@opentui/core buffer.ts)
    at screen (packages/simulation/src/frontend/actions.ts:94)
    at matches (packages/simulation/src/frontend/actions.ts:150)

The simulation endpoint logs the failure and never answers the RPC, so Drive waits until UiTimeoutError (30s) and aborts the run. matches calls screen() (a direct currentRenderBuffer.getRealCharBytes() read) without waiting for the renderer to go idle, so it races a render that holds the buffer lease. ui.capture re-renders and waits for idle() first, and did not fail in 6+ consecutive calls in the same run.

The first matches usually succeeds and a later one fails, so a waitFor that has already matched once can still die mid-poll.

Reproduction

yield* ui.submit("Run something")
yield* ui.waitFor("step 3", { timeout: 30_000 })  // may succeed
yield* ui.waitFor("step 4", { timeout: 30_000 })  // UiTimeoutError: ui.matches timed out after 30000ms

100% reproducible across 3 runs on this checkout, with recording: false.

Expected

  • The simulation endpoint answers the RPC with an error (or retries internally) instead of leaving it unanswered; a failed read should surface as a catchable UiWaitTimeoutError/operation error, not hang the whole run.
  • matches/screen should use the same render-idle path as capture.

Environment

  • opencode-drive 2.4.0
  • OpenCode b032f90634 (PR #62977 worktree), @opentui/core 0.8.1
  • TUI stderr/log: /tmp/opencode-drive/run-af7b2256-d917-4337-b2cd-c92c25a62afb/logs/opencode/log/opencode-local.log (search OutputBusy)

Workaround

Poll ui.capture() and search the joined span text yourself (what I did for the recording), instead of ui.matches/string waitFor.

主要语言
TypeScript
星标
41
派生
9
平均合并
39 分钟
30 天内合并 PR
9

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

anomalyco/opencode-drive 的其他 Issue

查看 anomalyco/opencode-drive 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。