Conversation
|
| const questionItemSchema = z.object({ | ||
| id: z | ||
| .string() | ||
| .optional() | ||
| .describe("Optional unique identifier for this question (e.g. 'choice_format' or 'framework')"), |
There was a problem hiding this comment.
Duplicate question IDs break answers
The schema allows repeated question IDs, including an explicit ID that can collide with a generated q_<index> fallback. The card then uses each ID as both a Svelte list key and the key for its answer state. A call with duplicate IDs can fail to render or make separate questions share selections, preventing the user from answering them independently. Please enforce uniqueness after fallback IDs are assigned.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/agent/tools/askQuestion.ts
Line: 10-14
Comment:
**Duplicate question IDs break answers**
The schema allows repeated question IDs, including an explicit ID that can collide with a generated `q_<index>` fallback. The card then uses each ID as both a Svelte list key and the key for its answer state. A call with duplicate IDs can fail to render or make separate questions share selections, preventing the user from answering them independently. Please enforce uniqueness after fallback IDs are assigned.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Gives the agent the ability to ask interactive multiple-choice questions for clarification.