Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

train: read a Go-named limit only from a capitalised Go

milind-soni2624b5105b5a
diff --git a/server/drivers/acp/opencode-go.test.ts b/server/drivers/acp/opencode-go.test.ts
index 013d14b0cd..6d5cdb22dd 100644
--- a/server/drivers/acp/opencode-go.test.ts
+++ b/server/drivers/acp/opencode-go.test.ts
@@ -549,6 +549,9 @@ describe("OpenCode catalog", () => {
expect(facts.limitModels).toEqual(expect.arrayContaining(["openrouter/openai/gpt-6", "openrouter/anthropic/claude-sonnet-5"]));
expect(facts.limitModels).not.toContain("opencode/big-pickle");
expect(facts.limitModels).not.toContain("opencode-go/minimax-m3");
+ // A lowercase "go" in another provider's refusal is not the Go subscription's limit.
+ expect(openCodeLimitFacts("Internal error: go to your dashboard, monthly usage limit reached", "openrouter/openai/gpt-6", catalog).limitModels)
+ .toEqual(expect.arrayContaining(["openrouter/openai/gpt-6", "openrouter/anthropic/claude-sonnet-5"]));
// A limit met on a model of an unknown provider still holds just that model, never the account.
expect(openCodeLimitFacts("Internal error: Monthly usage limit reached for this key", "unlisted/one-off", catalog))
.toEqual({ limit: "model", limitModels: ["unlisted/one-off"] });
diff --git a/server/drivers/acp/opencode-go.ts b/server/drivers/acp/opencode-go.ts
index 4d7b143861..958b773d7e 100644
--- a/server/drivers/acp/opencode-go.ts
+++ b/server/drivers/acp/opencode-go.ts
@@ -779,7 +779,7 @@ const FREE_MODEL_LIMIT = /\bfree(?:UsageLimitError|\s+usage\s+limit)\b/iu;
/** A usage limit the error names as the Go subscription's, by its error name or its wording ("OpenCode Go weekly usage
* limit reached"), whatever model the session had selected. */
-const GO_NAMED_LIMIT = /\bGoUsageLimitError\b|\b(?:OpenCode\s+)?Go\b.{0,60}\b(?:usage|weekly|monthly|5-hour|daily|hourly)\s+limit/iu;
+const GO_NAMED_LIMIT = /\bGoUsageLimitError\b|\bGo\b.{0,60}\b(?:[Uu]sage|[Ww]eekly|[Mm]onthly|5-hour|[Dd]aily|[Hh]ourly)\s+[Ll]imit/u; // "Go" as named: never a lowercase "go to …"
/** How far a usage limit OpenCode reported reaches: one provider's models — the Go subscription's when the refusal or
* the failing model names Go, else the failing model's provider's — or one provider's shared free allowance (with the