Skip to content

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

fix(cline): hold only the ClinePass models when the ClinePass allowance runs out

Krishna Dobhal380cca84cf7f
diff --git a/server/drivers/acp/cline-models.ts b/server/drivers/acp/cline-models.ts
index 9b53e94ad1..6fd6573d99 100644
--- a/server/drivers/acp/cline-models.ts
+++ b/server/drivers/acp/cline-models.ts
@@ -55,6 +55,11 @@ function entries(value: unknown): Entry[] | null {
let last: Option[] = tierOptions(PASS_FALLBACK, FREE_FALLBACK);
+/** The ClinePass models of the last list read, which share one allowance. */
+export function clinePassModels(): string[] {
+ return last.flatMap((entry) => clineTierProvider(entry.id) === "cline-pass" ? [entry.id] : []);
+}
+
/** The free and ClinePass models, ClinePass first. A list that cannot be read gives the last one that could, then the
* bundled one; never throws. */
export async function clineTierModels(fetchImpl: typeof fetch = fetch): Promise<Option[]> {
diff --git a/server/drivers/acp/cline.test.ts b/server/drivers/acp/cline.test.ts
index 7a8f9d2d36..879b2124cb 100644
--- a/server/drivers/acp/cline.test.ts
+++ b/server/drivers/acp/cline.test.ts
@@ -205,6 +205,14 @@ describe("Cline ACP driver", () => {
expect(clinePlanLimit(new Error("reached your context window limit"), now)).toBeUndefined();
});
+ it("holds only the ClinePass models when the ClinePass allowance runs out", () => {
+ const pass = CLINE_SUPPORT.limitFacts!("You have reached your weekly Clinepass limit.", "cline-pass/glm-5.3");
+ expect(pass.limit).toBe("model");
+ expect(pass.limitModels).toContain("cline-pass/glm-5.3");
+ expect(pass.limitModels!.some((model) => model.startsWith("cline-free/"))).toBe(false);
+ expect(CLINE_SUPPORT.limitFacts!("You have reached your weekly Clinepass limit.", "cline-default")).toEqual({ limit: "engine" });
+ });
+
it("says plainly that ClinePass models need a subscription", () => {
const words = "No access to ClinePass subscription models yet. Subscribe to ClinePass, the low cost open weights model coding plan: https://app.cline.bot/dashboard/subscription?personal=true";
const failure = clineReportedFailure(new Error(`Internal error: ${words}: ${words} (session/prompt)`));
diff --git a/server/drivers/acp/cline.ts b/server/drivers/acp/cline.ts
index 8fd955493e..3b676a9e6c 100644
--- a/server/drivers/acp/cline.ts
+++ b/server/drivers/acp/cline.ts
@@ -9,7 +9,7 @@ import { createAcpDriver, type AcpSupport } from "./core.ts";
import type { ModelCatalog } from "../../contracts.ts";
import { engineFailure } from "../engine-errors.ts";
import { AcpReportedFailure } from "./failure-words.ts";
-import { clineTierModels, clineTierProvider } from "./cline-models.ts";
+import { clinePassModels, clineTierModels, clineTierProvider } from "./cline-models.ts";
const DEFAULT_OPTION = { id: "cline-default", label: "Cline default (configured)" };
const MODELS: ModelCatalog = { default: DEFAULT_OPTION.id, options: [DEFAULT_OPTION] };
@@ -73,7 +73,6 @@ export function clinePlanLimit(error: unknown, now = Date.now()): AcpReportedFai
for (const [, amount, unit] of RESET_IN.exec(text)?.[1]?.matchAll(/(\d+)\s*([dhm])/gi) ?? []) {
delayMs += Number(amount) * UNIT_MS[unit!.toLowerCase()]!;
}
- // holds the whole engine, free models too; hold only the ClinePass models via limitFacts if that bites.
// Cline rounds the wait down to the minute.
const resetsAt = RESET_IN.test(text) ? now + delayMs + 60_000 : undefined;
const failure = engineFailure("Cline", "", { kind: "usage_limit", status: null, resetsAt })!;
@@ -172,6 +171,10 @@ export const CLINE_SUPPORT: AcpSupport = {
if (model && model !== (option("model")?.currentValue ?? currentModelId)) await setModel(model);
},
reportedFailure: clineReportedFailure,
+ // The ClinePass allowance holds only the ClinePass models; free models keep running.
+ limitFacts: (_text, model) => clineTierProvider(model) === "cline-pass"
+ ? { limit: "model", limitModels: [...new Set([model!, ...clinePassModels()])] }
+ : { limit: "engine" },
};
export const ClineAgentDriver = {