Skip to content

fix(proxy): send ask_followup_question questions as array, not string - #1108

Open
Hughhhhcoder wants to merge 1 commit into
TencentCloud:feat/server_teamfrom
Hughhhhcoder:fix/codebuddy-followup-questions-array
Open

fix(proxy): send ask_followup_question questions as array, not string#1108
Hughhhhcoder wants to merge 1 commit into
TencentCloud:feat/server_teamfrom
Hughhhhcoder:fix/codebuddy-followup-questions-array

Conversation

@Hughhhhcoder

Copy link
Copy Markdown

Problem

Fixes #1101.

CodeBuddy's ask_followup_question tool schema requires the questions parameter to be an array. However MemoryProxy/src/session/codebuddy/form.ts's buildFollowupQuestionArgs() wraps the question list with JSON.stringify(), producing:

{"title":"...","questions":"[{\"id\":\"team\",...}]"}

Newer CodeBuddy clients reject this tool call with:

Error calling tool: Tool call arguments for ask_followup_question were invalid:
invalid argument type for questions, expected array, received string

As a result the session-init form never renders, the user cannot pick an agent/task, retries exhaust (asset-confirm max retries, abandoning), and the whole conversation bypasses the memory pipeline.

Root cause

The only CodeBuddy form builder stringifies questions, while every other client form builder (claude-code, codex, dsh, workbuddy) already emits questions as a real array (e.g. return { questions } / JSON.stringify({ questions })).

Fix

  • Return the questions array directly from buildFollowupQuestionArgs().
  • Introduce a FollowupQuestion interface and type the downstream response builders (OpenAI/Anthropic, streaming and non-streaming) with questions: FollowupQuestion[] instead of questions: string.

Verification

  • tsc --noEmit — no new type errors in src/session/codebuddy/ (remaining errors are pre-existing and unrelated).
  • Runtime check via buildFormResponse() for OpenAI non-streaming / OpenAI streaming / Anthropic non-streaming: questions is now serialized as a JSON array in all three paths.
{"title":"...","questions":[{"id":"team","question":"...","options":["OTA-Platform (h45wed8k)"],"multiSelect":false}]}

CodeBuddy's ask_followup_question tool schema requires the questions
parameter to be an array. buildFollowupQuestionArgs() was wrapping the
questions list in JSON.stringify(), producing a JSON string like
{"title":"...","questions":"[...]"}. Newer CodeBuddy clients reject the
tool call with 'invalid argument type for questions, expected array,
received string', which aborts session-init and bypasses the memory
pipeline.

Return the questions array directly and type the downstream response
builders (OpenAI/Anthropic, streaming and non-streaming) accordingly.
The other client form builders (claude-code, codex, dsh, workbuddy)
already emit questions as a real array; this aligns CodeBuddy with them.

Signed-off-by: HughChaw <146055770+Hughhhhcoder@users.noreply.github.com>
@Maxwell-Code07

Copy link
Copy Markdown
Collaborator

Thank you so much for your attention and contribution! We will arrange an internal review for this PR shortly, and all feedback will be shared right here in the discussion.

@Hughhhhcoder

Copy link
Copy Markdown
Author

Thanks for the quick update and for queueing the internal review — much appreciated. I’ll keep an eye on this thread and am happy to make any follow-up changes promptly once feedback comes in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] CodeBuddy 接入时 session-init 表单无法渲染:ask_followup_question 参数 questions 应为数组却发送为字符串

2 participants