Skip to content

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

fix(cline): hold Cline default too when its saved ClinePass provider runs out

Krishna Dobhal6865e7842571
diff --git a/server/drivers/acp/cline.test.ts b/server/drivers/acp/cline.test.ts
index 879b2124cb..b27a7bf571 100644
--- a/server/drivers/acp/cline.test.ts
+++ b/server/drivers/acp/cline.test.ts
@@ -210,7 +210,19 @@ describe("Cline ACP driver", () => {
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" });
+ expect(CLINE_SUPPORT.limitFacts!("This Cline account has reached its usage limit.", undefined)).toEqual({ limit: "engine" });
+ });
+
+ it("holds Cline default with the ClinePass models when the saved ClinePass provider runs out", () => {
+ const failure = clinePlanLimit(new Error("You have reached your weekly Clinepass limit. The limit resets in 8h 30m, please try again later."))!;
+ expect(failure.message).toMatch(/^Your ClinePass allowance has run out, which resets .*pick a free Cline model or another AI/);
+ // CLINE_MODEL unset: resolveTurnModel gives no model for Cline default.
+ const facts = CLINE_SUPPORT.limitFacts!(failure.message, undefined);
+ expect(facts.limit).toBe("model");
+ expect(facts.limitModels).toContain("cline-default");
+ expect(facts.limitModels).toContain("cline-pass/glm-5.3");
+ expect(facts.limitModels!.some((model) => model.startsWith("cline-free/"))).toBe(false);
+ expect(CLINE_SUPPORT.limitFacts!(clinePlanLimit(new Error("You have reached your weekly Codex limit."))!.message, undefined)).toEqual({ limit: "engine" });
});
it("says plainly that ClinePass models need a subscription", () => {
diff --git a/server/drivers/acp/cline.ts b/server/drivers/acp/cline.ts
index 3b676a9e6c..3efeba269c 100644
--- a/server/drivers/acp/cline.ts
+++ b/server/drivers/acp/cline.ts
@@ -76,9 +76,16 @@ export function clinePlanLimit(error: unknown, now = Date.now()): AcpReportedFai
// 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 })!;
- return new AcpReportedFailure({ ...failure, ...(resetsAt === undefined ? {} : { limitResetsAt: resetsAt }) }, true);
+ const facts = { ...failure, ...(resetsAt === undefined ? {} : { limitResetsAt: resetsAt }) };
+ if (!/\bclinepass\b/i.test(text)) return new AcpReportedFailure(facts, true);
+ // limitFacts reads this message to hold only the ClinePass models, so the generic localized text cannot stand in.
+ const message = failure.message.replace("This Cline account has reached its usage limit", PASS_LIMIT)
+ .replace("switch this bot to another AI", "pick a free Cline model or another AI");
+ return new AcpReportedFailure({ ...facts, message, text: undefined }, true);
}
+const PASS_LIMIT = "Your ClinePass allowance has run out";
+
/** Cline 3.0.74: "No access to ClinePass subscription models yet. Subscribe to ClinePass, ...: https://app.cline.bot/..." */
const NO_PASS = /\bNo access to ClinePass subscription models\b/i;
@@ -172,8 +179,9 @@ export const CLINE_SUPPORT: AcpSupport = {
},
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()])] }
+ // Cline default runs the saved provider's model, so a ClinePass limit on it holds the default too.
+ limitFacts: (text, model) => clineTierProvider(model) === "cline-pass" || text.startsWith(PASS_LIMIT)
+ ? { limit: "model", limitModels: [...new Set([clineTierProvider(model) ? model! : DEFAULT_OPTION.id, ...clinePassModels()])] }
: { limit: "engine" },
};