Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/opencode/test/hook/execute.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe("hook.execute", () => {
const entry: HookEntry = { command: "sleep 10", timeout: 200 }
const result = await runHook(entry, makeEnv())
expect(result.action).toBe("pass")
}, 5000)
}, 15_000)

test("passes environment variables to script", async () => {
const entry: HookEntry = { command: 'echo "$OPENCODE_TOOL_NAME" >&2' }
Expand Down
17 changes: 13 additions & 4 deletions packages/opencode/test/session/prompt-effect.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,10 @@ it.live(
3_000,
)

it.live(
// Skip on 2vCPU CI runners — requires 4vCPU dedicated runners (blacksmith) for reliable fiber scheduling.
// See Issue #129: https://github.com/Cor-Incorporated/opencode/issues/129
const hasDedicatedRunner = !process.env.CI || process.env.BLACKSMITH === "1"
;(hasDedicatedRunner ? it.live : it.live.skip)(
"prompt submitted during an active run is included in the next LLM input",
() =>
provideTmpdirServer(
Expand All @@ -858,6 +861,9 @@ it.live(
.pipe(Effect.forkChild)

yield* llm.wait(1)
// Allow the first prompt loop to settle into the held LLM call
// 2vCPU CI runners (ubuntu-latest) need significantly more time than 4vCPU (blacksmith)
yield* Effect.sleep(200)

const id = MessageID.ascending()
const b = yield* prompt
Expand All @@ -871,16 +877,19 @@ it.live(
.pipe(Effect.forkChild)

yield* Effect.promise(async () => {
const end = Date.now() + 5000
// 2vCPU shared runners need generous timeouts for async message persistence
const end = Date.now() + 15_000
while (Date.now() < end) {
const msgs = await Effect.runPromise(sessions.messages({ sessionID: chat.id }))
if (msgs.some((msg) => msg.info.role === "user" && msg.info.id === id)) return
await new Promise((done) => setTimeout(done, 20))
await new Promise((done) => setTimeout(done, 100))
}
throw new Error("timed out waiting for second prompt to save")
})

gate.resolve()
// Allow fibers to fully process the gate resolution on slow CI runners
yield* Effect.sleep(500)

const [ea, eb] = yield* Effect.all([Fiber.await(a), Fiber.await(b)])
expect(Exit.isSuccess(ea)).toBe(true)
Expand All @@ -901,7 +910,7 @@ it.live(
}),
{ git: true, config: providerCfg },
),
3_000,
30_000,
)

it.live(
Expand Down
6 changes: 5 additions & 1 deletion script/duplicate-pr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,13 @@ Examples:
parts.push({ type: "text", text: message })

const session = await opencode.client.session.create()
if (!session.data) {
process.stderr.write("No session available — skipping duplicate check\n")
return
}
const result = await opencode.client.session
.prompt({
path: { id: session.data!.id },
path: { id: session.data.id },
body: {
agent: "duplicate-pr",
parts,
Expand Down
Loading