Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(ui): hide Change the output limit when the limit is at its maximum (C8)

Bernhard Jackiewicza93edb223dfe
diff --git a/graph-ui/src/browser-ai/BrowserChatDock.test.tsx b/graph-ui/src/browser-ai/BrowserChatDock.test.tsx
index b4ec72d5e..f86a99316 100644
--- a/graph-ui/src/browser-ai/BrowserChatDock.test.tsx
+++ b/graph-ui/src/browser-ai/BrowserChatDock.test.tsx
@@ -1089,6 +1089,19 @@ describe('graph answers and answer limits', () => {
expect(document.activeElement?.id).toBe('cbm-chat-output-tokens');
});
+ it('does not offer to change an output limit that is already at its maximum, and still lists the larger models (C8)', async () => {
+ const { props, runtime } = fixture();
+ runtime.chat.mockImplementationOnce(async (_messages, _onToken, options) => {
+ options?.onComplete?.({ stopReason: 'length' }); return 'A long answer that';
+ });
+ await render({ ...props, attachment: selection }); await click('Download & load');
+ await type('Explain this part'); await click('Send ↑');
+ const note = container.querySelector<HTMLDetailsElement>('.cbm-chat-turn details.cbm-chat-limit-note');
+ expect(note?.textContent).toContain('The output limit is at the maximum of 512 tokens for this model.');
+ expect([...note?.querySelectorAll('button') ?? []].map(item => item.textContent)).not.toContain('Change the output limit');
+ expect(note?.textContent).toContain('Qwen3 0.6B · 579 MB download');
+ });
+
it('says why an automatic explanation stops early and that a question may answer longer (K1)', async () => {
vi.useFakeTimers();
try {
diff --git a/graph-ui/src/browser-ai/BrowserChatDock.tsx b/graph-ui/src/browser-ai/BrowserChatDock.tsx
index 60eb29500..dd21695fa 100644
--- a/graph-ui/src/browser-ai/BrowserChatDock.tsx
+++ b/graph-ui/src/browser-ai/BrowserChatDock.tsx
@@ -95,7 +95,8 @@ function TokenLimitNote({ limit, automatic, chat, model, onChangeOutput }: Limit
<summary>{browserChatText.shortened}</summary>
<p>{automatic ? browserChatText.limitAutomatic(limit.inputTokens, limit.outputTokens, chat.inputTokens, chat.outputTokens) : browserChatText.limitReached(limit.inputTokens, limit.outputTokens)}</p>
<p>{browserChatText.outputRoom(chat.outputTokens, model.maxOutputTokens)}</p>
- <button type="button" onClick={onChangeOutput}>{browserChatText.changeOutputLimit}</button>
+ {/* At its maximum the limit cannot be raised, so there is nothing to change (C8). */}
+ {chat.outputTokens < model.maxOutputTokens && <button type="button" onClick={onChangeOutput}>{browserChatText.changeOutputLimit}</button>}
{larger.length > 0 && <><p>{browserChatText.largerModels}</p>
<ul>{larger.map(candidate => <li key={candidate.id}>{browserChatText.modelDownload(candidate.displayName, sizeLabel(candidate.bytes))}</li>)}</ul></>}
</details>;