@devries-cameron20 / t3code-1 / commits / 9b0435369b
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(opencode): OpenCode Go quota stops show as usage limits (#18315)

Co-authored-by: pi-workspace <pi-workspace@localhost> Co-authored-by: Julius Marminge <julius0216@outlook.com>

Marker-bit committed Oct 19, 2026 at 23:24 UTC 9b0435369bc6f5b63ed3368dfd49ff1b9c577b08
2 files changed +32 -1
apps/server/src/orchestration-v2/Adapters/OpenCode2AdapterV2.test.ts
+27
@@ -518,6 +518,33 @@ it.layer(McpProviderSessions.layer)("OpenCode2 adapter", (it) => {
518 }).pipe(Effect.scoped),
519 );
520
521 + it.effect.each([
522 + ["provider.quota", "usage_limit"],
523 + ["provider.rate-limit", "usage_limit"],
524 + ["provider", "provider_error"],
525 + ] as const)("classifies a %s execution failure as %s", ([code, failureClass]) =>
526 + Effect.gen(function* () {
527 + const { runtime, thread } = yield* resumed([
528 + out("session.prompt", { sessionID: SESSION, text: "<any>" }),
529 + promptAccepted,
530 + event("session.execution.failed", {
531 + sessionID: SESSION,
532 + error: { type: code, message: "Provider rejected the request" },
533 + }),
534 + ]);
535 + const terminal = yield* terminalOf(runtime).pipe(Effect.forkScoped);
536 + yield* runtime.startTurn(turnInput(thread));
537 + const ended = yield* Fiber.join(terminal);
538 + assert.equal(ended?.status, "failed");
539 + assert.deepEqual(ended?.failure, {
540 + class: failureClass,
541 + code,
542 + message: "Provider rejected the request",
543 + retryable: null,
544 + });
545 + }).pipe(Effect.scoped),
546 + );
547 +
548 it.effect("ends the turn when its terminal event is one this build cannot decode", () =>
549 Effect.gen(function* () {
550 const { runtime, thread } = yield* resumed([
packages/provider-opencode/src/server/v2/adapter.ts
+5 -1
@@ -2080,7 +2080,11 @@ export const make = Effect.fn("OpenCode2Adapter.make")(function* (instanceId: Pr
2080 failure: makeProviderFailure({
2081 message: event.data.error.message,
2082 code: event.data.error.type,
2083 - class: "provider_error",
2083 + class:
2084 + event.data.error.type === "provider.quota" ||
2085 + event.data.error.type === "provider.rate-limit"
2086 + ? "usage_limit"
2087 + : "provider_error",
2088 }),
2089 });
2090 default: