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

オープン 初心者向け
#142 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
69/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
typescript
領域
testing

調査の方向性

packages/simulation/src/frontend/actions.tsから始めます。issueでは、失敗する経路としてscreen()とmatches()が挙げられています。ui.captureが使うレンダリングのアイドル待機経路と比較してください。issueに記載された、連続する2回の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分
マージ済み PR(30日)
9

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode-drive のほかの issue

anomalyco/opencode-drive の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。