Skip to content

clarify_user duplicate question ids can overwrite answers #184

Description

@quifox

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

  1. Call clarify_user with 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" }] }
      ]
    }
  2. Answer the first question.
  3. Switch to the submit tab.
  4. 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

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/toolssrc/toolsbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions