From dda116584b743bff3ff3ef3cf7b66b8166c9da43 Mon Sep 17 00:00:00 2001 From: "opencode-agent[bot]" Date: Fri, 9 Jan 2026 00:16:52 +0000 Subject: [PATCH] Add Array.isArray check before .join() Co-authored-by: rekram1-node --- packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | 3 ++- packages/opencode/src/tool/question.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx index 10e340d7f8..d760bba414 100644 --- a/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/routes/session/index.tsx @@ -1841,8 +1841,9 @@ function Question(props: ToolProps) { const { theme } = useTheme() const count = createMemo(() => props.input.questions?.length ?? 0) - function format(answer?: string[]) { + function format(answer?: string[] | string) { if (!answer?.length) return "(no answer)" + if (!Array.isArray(answer)) return String(answer) return answer.join(", ") } diff --git a/packages/opencode/src/tool/question.ts b/packages/opencode/src/tool/question.ts index c6f0b91599..9e680b4225 100644 --- a/packages/opencode/src/tool/question.ts +++ b/packages/opencode/src/tool/question.ts @@ -15,8 +15,9 @@ export const QuestionTool = Tool.define("question", { tool: ctx.callID ? { messageID: ctx.messageID, callID: ctx.callID } : undefined, }) - function format(answer: Question.Answer | undefined) { + function format(answer: Question.Answer | string | undefined) { if (!answer?.length) return "Unanswered" + if (!Array.isArray(answer)) return String(answer) return answer.join(", ") }