@@ -1,60 +1,67 @@
11 # TODO
22
3-## Investigate broken api with Gemini:
3+## Bug with chat completions models (kimi 2.5 for example)
4+
5+See bellow, there is the thinking spiner before each line, this doesn't happen with other models.
46
57 ```
6-⠴ thinking2438 | text: responseBody,
7-2439 | schema: errorSchema
8-2440 | });
9-2441 | return {
10-2442 | responseHeaders,
11-2443 | value: new APICallError4({
12- ^
13-AI_APICallError: Unable to submit request because function call `default_api:replace` in the 26. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures
14- cause: undefined,
15- url: "https://opencode.ai/zen/v1/models/gemini-3.1-pro:streamGenerateContent?alt=sse",
16- requestBodyValues: {
17- generationConfig: [Object ...],
18- contents: [
19- [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...], [Object ...]
20- ],
21- systemInstruction: [Object ...],
22- safetySettings: undefined,
23- tools: [
24- [Object ...]
25- ],
26- toolConfig: [Object ...],
27- cachedContent: undefined,
28- labels: undefined,
29-},
30- statusCode: 400,
31- responseHeaders: {
32- "cf-ray": "9da99240986c1124-ORD",
33- connection: "keep-alive",
34- "content-type": "text/event-stream",
35- date: "Wed, 11 Mar 2026 09:35:55 GMT",
36- server: "cloudflare",
37- "transfer-encoding": "chunked",
38-},
39- responseBody: "{\n \"error\": {\n \"code\": 400,\n \"message\": \"Unable to submit request because function call `default_api:replace` in the 26. content block is missing a `thought_signature`. Learn more: https://docs.cloud.google.com/vertex-ai/generative-ai/docs/thought-signatures\",\n \"status\": \"INVALID_ARGUMENT\"\n }\n}\n",
40- isRetryable: false,
41- data: {
42- error: [Object ...],
43-},
44- vercel.ai.error: true,
45- vercel.ai.error.AI_APICallError: true,
46-
47- at /Users/seancaetanomartin/src/mini-coder/node_modules/@ai-sdk/provider-utils/dist/index.mjs:2443:18
48- at /Users/seancaetanomartin/src/mini-coder/node_modules/@ai-sdk/provider-utils/dist/index.mjs:2286:34
49- at processTicksAndRejections (native:7:39)
50-
51-✖ API error 400
52- https://opencode.ai/zen/v1/models/gemini-3.1-pro:streamGenerateContent?alt=sse
53-✖ API error 400
54- https://opencode.ai/zen/v1/models/gemini-3.1-pro:streamGenerateContent?alt=sse
8+⠦ thinkingAdd reasoning indicator (e.g., "🤔" or "thinking") when `showReasoning` is true
9+
10+⠧ thinkingPhase 5: Update Command Context & CLI Commands
11+⠏ thinkingFiles: `src/cli/commands.ts`, `src/agent/session-runner.ts`, `src/index.ts`
12+
13+⠋ thinking1. Add `showReasoning` to `CommandContext`
14+⠹ thinking2. Add `/reasoning` command to toggle (on|off)
15+⠸ thinking3. Load/save preference from settings repo
16+⠼ thinking4. Pass setting through to `SessionRunner` and reporter
17+
18+⠦ thinkingPhase 6: Update Output Reporter & Headless Reporter
19+⠧ thinkingFiles: `src/cli/output-reporter.ts`, `src/cli/headless-reporter.ts`
20+
21+⠋ thinking1. Accept and forward `showReasoning` option
22+⠙ thinking2. Headless reporter: still consume reasoning events (for accumulation) but never render
23+
24+Phase 7: Agent Integration
25+Files: `src/agent/agent.ts`
26+
27+⠹ thinking1. Load `getShowReasoning()` preference
28+2. Pass to `CommandContext` and `SessionRunner`
29+⠸ thinking3. Update status bar calls to include reasoning flag
30+
31+⠼ thinkingPhase 8: Help & Documentation
32+Files: `src/cli/commands.ts`
33+
34+⠴ thinkingAdd `/reasoning` to help text
35+
36+────────────────────────────────────────
37+
38+⠦ thinkingFiles to Modify (in dependency order):
39+
40+⠧ thinking1. `src/session/db/settings-repo.ts` - Add new setting functions
41+⠇ thinking2. `src/llm-api/types.ts` - Add reasoning to TurnResult (if needed)
42+⠋ thinking3. `src/agent/reporter.ts` - Update StatusBarData
43+4. `src/cli/stream-render.ts` - Add showReasoning option
44+⠙ thinking5. `src/cli/status-bar.ts` - Add reasoning indicator
45+⠹ thinking6. `src/cli/output-reporter.ts` - Forward option
46+⠸ thinking7. `src/cli/headless-reporter.ts` - Handle reasoning events
47+⠼ thinking8. `src/cli/commands.ts` - Add /reasoning command
48+⠴ thinking9. `src/agent/session-runner.ts` - Accept and pass through setting
49+⠦ thinking10. `src/agent/agent.ts` - Load preference, wire up
50+⠧ thinking11. `src/index.ts` - Load preference on startup
51+⠇ thinking12. `src/session/db/index.ts` - Export new functions
52+
53+⠏ thinkingThis is a clean, incremental change that:
54+⠋ thinking· Maintains backward compatibility (defaults to showing reasoning)
55+⠙ thinking· Separates the "reasoning effort" setting from "reasoning display" setting
56+⠹ thinking· Properly accumulates reasoning text for message history
57+⠼ thinking· Works in both interactive and headless modes
58+kimi-k2.5 ✦ high mmm7tm8p ~/src/mini-coder ⎇ main ctx 37.9k/262.1k 14% ↑ 172.2k ↓ 2.3k
59+▶
5560 ```
5661
57-## Gpt 5.4 starts printing garbage:
62+---
63+
64+## Gpt 5.4 starts printing tool calls as the assistant message:
5865
5966 ```
6067 ← read src/llm-api/turn.test.ts:108+50
@@ -88,6 +95,10 @@ AI_APICallError: Unable to submit request because function call `default_api:rep
8895 error: script "dev" exited with code 130
8996 ```
9097
98+I was not able to reproduce the same behaviour with opencode using the same provider. Which points to an issue with our code.
99+
100+---
101+
91102 ## Gpt codex context window maxinng out
92103
93104 I've noticed several sessions with codex spark that error because the context got too big for the model:
@@ -112,6 +123,8 @@ error: script "dev" exited with code 1
112123
113124 The same task with GPT 5.4: `ctx 82.8k/1050.0k 8%` used on 82k in context. I know spark is a smaller context, but I'm suprised by how often we max out the 128k context.
114125
126+---
127+
115128 ## LSP Diagnostics (not very important, with tool-hooks and strong linting, this is not as necessary, but we should implement asap)
116129
117130 We should have a closed loop feedback for LSP diagnostics on edits/reads.