Skip to content

fix(ask): require multiSelect in schema and add desktop multi-select badge / 修复 ask 多选只能单选的问题 - #7792

Open
JesonChou wants to merge 1 commit into
esengine:main-v2from
JesonChou:fix/multi-select-ask-7649
Open

fix(ask): require multiSelect in schema and add desktop multi-select badge / 修复 ask 多选只能单选的问题#7792
JesonChou wants to merge 1 commit into
esengine:main-v2from
JesonChou:fix/multi-select-ask-7649

Conversation

@JesonChou

@JesonChou JesonChou commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix #7649

When the ask tool presented a multi-pick question, the desktop UI appeared to accept multiple selections but actually replaced each pick with the last — silently restricting the user to a single choice. This happened because multiSelect was optional in the schema and the model frequently omitted it.

Root causes

  • multiSelect was not required. The tool schema's question-level required array listed only ["question","header","options"], so the model could legally omit multiSelect. When omitted, Go defaulted it to false and the frontend received undefined (falsy), which triggered the single-select replace branch in toggleOption:

    { ...sel, [question.id]: [label] } ← replaces the entire selection

  • No visual indication. The desktop AskCard had no checkbox, badge, or label telling the user whether the current question was multi-select or single-select.

Changes

File Change
internal/agent/ask.go Add multiSelect to the question-level required array; strengthen Description and field description to warn about consequences of omission
desktop/frontend/src/components/AskCard.tsx Render a "可多选" / "Multi-select" badge in the header when q.multi is true
desktop/frontend/src/locales/zh.ts Add "ask.multiSelectBadge": "可多选"
desktop/frontend/src/locales/en.ts Add "ask.multiSelectBadge": "Multi-select"
desktop/frontend/src/locales/zh-TW.ts Add "ask.multiSelectBadge": "可多選"
internal/agent/ask_test.go Update provider contract hash after schema change
internal/boot/testdata/golden/* Regenerate baseline files (system_prompt, tool_schemas, provider_request, prefix_shape)

Verification

Automated

  • gofmt -l → OK
  • go vet ./internal/agent/ → OK
  • go test ./internal/agent/ -run Ask → 11/11 PASS
  • go test ./internal/boot/ -count=1 → PASS

Manual (desktop)

  • Confirmed multi-select AskCard shows the badge when multiSelect: true.
  • Confirmed multi-select toggleOption accumulates picks correctly.
  • Confirmed single-select badge is absent.

Compatibility

Area Existing-data behavior Conclusion
ask tool schema multiSelect was optional; now required — model must always provide a boolean Backward-compatible (existing calls that omit multiSelect will now fail validation; the model learns the new schema immediately)
Desktop i18n New ask.multiSelectBadge keys added to three locale files Backward-compatible (new keys, no existing references)
Golden baselines Regenerated to match new Description and schema Expected drift, no functional impact

Cache impact

Cache-impact: high — ask tool schema and description changed; golden system_prompt.txt, tool_schemas.json, provider_request.json, and prefix_shape.json all drift. The model-facing prompt prefix will change on the first turn after this merges.

Cache-guard: go test ./internal/agent/ -run Ask -count=1, go test ./internal/boot/ -count=1

System-prompt-review: @esengine — schema required-array change and tool description increase prompt token count slightly; verify prefix cache budget.

…badge (esengine#7649)

Problem: The ask tool's `multiSelect` parameter was optional. The model
frequently omitted it when the question required multiple selections.
When `multiSelect` was missing, the desktop AskCard's toggleOption would
replace each pick (single-select branch) instead of accumulating them,
silently restricting the user to a single choice. The UI also lacked any
visual indicator of whether multi-select was active.

Root cause: `multiSelect` was not in the schema required list, so
models were free to omit it — producing `false` in Go and `undefined`
(falsy) in the frontend. Every subsequent selection replaced the
previous one via:

  { ...sel, [question.id]: [label] }  // single-select: replace all

Fix:
- agent/ask.go: add `multiSelect` to the question-level required array.
- agent/ask.go: strengthen the Description and field description to
  warn that omitting `multiSelect: true` silently restricts picks.
- AskCard.tsx: render a multi-select badge next to the header.
- zh.ts / zh-TW.ts / en.ts: add `ask.multiSelectBadge` i18n keys.
- ask_test.go: update provider contract hash after schema change.
- golden/*: regenerate baselines to match the new tool description.

Verification:
- gofmt -l → OK
- go vet ./internal/agent/ → OK
- go test ./internal/agent/ -run Ask → 11/11 PASS
- go test ./internal/boot/ -count=1 → PASS

Cache-impact: high — ask tool schema and description changed;
golden system_prompt.txt, tool_schemas.json, provider_request.json,
and prefix_shape.json all drift.
System-prompt-review: @esengine — schema required-array change and
tool description increase prompt token count slightly; verify prefix
cache budget.
@github-actions github-actions Bot added the v2 Go rewrite (1.x) — main-v2 branch, active development label Aug 6, 2026
@zhefengzhang

Copy link
Copy Markdown

@SivanCola

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

Labels

v2 Go rewrite (1.x) — main-v2 branch, active development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: 多选选项不是真的多选,只能单选

2 participants