Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(agent): the paid send cap holds with context decay off (CA)

purpleb91d62c092b5
diff --git a/src/hooks/__tests__/c77-api-model-window.test.ts b/src/hooks/__tests__/c77-api-model-window.test.ts
index 706f0dba..ae2e6dc9 100644
--- a/src/hooks/__tests__/c77-api-model-window.test.ts
+++ b/src/hooks/__tests__/c77-api-model-window.test.ts
@@ -114,10 +114,11 @@ describe('C77: the window of an API model whose server names none', () => {
expect(await getChatWindowTokens(model())).toBeGreaterThan(8192)
})
- it('without the send cap the button stays, for the model window alone', async () => {
+ it('with decay off the paid send cap stays, and so does its button (CA, 14.11.2026)', async () => {
useSettingsStore.getState().updateSettings({ contextDecay: false })
const ctx = await resolveModelContext(model(), 'chat', currentContextKnobs())
- expect(ctx.sendAdjustable).toBe(false)
+ expect(ctx.sendAdjustable).toBe(true)
+ expect(ctx.sendWindow).toBeLessThanOrEqual(32768)
expect(ctx.adjustable).toBe(true)
expect(ctx.modelWindowSettable).toBe(true)
})
diff --git a/src/hooks/useActiveContextWindow.ts b/src/hooks/useActiveContextWindow.ts
index 9e9a6a86..c6824a25 100644
--- a/src/hooks/useActiveContextWindow.ts
+++ b/src/hooks/useActiveContextWindow.ts
@@ -360,7 +360,7 @@ export async function resolveModelContext(model: string, use: WindowUse, k: Cont
? await cloudClient.getContextWindow(cloudId).catch(() => null)
: null
const max = cloudResolved?.tokens || await getModelMaxTokens(model).catch(() => 4096)
- const sendAdjustable = k.capEnabled !== false && isPaidProvider(providerId, sendsToALanBackend(providerId, model))
+ const sendAdjustable = isPaidProvider(providerId, sendsToALanBackend(providerId, model))
const windowSource = remoteWindowSource(providerId, cloudResolved?.source, max)
// C77: an OpenAI-compatible endpoint (it has a per model window key) that
// did not say its window. A window the server named is never overridden
diff --git a/src/lib/__tests__/send-window.test.ts b/src/lib/__tests__/send-window.test.ts
index fa19f5b3..be85b94c 100644
--- a/src/lib/__tests__/send-window.test.ts
+++ b/src/lib/__tests__/send-window.test.ts
@@ -25,14 +25,20 @@ describe('A2: the paid-provider send cap', () => {
expect(budget).toBe(DEFAULT_SEND_WINDOW_TOKENS)
})
- it('negative control: without the cap the same model gets 0.8 of its window', () => {
+ it('the decay switch does not lift the cap on a paid provider any more (CA, 14.11.2026)', () => {
+ // Decay off used to mean 0.8 of the window, 209k per step on this model.
+ // The support logs of that week show runs sending 120-278k per paid step.
const budget = effectiveSendWindow({
providerId: 'lu-cloud',
modelWindow: 262144,
capEnabled: false,
})
+ expect(budget).toBe(DEFAULT_SEND_WINDOW_TOKENS)
+ })
+
+ it('negative control: a local backend still gets 0.8 of its window', () => {
+ const budget = effectiveSendWindow({ providerId: 'ollama', modelWindow: 262144, capEnabled: false })
expect(budget).toBe(Math.floor(262144 * 0.8))
- expect(budget).toBeGreaterThan(200000)
})
it('never RAISES a small model to the cap', () => {
diff --git a/src/lib/send-window.ts b/src/lib/send-window.ts
index 69fd1b8d..afa00ecf 100644
--- a/src/lib/send-window.ts
+++ b/src/lib/send-window.ts
@@ -83,7 +83,9 @@ export interface SendWindowInput {
modelWindow: number
/** settings.codexSendWindowTokens. */
sendWindowTokens?: number
- /** settings.contextDecay. The notaus switches the cap off with the decay. */
+ /** settings.contextDecay. Ignored for the cap since CA (14.11.2026): a paid
+ * provider is always capped, decay on or off. Kept so callers need not
+ * change. */
capEnabled?: boolean
/** settings.smallModelMode. */
smallModelMode?: boolean
@@ -113,8 +115,15 @@ export function effectiveSendWindow(input: SendWindowInput): number {
const base = input.smallModelMode
? Math.floor(Math.min(window * SMALL_MODEL_SHARE, SMALL_MODEL_CEILING))
: Math.floor(window * WINDOW_SHARE)
- if (input.capEnabled === false) return base
if (!isPaidProvider(input.providerId, input.localBackend)) return base
+ // The decay switch (`capEnabled`) no longer lifts the cap on a provider
+ // that bills (CA, 14.11.2026). Turning decay off means "do not shorten old
+ // results", and it had silently also meant "send the whole history on every
+ // step, however long": the support logs of that week show runs sending
+ // 120-278k tokens per step on LU Cloud, every one of them paid in full. A
+ // run that wants more than the cap per step picks it per model in the
+ // context menu, where the price per step is shown.
+ void input.capEnabled
const cap =
typeof input.sendWindowTokens === 'number' && input.sendWindowTokens > 0
? Math.floor(input.sendWindowTokens)