Skip to content

The question tool accepts an empty question list and then answers or hangs #792

Closed

Description

What happens

QuestionTool.execute validates the question list with:

const invalid = params.questions.find(
  (question) => question.options.length < 2 || !question.options[0]?.label.endsWith("(Recommended)"),
)
if (invalid) throw new Error("Planning and consequential questions need at least two concrete choices, ...")

Array.prototype.find on an empty array returns undefined, so questions: [] passes the only guard. The tool then takes one of two wrong paths, depending on autonomy:

Autonomous / balanced-planning — recommendedResolution maps over an empty list:

title:  "Continued with 0 recommended choices"
output: "OpenScience continued without pausing. Assumption recorded: ."
metadata: { answers: [], assumptions: [] }

The model is told an assumption was recorded when none was, and the trailing Assumption recorded: . is a visibly broken sentence it has to reason about.

Interactive — Question.ask({ questions: [] }) publishes a question.asked event carrying zero questions and returns a promise that only settles on a UI reply or an abort. The turn stalls on a card with nothing to answer until the user interrupts.

Why it is wrong

Both outcomes misreport what happened. One invents a decision, the other blocks the turn indefinitely. Either way the model believes something false about the state of its own run, and neither mentions that no question was asked.

Reproduction

const tool = await QuestionTool.init()
await tool.execute({ reason: "consequential", questions: [] }, ctx)
// resolves, instead of throwing
await tool.execute(
  { reason: "consequential", questions: [] },
  { ...ctx, extra: { delegationSettings: { level: "standard", autonomy: "autonomous" } } },
)
// -> "OpenScience continued without pausing. Assumption recorded: ."

The existing suite covers valid input, planning, balanced, autonomous, missing-authority, and the fail-closed recommended-choice rule, but never an empty array.

Suggested fix

Refuse an empty list at the top of execute, before the recommended-choice guard, with a message written for the model in the same style as the existing throw.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions