瀏覽代碼

test(opencode): synchronize shell cancellation (#33386)

Kit Langton 1 月之前
父節點
當前提交
f50e4accf3
共有 1 個文件被更改,包括 8 次插入2 次删除
  1. 8 2
      packages/opencode/test/session/prompt.test.ts

+ 8 - 2
packages/opencode/test/session/prompt.test.ts

@@ -1711,11 +1711,17 @@ unixNoLLMServer(
     withSh(() =>
       Effect.gen(function* () {
         const { prompt, run, chat } = yield* boot()
+        const { directory: dir } = yield* TestInstance
+        const afs = yield* FSUtil.Service
+        const ready = path.join(dir, ".shell-ready")
 
         const sh = yield* prompt
-          .shell({ sessionID: chat.id, agent: "build", command: "sleep 30" })
+          .shell({ sessionID: chat.id, agent: "build", command: ": > '.shell-ready'; sleep 30" })
           .pipe(Effect.forkChild)
-        yield* waitForBusy(chat.id)
+        yield* pollWithTimeout(
+          afs.existsSafe(ready).pipe(Effect.map((exists) => (exists ? (true as const) : undefined))),
+          "shell never created readiness marker",
+        )
 
         yield* prompt.cancel(chat.id)