Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(ai): claude-cli continuation_unproven notice names the code and its remedy; the gateway keeps the result unretried (#6791)
garrytanaf417e1b0d7c
diff --git a/docs/ai-providers/claude-cli.md b/docs/ai-providers/claude-cli.mdindex 3ceffed95f..1776f464dc 100644--- a/docs/ai-providers/claude-cli.md+++ b/docs/ai-providers/claude-cli.md@@ -72,7 +72,10 @@ stdin:call's assistant events. When it cannot prove the rebuilt text is the wholeanswer, the call returns no text and no tool calls, finishes `length` (socallers retry or escalate, as for any capped answer) and reports- `providerMetadata['claude-cli'].code = 'continuation_unproven'`.+ `providerMetadata['claude-cli'].code = 'continuation_unproven'` with its+ reason. The gateway keeps that result as it is: the `chat_fallback_chain`+ does not resend it (only refusals and thrown errors move to the next+ model), and `toolLoop` stops `length` without dispatching a tool.- `--tools ''` disables every built-in tool (Bash/Read/WebSearch/…) — thesubprocess must behave like a raw LLM, not a full agent.- `--strict-mcp-config` skips loading the user's MCP servers. Without it,diff --git a/src/core/ai/providers/claude-cli-continuation.ts b/src/core/ai/providers/claude-cli-continuation.tsindex 6308fba10b..8fa42f6c1d 100644--- a/src/core/ai/providers/claude-cli-continuation.ts+++ b/src/core/ai/providers/claude-cli-continuation.ts@@ -140,7 +140,7 @@ let noticed = false;function unproven(reason: ContinuationUnprovenReason): ClaudeCliAnswer {if (!noticed) {noticed = true;- process.stderr.write(`[claude-cli] continuation_unproven (${reason}): Claude Code continued an answer past its output cap and gbrain could not prove the full text; the call finishes as length with no text, so callers retry or escalate. A larger output cap avoids the continuation.\n`);+ process.stderr.write(`[claude-cli] continuation_unproven (${reason}): Claude Code continued an answer past its output cap and gbrain could not prove the full text, so the call finished as length with no text and no tool calls; the caller retries or escalates as for any capped answer. Remedy: raise that caller's output cap (the setting its truncation warning names) so the answer fits without a continuation; details: gbrain errors continuation_unproven.\n`);}return { kind: 'unproven', reason };}diff --git a/test/claude-cli-continuation-6791.test.ts b/test/claude-cli-continuation-6791.test.tsindex ad43d280cf..7c7b75e9ef 100644--- a/test/claude-cli-continuation-6791.test.ts+++ b/test/claude-cli-continuation-6791.test.ts@@ -279,6 +279,8 @@ describe('an unprovable continuation is a length outcome with no text and no tooconst notices = stderr.split('\n').filter(line => line.includes('continuation_unproven'));expect(notices).toHaveLength(1);expect(notices[0]).toContain('events_missing');+ expect(notices[0]).toContain('Remedy: raise that caller\'s output cap');+ expect(notices[0]).toContain('gbrain errors continuation_unproven');});}, 30_000);});@@ -315,3 +317,33 @@ describe('#6791 an unprovable continuation takes each caller family\'s length pa}}, 30_000);});++describe('#6791 the gateway keeps an unprovable continuation as a length result', () => {+ afterEach(() => resetGateway());++ test('chat() with a fallback chain returns it once, unretried, with its metadata; toolLoop dispatches nothing', async () => {+ const block = '<use_tools>\n[{"name": "put_page", "input": {"slug": "notes/tail", "content": "tail only"}}]\n</use_tools>';+ const calls: unknown[] = [];+ await withCli({ verbose: envelope(block), bare: envelope(block) }, async stub => {+ configureGateway({ chat_model: 'claude-cli:claude-sonnet-5', chat_fallback_chain: ['claude-cli:claude-haiku-5'], env: {} });+ const answer = await chat({ messages: [{ role: 'user', content: 'Write the page.' }], maxTokens: 4000 });+ expect(stub.argv().filter(a => a === '--print')).toHaveLength(1);+ expect(answer.stopReason).toBe('length');+ expect(answer.text).toBe('');+ expect(answer.fallbackFrom).toBeUndefined();+ expect(answer.blocks.filter(b => b.type === 'tool-call')).toEqual([]);+ expect(answer.providerMetadata?.['claude-cli']).toEqual({ code: 'continuation_unproven', reason: 'events_missing' });++ const result = await toolLoop({+ initialMessages: [{ role: 'user', content: 'Write the page.' }],+ tools: [{ name: 'put_page', description: 'Write a page.', inputSchema: { type: 'object', properties: { slug: { type: 'string' }, content: { type: 'string' } } } }],+ toolHandlers: new Map([['put_page', { execute: async (input: unknown) => { calls.push(input); return 'ok'; } }]]),+ maxTurns: 3,+ maxTokens: 4000,+ });+ expect(calls).toEqual([]);+ expect(result.stopReason).toBe('length');+ expect(stub.argv().filter(a => a === '--print')).toHaveLength(2);+ });+ }, 30_000);+});