Skip to content

[Bug] Invoking /opsx-new in Factory Droid returns error #717

Closed

Description

@michal-grzelak

Problem

Running /opsx-new in Factory Droid agent returns error. First it returns:

 ASK USER
   Error: Invalid AskUser questionnaire format at line 1: Unexpected line. Expected [question], [topic], or
   [option]. Remove headers or code fences.

Then directly another one:

ASK USER
   Error: Invalid AskUser questionnaire format at line 1: [question] must have 2-10 [option] lines (got 0)

What I tried

Things I tried, but didn't help:

  • removing all commands, skills and rerunning openspec init
  • running openspec update

Info

Used OpenSpec version 1.1.1.

Activity

  1. 21st-connector commented on Feb 17, 2026

    @21st-connector
    Contributor

    Task completed.

    The enrichment comment has been posted on issue #717. Here's a summary of the findings:

    Root cause: The Factory Droid adapter (src/core/command-generation/adapters/factory.ts) passes command body content through without any transformation. The command templates contain natural-language instructions like Use the **AskUserQuestion tool**..., but Factory Droid has its own native AskUser parser that expects a bracket-based format ([question], [option], [topic]). When the AI agent tries to ask the user a question, Factory Droid's parser fails because it receives markdown text instead of its bracket syntax.

    Key issue: Open-ended questions (no preset options) are fundamentally incompatible with Factory Droid's questionnaire model, which requires 2-10 [option] lines per [question].

    Scope: This likely affects all 8 workflow commands that reference AskUserQuestion, not just /opsx-new.

    The comment includes specific file references, potential fix approaches, and links to related issues (#232, #259).


    View full conversation

    Powered by 1Code

  2. 21st-connector commented on Feb 17, 2026

    @21st-connector
    Contributor

    Issue Analysis

    Root Cause

    The error originates from Factory Droid's own AskUser parser, which expects a bracket-based questionnaire format ([question], [option], [topic]), but the generated command file contains a natural-language instruction to use the AskUserQuestion tool instead.

    When Factory Droid encounters Step 1 of the /opsx-new command, the AI agent attempts to invoke Factory Droid's native ASK USER feature. Factory Droid then tries to parse the agent's output as its own bracket-based questionnaire format and fails because the output doesn't conform.

    What the template instructs the agent to do (in .factory/commands/opsx-new.md):

    Use the **AskUserQuestion tool** (open-ended, no preset options) to ask:
    > "What change do you want to work on? Describe what you want to build or fix."
    

    What Factory Droid's parser expects:

    [question]
    What change do you want to work on?
    [option]
    Option A
    [option]
    Option B
    

    The two error messages confirm this:

    1. "Unexpected line. Expected [question], [topic], or [option]. Remove headers or code fences." — the parser received markdown-formatted text instead of bracket syntax
    2. "[question] must have 2-10 [option] lines (got 0)" — no [option] lines were found because the format is completely different

    Relevant Code

    Affected Commands

    This bug likely affects all commands that reference AskUserQuestion, not just /opsx-new. The following workflow templates contain AskUserQuestion references:

    • new-change.ts (/opsx-new)
    • continue-change.ts (/opsx-continue)
    • archive-change.ts (/opsx-archive)
    • ff-change.ts (/opsx-ff)
    • bulk-archive-change.ts (/opsx-bulk-archive)
    • verify-change.ts (/opsx-verify)
    • sync-specs.ts (/opsx-sync)
    • apply-change.ts (/opsx-apply)

    Potential Approaches

    1. Add a body transformation in the Factory adapter — Similar to how opencode.ts transforms command references, factory.ts could transform AskUserQuestion tool references into Factory Droid's native bracket-based [question]/[option] syntax. This keeps the templates tool-agnostic while making the output Factory Droid-compatible.

    2. Remove or rephrase the AskUserQuestion instruction — Replace tool-specific references with more generic phrasing that doesn't trigger Factory Droid's AskUser parser (e.g., "Ask the user what they want to build"). This would be simpler but may reduce the quality of the interaction in tools that do support a structured AskUser tool.

    3. Hybrid approach — Keep templates as-is but add a Factory-specific transformation utility (similar to transformToHyphenCommands) that converts AskUserQuestion references to Factory Droid's questionnaire format, or strips them if open-ended questions aren't supported in the bracket format (which requires 2-10 options).

    Related Issues

    Additional Notes

    • The open-ended question format (no preset options) is particularly problematic because Factory Droid requires 2-10 [option] lines per [question]. An open-ended prompt with no options is fundamentally incompatible with Factory Droid's questionnaire model.
    • The $ARGUMENTS placeholder mentioned in the archived Factory Droid spec is not being injected into the command body, which may also contribute to the agent needing to ask the user for input rather than receiving it via arguments.
  3. added a commit that references this issue on Jul 27, 2026
    5bcf057
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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions