clarify_user duplicate question ids can overwrite answers
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
Research direction
Look for the clarify_user function and its handling of question IDs, likely in a file related to the TUI or user interaction. The bug is in a Map storing answers by ID. Find the test mentioned to understand the expected behavior. The fix involves validating IDs for uniqueness and generating defaults for omitted ones. Run the core questionnaire regression test to verify the fix.
Written by the indexing model from the issue text.
Description
What happened?
clarify_user accepts duplicate question IDs, but the native TUI stores answers in a Map<id, answer>. Two questions with the same ID therefore share one answer slot.
After answering the first duplicate ID, allAnswered() also sees the second question as answered, so the dialog can submit early and the final result contains only one answer. I reproduced this on clean main @ adcf37b in a core questionnaire regression test, without external extensions.
I have a local fix and tests ready: explicit duplicate IDs are rejected, while omitted IDs keep deterministic q1/q2/... defaults and avoid collisions with explicit IDs. I would like to submit a PR if this behavior is preferred.
Steps to reproduce
- Call
clarify_userwith two questions using the same ID:{ "questions": [ { "id": "x", "question": "First?", "options": [{ "label": "A", "value": "a" }] }, { "id": "x", "question": "Second?", "options": [{ "label": "B", "value": "b" }] } ] } - Answer the first question.
- Switch to the submit tab.
- The dialog considers both questions answered and can return only one answer for ID
x.
Expected behavior
Question IDs used as answer keys should be unique. Explicit duplicate IDs should not silently overwrite answers; omitted IDs may be generated deterministically.
Version
main @ adcf37b / @step-harness/coding-agent 0.84.4
- Dominant language
- TypeScript
- Stars
- 54
- Forks
- 20
- Avg merge
- 4h 1m
- Merged PRs (30d)
- 12
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from stepfun-ai/Step-Code
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#190 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#186 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#185 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#179 · 1 comment ·
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
stepfun-ai/Step-Code#153 · 2 comments ·
All issues in stepfun-ai/Step-Code
Similar issues
-
bug(cli): hapi doctor inline-media prints a fabricated B:\ helper-script path in packaged installs Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Crush Open
Difficulty 1/5 Under an hour Newbie friendliness 85/100
catppuccin/catppuccin#3125 ·
-
Add a SECURITY.md Open
Difficulty 1/5 Under an hour Newbie friendliness 90/100
ElementsProject/cln-application#167 · 1 comment · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Quantco/pnpm-licenses#17 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100