The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 09:45 UTC
fix(opencode): Zen-only Console workspaces no longer show "No limits reported" (#36897)
Co-authored-by: shivam <91240327+shivamhwp@users.noreply.github.com>
Tristan Knight committed
Nov 16, 2026 at 07:49 UTC
b9f24b627fef71e1f000363f8334505f6bf7aa0d
2 files changed
+21
-8
packages/provider-opencode/src/server/v2/OpenCode2Client.test.ts
+9
-1
@@ -458,6 +458,14 @@ describe("OpenCode2Client usage limits", () => {
458
[404, {}, undefined],
459
[405, {}, undefined],
460
[200, { location: { directory: "/remote" }, data: null }, "unsupported"],
461
+ [
462
+ 200,
463
+ {
464
+ location: { directory: "/remote" },
465
+ data: { workspace: { id: "wrk_zen", usageURL: "https://opencode.ai" }, budgets: [] },
466
+ },
467
+ "unsupported",
468
+ ],
469
[503, {}, "probeFailed"],
470
[401, {}, "probeFailed"],
471
[200, { data: { workspace: {} } }, "probeFailed"],
@@ -477,7 +485,7 @@ describe("OpenCode2Client usage limits", () => {
485
const result = yield* api.usageLimits("/remote");
486
if (reason === undefined) assert.strictEqual(result, undefined);
487
else assert.strictEqual(result?.unavailable?.reason, reason);
480
- if (status === 200 && reason === "unsupported")
488
+ if ("data" in body && body.data === null)
489
assert.include(result?.unavailable?.message ?? "", "signed in");
490
}
491
}),
packages/provider-opencode/src/server/v2/usageLimits.ts
+12
-7
@@ -91,6 +91,17 @@ export const readServerUsageLimits = Effect.fn("OpenCode2Client.usageLimits")(fu
91
message: "No OpenCode Console workspace is signed in.",
92
});
93
const { go, budgets, workspace } = body.data;
94
+ const usageURL = URL.parse(workspace.usageURL);
95
+ const externalUsage =
96
+ usageURL?.protocol === "http:" || usageURL?.protocol === "https:"
97
+ ? { externalUsage: { label: workspace.name?.trim() || workspace.id, url: usageURL.href } }
98
+ : {};
99
+ // A Zen-only workspace has neither a Go subscription nor spend limits.
100
+ if (!go && budgets.length === 0)
101
+ return {
102
+ ...makeUnavailableUsageLimits({ checkedAt, reason: "unsupported" }),
103
+ ...externalUsage,
104
+ };
105
const consoleProviders = budgets.some(
106
(budget) => budget.coverage === "all" && budget.per === "set",
107
)
@@ -168,13 +179,7 @@ export const readServerUsageLimits = Effect.fn("OpenCode2Client.usageLimits")(fu
179
});
180
}
181
}
171
- const usageURL = URL.parse(workspace.usageURL);
172
- return {
173
- ...makeUsageLimits({ checkedAt, windows }),
174
- ...(usageURL?.protocol === "http:" || usageURL?.protocol === "https:"
175
- ? { externalUsage: { label: workspace.name?.trim() || workspace.id, url: usageURL.href } }
176
- : {}),
177
- };
182
+ return { ...makeUsageLimits({ checkedAt, windows }), ...externalUsage };
183
}).pipe(
184
Effect.timeout("5 seconds"),
185
Effect.orElseSucceed(() =>