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

Đang mở Phù hợp với người mới
#142 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
69/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
typescript
Lĩnh vực
testing

Hướng nghiên cứu

Bắt đầu với packages/simulation/src/frontend/actions.ts, nơi issue xác định screen() và matches() là đường dẫn bị lỗi; so sánh nó với đường dẫn chờ render ở trạng thái nhàn rỗi mà ui.capture sử dụng. Tái hiện bằng hai lần gọi ui.waitFor() liên tiếp được mô tả trong issue và kiểm tra xem endpoint mô phỏng có trả lời khi đọc buffer thất bại hay không. Công việc hoàn tất khi matches chờ render ở trạng thái nhàn rỗi và lỗi trả về một phản hồi thay vì để RPC không được trả lời.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
TypeScript
Star
41
Fork
9
Merge trung bình
39 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của anomalyco/opencode-drive

Tất cả issue của anomalyco/opencode-drive

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.