From 25f0a2b80bb04042dc3fe19c0b8ce143b69205ae Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Fri, 16 Jan 2026 09:19:20 -0600 Subject: [PATCH 1/6] fix: AI_InvalidPromptError that occured due to previous commti from last night --- packages/opencode/src/session/message-v2.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.ts index 4b081b5b44..8622a6a166 100644 --- a/packages/opencode/src/session/message-v2.ts +++ b/packages/opencode/src/session/message-v2.ts @@ -516,7 +516,7 @@ export namespace MessageV2 { toolCallId: part.callID, input: part.state.input, output: part.state.time.compacted - ? "[Old tool result content cleared]" + ? { output: "[Old tool result content cleared]", attachments: undefined } : { output: part.state.output, attachments: part.state.attachments }, callProviderMetadata: part.metadata, }) From 232e53109162bbd171d6557e88df899c5e50d930 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Fri, 16 Jan 2026 09:30:52 -0600 Subject: [PATCH 2/6] Revert "stop select dialog event propagation" This reverts commit 46be47d0bea0302ad9fb3005f4a0fbbe73c0f325. --- .../src/cli/cmd/tui/ui/dialog-select.tsx | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx b/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx index d3239ebac6..f7d7306d01 100644 --- a/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx +++ b/packages/opencode/src/cli/cmd/tui/ui/dialog-select.tsx @@ -157,26 +157,10 @@ export function DialogSelect(props: DialogSelectProps) { const keybind = useKeybind() useKeyboard((evt) => { - if (evt.name === "up" || (evt.ctrl && evt.name === "p")) { - evt.preventDefault() - evt.stopPropagation() - move(-1) - } - if (evt.name === "down" || (evt.ctrl && evt.name === "n")) { - evt.preventDefault() - evt.stopPropagation() - move(1) - } - if (evt.name === "pageup") { - evt.preventDefault() - evt.stopPropagation() - move(-10) - } - if (evt.name === "pagedown") { - evt.preventDefault() - evt.stopPropagation() - move(10) - } + if (evt.name === "up" || (evt.ctrl && evt.name === "p")) move(-1) + if (evt.name === "down" || (evt.ctrl && evt.name === "n")) move(1) + if (evt.name === "pageup") move(-10) + if (evt.name === "pagedown") move(10) if (evt.name === "return") { const option = selected() if (option) { From 5385995398957da31009b97c84835789938261f5 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Fri, 16 Jan 2026 10:52:58 -0600 Subject: [PATCH 3/6] fix test --- packages/opencode/src/session/message-v2.ts | 4 +++- packages/opencode/src/session/prompt.ts | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/opencode/src/session/message-v2.ts b/packages/opencode/src/session/message-v2.ts index 8622a6a166..c9afb4906e 100644 --- a/packages/opencode/src/session/message-v2.ts +++ b/packages/opencode/src/session/message-v2.ts @@ -515,8 +515,10 @@ export namespace MessageV2 { state: "output-available", toolCallId: part.callID, input: part.state.input, + // For compacted results, use plain string so SDK serializes as text type + // For normal results, pass object so toModelOutput can convert attachments to media parts output: part.state.time.compacted - ? { output: "[Old tool result content cleared]", attachments: undefined } + ? "[Old tool result content cleared]" : { output: part.state.output, attachments: part.state.attachments }, callProviderMetadata: part.metadata, }) diff --git a/packages/opencode/src/session/prompt.ts b/packages/opencode/src/session/prompt.ts index 663f5660f1..2b49561e66 100644 --- a/packages/opencode/src/session/prompt.ts +++ b/packages/opencode/src/session/prompt.ts @@ -716,7 +716,9 @@ export namespace SessionPrompt { ) return result }, - toModelOutput(result: { output: string; attachments?: MessageV2.FilePart[] }) { + toModelOutput(result: string | { output: string; attachments?: MessageV2.FilePart[] }) { + // Handle compacted results (plain string) + if (typeof result === "string") return { type: "text", value: result } if (!result.attachments?.length) return { type: "text", value: result.output } return { type: "content", @@ -814,7 +816,9 @@ export namespace SessionPrompt { content: result.content, // directly return content to preserve ordering when outputting to model } } - item.toModelOutput = (result: { output: string; attachments?: MessageV2.FilePart[] }) => { + item.toModelOutput = (result: string | { output: string; attachments?: MessageV2.FilePart[] }) => { + // Handle compacted results (plain string) + if (typeof result === "string") return { type: "text", value: result } if (!result.attachments?.length) return { type: "text", value: result.output } return { type: "content", From 5f52abf0907aa779be7290104ab79d06f9668f04 Mon Sep 17 00:00:00 2001 From: Github Action Date: Fri, 16 Jan 2026 17:43:00 +0000 Subject: [PATCH 4/6] Update node_modules hash (aarch64-linux) --- nix/hashes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/hashes.json b/nix/hashes.json index 29a102ae66..cb1c49a961 100644 --- a/nix/hashes.json +++ b/nix/hashes.json @@ -1,7 +1,7 @@ { "nodeModules": { "x86_64-linux": "sha256-07XxcHLuToM4QfWVyaPLACxjPZ93ZM7gtpX2o08Lp18=", - "aarch64-linux": "sha256-E6lyYFApS1cw3jE7ISx5QZxDDJ9V3HU0ICYFdY+aIBw=", + "aarch64-linux": "sha256-0Im52dLeZ0ZtaPJr/U4m7+IRtOfziHNJI/Bu/V6cPho=", "aarch64-darwin": "sha256-U2UvE70nM0OI0VhIku8qnX+ptPbA+Q/y1BGXbFMcyt4=", "x86_64-darwin": "sha256-LxBsYdq5AzInQJzF89taXvS2vigew5C5hjaIEH8rTb8=" } From d65f09b82a8e3eb42cb5ff11666c2fd2f37fa053 Mon Sep 17 00:00:00 2001 From: Aiden Cline Date: Fri, 16 Jan 2026 11:45:55 -0600 Subject: [PATCH 5/6] test: fix test --- .../opencode/test/session/message-v2.test.ts | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/opencode/test/session/message-v2.test.ts b/packages/opencode/test/session/message-v2.test.ts index f069f6ba68..9caa0d8520 100644 --- a/packages/opencode/test/session/message-v2.test.ts +++ b/packages/opencode/test/session/message-v2.test.ts @@ -297,7 +297,23 @@ describe("session.message-v2.toModelMessage", () => { type: "tool-result", toolCallId: "call-1", toolName: "bash", - output: { type: "text", value: "ok" }, + output: { + type: "json", + value: { + attachments: [ + { + id: "file-1", + sessionID: "session", + messageID: "m-assistant", + type: "file", + mime: "image/png", + filename: "attachment.png", + url: "https://example.com/attachment.png", + }, + ], + output: "ok", + }, + }, providerOptions: { openai: { tool: "meta" } }, }, ], From 9017e063ca1747c1e32930739baf16f102352007 Mon Sep 17 00:00:00 2001 From: Github Action Date: Fri, 16 Jan 2026 17:47:42 +0000 Subject: [PATCH 6/6] Update node_modules hash (x86_64-darwin) --- nix/hashes.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nix/hashes.json b/nix/hashes.json index cb1c49a961..e60c498ffd 100644 --- a/nix/hashes.json +++ b/nix/hashes.json @@ -3,6 +3,6 @@ "x86_64-linux": "sha256-07XxcHLuToM4QfWVyaPLACxjPZ93ZM7gtpX2o08Lp18=", "aarch64-linux": "sha256-0Im52dLeZ0ZtaPJr/U4m7+IRtOfziHNJI/Bu/V6cPho=", "aarch64-darwin": "sha256-U2UvE70nM0OI0VhIku8qnX+ptPbA+Q/y1BGXbFMcyt4=", - "x86_64-darwin": "sha256-LxBsYdq5AzInQJzF89taXvS2vigew5C5hjaIEH8rTb8=" + "x86_64-darwin": "sha256-grPR/YBqYPEUBks4nQKYe6/9f+9N0Fk9l2L9J6ylWkc=" } }