ui.submit resolves before the TUI snapshots the composer, so back-to-back submits merge into one prompt

オープン
#119 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

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

評価

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

調査の方向性

Start with the ui.submit and ui.enter implementation in the driver, then submitInner in packages/tui/src/component/prompt/index.tsx, where the deferred handler reads input.plainText. Reproduce by running two ui.submit calls in a row and checking that the server gets two separate messages. Done means /undo runs as its own command, or the driver waits for the composer snapshot before resolving and a test covers that. If the fix is not practical, the docs should say a wait is needed between submits.

索引モデルが issue の本文から書いたものです。

説明

bug

Drive 2.1.3 (source checkout at 8feac04). OpenCode V2 at 5cfe3b4271, run from source with opencode: { dev }.

What happens

Two ui.submit calls in a row are admitted as one prompt:

yield* ui.submit("ALPHA first prompt")
yield* ui.submit("/undo")

The server received a single user message with text ALPHA first prompt/undo. /undo never ran as a command. This happened on the home screen and also in a session that had already finished a turn.

Why

ui.submit returns once ui.enter is dispatched. The TUI handles Enter through a deferred submit (submitInner in packages/tui/src/component/prompt/index.tsx reads input.plainText when the deferred handler runs). The next ui.type reaches the composer before that handler runs, so the snapshot holds both texts.

Expected

Either ui.submit resolves after the composer has been snapshotted and cleared, or the docs say that a second ui.submit needs a wait first.

Workaround

Wait until the focused editor no longer contains the first text before the next ui.submit:

yield* ui.waitFor(() => Effect.map(editorText, (text) => !text.includes("ALPHA")), { interval: 10 })

editorText slices the focused editor element's rows from ui.capture().

主要言語
TypeScript
スター
40
フォーク
8
平均マージ
4時間 24分
マージ済み PR(30日)
10

環境構築

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

はじめの一歩

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

anomalyco/opencode-drive のほかの issue

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

似ている issue

TypeScript の issue をもっと見る

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

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