Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): OpenCode turns no longer settle before OpenCode starts the prompt #11677

Closedvkpdeveloper(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/11677/headopened View on GitHub

Showing 2 changed files with 151 additions and 0 deletions (loading 1).

x
0 of 2 viewed, 2 left
151 additions and 0 deletionsapps/server/src/provider/Layers/OpenCodeAdapter.test.tsModified
View file
@@ -47,6 +47,7 @@
isSameOpenCodeDirectory,
makeOpenCodeAdapter,
mergeOpenCodeAssistantText,
+ OPENCODE_PROMPT_ADMISSION_TIMEOUT_MS,
} from "./OpenCodeAdapter.ts";
import { symlinksSupported } from "@t3tools/shared/testing/symlinks";
​
@@ -2021,6 +2022,156 @@
+ it.effect("keeps a queued prompt running while OpenCode has not started it yet", () =>
+ Effect.gen(function* () {
+ const adapter = yield* OpenCodeAdapter;
+ const threadId = asThreadId("thread-queued-prompt-not-started");
+ const busyEvent = promiseWithResolvers<unknown>();
+ const idleEvent = promiseWithResolvers<unknown>();
+ // OpenCode accepted the prompt (the message exists over HTTP) but its
+ // status map has no entry yet: the per-run instance is still booting.
+ runtimeMock.state.autoPromptEcho = false;
+ runtimeMock.state.subscribedEvents = [busyEvent.promise, idleEvent.promise];
+ runtimeMock.state.sessionStatusImplementation = async () => ({ data: {} });
+ runtimeMock.state.promptAsyncImplementation = async () => {
+ const prompt = runtimeMock.state.promptCalls.at(-1) as { messageID?: string } | undefined;
+ if (prompt?.messageID) {
+ runtimeMock.state.messages.push({
+ info: { id: prompt.messageID, role: "user" },
+ parts: [],