fix: auto-truncate question option labels exceeding 30 characters

When AI generates AskUserQuestion tool calls with option labels longer
than 30 characters, opencode validation rejects them with "too_big" error.

This fix adds a pre-tool-use hook that automatically truncates labels
to 30 characters (with "..." suffix) before the validation occurs.

Fixes the error:
"The question tool was called with invalid arguments: expected string
to have <=30 characters"

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
yimingll
2026-01-22 10:23:41 +08:00
committed by justsisyphus
parent eef98e27f2
commit 4311e5b264
3 changed files with 68 additions and 0 deletions
+1
View File
@@ -30,3 +30,4 @@ export { createTaskResumeInfoHook } from "./task-resume-info";
export { createStartWorkHook } from "./start-work";
export { createAtlasHook } from "./atlas";
export { createDelegateTaskRetryHook } from "./delegate-task-retry";
export { createQuestionLabelTruncatorHook } from "./question-label-truncator";