Skip to content

[Bug]: Windows Cursor agent (.cmd) cannot launch with prompt in argv — asks to Remove {prompt} #8793

Open

Description

@lalahuang

Short summary

On Windows, launching Cursor Agent with an initial prompt fails with:

Cursor cannot be run as a Windows batch command with the prompt in argv. Remove {prompt} so Orca sends the prompt on stdin.

Orca blocks startup instead of delivering the prompt. Built-in Cursor uses promptInjectionMode: argv, but the installed CLI resolves to a .cmd shim (agent.cmd / cursor-agent.cmd), so argv prompt injection is rejected.

What happened?

  1. Default TUI agent is Cursor.
  2. Cursor command override points at the Windows installer alias agent (resolves to %LOCALAPPDATA%\cursor-agent\agent.cmd).
  3. Starting a worktree / terminal with an initial prompt (or any path that puts the prompt in argv) shows the error above.
  4. The agent does not start with the intended prompt.

Expected: Orca should still start Cursor on Windows and deliver the prompt (e.g. via stdin-after-start, or by invoking agent.ps1 / cursor-agent.ps1 through PowerShell -File so argv is not mangled by cmd.exe %*).

How can we reproduce it?

  1. On Windows, install Cursor Agent CLI so agent / cursor-agent resolve to .cmd shims under %LOCALAPPDATA%\cursor-agent\.
  2. In Orca, set default agent to Cursor (optionally override command to agent).
  3. Create a worktree or launch Cursor with an initial prompt (automation / worktree --prompt / any UI that injects a startup prompt).
  4. Observe the error: Cursor cannot be run as a Windows batch command with the prompt in argv. Remove {prompt} so Orca sends the prompt on stdin.

Anything else that might help

Activity

  1. added
    has_reproConclusive reproduction exists (test/script/CLI evidence). See docs/bug-reproductions/
    on Jul 16, 2026
  2. OrcaWin commented on Jul 17, 2026

    @OrcaWin
    Collaborator

    Agent reproduction package (Windows orchestration 2026-07-16)

    Host context: Windows 11 / Orca 1.4.143.0 / repo path used: docs/bug-reproductions/
    Labels applied: see issue labels (has_repro or cannot_repro).
    Security: Do not run user-uploaded binaries from issue attachments. Recreate fixtures from the steps/scripts below.


    Issue 8793 — Windows Cursor agent (.cmd) cannot launch with prompt in argv

    Status: repro_confirmed (logic/API) + needs_setup for full UI (Cursor agent.cmd not installed)
    Label: has_repro
    Host: Windows 11; Cursor agent.cmd not present under %LOCALAPPDATA%\cursor-agent

    Summary

    Orca rejects Windows batch shims (.cmd/.bat) when the prompt is delivered via argv/{prompt}:

    <cmd-path> cannot be run as a Windows batch command with the prompt in argv. Remove {prompt} so Orca sends the prompt on stdin.
    

    Source: src/main/text-generation/commit-message-text-generation.ts (+ unit test pin). Cursor Agent on Windows commonly resolves to agent.cmd, while the Cursor preset uses promptInjectionMode: 'argv'.

    Logic repro (another agent)

    # From repo root (Node only; no deps required for this check)
    node docs/bug-reproductions/scripts/repro-8793-cursor-cmd-argv.mjs
    # Or inspect evidence already written:
    Get-ChildItem docs/bug-reproductions/evidence/8793-*.json | Sort-Object LastWriteTime | Select-Object -Last 1

    Confirmed behavior matrix:

    Path Delivery Result
    agent.cmd argv Rejected with error string
    agent.cmd stdin Allowed
    agent.exe argv Allowed

    Full UI repro (needs Cursor Agent CLI)

    1. Install Cursor Agent so agent / cursor-agent resolves to %LOCALAPPDATA%\cursor-agent\agent.cmd.
    2. Orca Settings: default TUI agent = Cursor; optional override command = agent.
    3. Create worktree / launch with an initial prompt.
    4. Observe the error and no agent start with prompt.

    Evidence

    • docs/bug-reproductions/evidence/8793-*.json (bugLogicConfirmed: true)

    Repro script: repro-8793-cursor-cmd-argv.mjs

    /**
     * Repro / unit-level confirmation for https://github.com/stablyai/orca/issues/8793
     *
     * The exact user-facing error string lives in commit-message text generation when
     * a Windows `.cmd` agent path is used with `{prompt}` / argv delivery.
     *
     * This script:
     * 1. Greps the source for the error factory
     * 2. Re-implements the batch-script + argv guard logic
     * 3. Optionally runs the vitest that already pins the error string
     *
     * Usage (repo root):
     *   node docs/bug-reproductions/scripts/repro-8793-cursor-cmd-argv.mjs
     */
    
    import { spawnSync } from 'node:child_process'
    import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'
    import { dirname, join } from 'node:path'
    import { fileURLToPath } from 'node:url'
    
    const __dirname = dirname(fileURLToPath(import.meta.url))
    const repoRoot = join(__dirname, '..', '..', '..')
    const evidenceDir = join(__dirname, '..', 'evidence')
    mkdirSync(evidenceDir, { recursive: true })
    const stamp = new Date().toISOString().replace(/[:.]/g, '-')
    const logPath = join(evidenceDir, `8793-${stamp}.log`)
    const lines = []
    const log = (m) => {
      const line = `[${new Date().toISOString()}] ${m}`
      lines.push(line)
      console.log(line)
    }
    
    function isWindowsBatchScript(commandPath) {
      return process.platform === 'win32' && /\.(cmd|bat)$/i.test(commandPath)
    }
    
    function windowsBatchArgvPromptError(label) {
      return `${label} cannot be run as a Windows batch command with the prompt in argv. Remove {prompt} so Orca sends the prompt on stdin.`
    }
    
    // Mirror of the guard used by commit-message path
    function wouldReject(commandPath, promptDelivery) {
      if (promptDelivery === 'argv' && isWindowsBatchScript(commandPath)) {
        return windowsBatchArgvPromptError(commandPath)
      }
      return null
    }
    
    log('=== Issue 8793: Windows .cmd + argv prompt rejected ===')
    log(`platform=${process.platform}`)
    
    const src = join(repoRoot, 'src/main/text-generation/commit-message-text-generation.ts')
    const testSrc = join(repoRoot, 'src/main/text-generation/commit-message-text-generation.test.ts')
    log(`source exists: ${existsSync(src)}`)
    const body = readFileSync(src, 'utf8')
    const hasError = body.includes('cannot be run as a Windows batch command with the prompt in argv')
    log(`error factory present: ${hasError}`)
    
    const cases = [
      { path: 'C:/Users/me/AppData/Local/cursor-agent/agent.cmd', delivery: 'argv' },
      { path: 'C:/Users/me/AppData/Local/cursor-agent/agent.cmd', delivery: 'stdin' },
      { path: 'C:/tools/cursor-agent.exe', delivery: 'argv' },
      { path: 'agent', delivery: 'argv' }
    ]
    
    const caseResults = cases.map((c) => ({
      ...c,
      error: wouldReject(c.path, c.delivery)
    }))
    for (const c of caseResults) {
      log(`path=${c.path} delivery=${c.delivery} -> ${c.error ?? '(allowed)'}`)
    }
    
    // Confirm vitest still pins this behavior (may take a bit)
    log('Running focused vitest (may take ~1-2 min)...')
    const vt = spawnSync(
      process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm',
      [
        'exec',
        'vitest',
        'run',
        'src/main/text-generation/commit-message-text-generation.test.ts',
        '-t',
        'Windows batch'
      ],
      { cwd: repoRoot, encoding: 'utf8', shell: true, timeout: 180000 }
    )
    log(`vitest status=${vt.status}`)
    if (vt.stdout) log(vt.stdout.slice(-2000))
    if (vt.stderr) log(vt.stderr.slice(-1000))
    
    // Host PATH check for real Cursor agent
    const which = spawnSync('where.exe', ['agent.cmd'], { encoding: 'utf8', shell: true })
    const cursorAgentCmd = (which.stdout || '').trim().split(/\r?\n/).filter(Boolean)
    log(`where agent.cmd: ${cursorAgentCmd.join(' | ') || '(none)'}`)
    const localApp = join(process.env.LOCALAPPDATA || '', 'cursor-agent')
    log(`%LOCALAPPDATA%\\cursor-agent exists: ${existsSync(localApp)}`)
    
    const bugLogicConfirmed =
      hasError &&
      caseResults[0].error !== null &&
      caseResults[1].error === null &&
      caseResults[2].error === null
    
    const out = {
      issue: 8793,
      stamp,
      bugLogicConfirmed,
      fullUiRepro: cursorAgentCmd.length > 0,
      caseResults,
      vitestStatus: vt.status,
      cursorAgentCmd,
      log: logPath,
      note:
        'Logic-level repro: Orca intentionally rejects .cmd + argv prompt. Full UI repro needs Cursor agent.cmd install + worktree --prompt.'
    }
    
    writeFileSync(join(evidenceDir, `8793-${stamp}.json`), JSON.stringify(out, null, 2))
    writeFileSync(logPath, lines.join('\n'))
    log(`bugLogicConfirmed=${bugLogicConfirmed}`)
    process.exit(bugLogicConfirmed ? 0 : 2)

    How another agent should use this

    1. Read this comment fully (status, expected vs actual, blockers).
    2. If a script is included above, copy it to a temp file and run it on a Windows 11 host with Orca installed (prefer production install under %LOCALAPPDATA%\Programs\orca).
    3. Capture evidence (CLI --json, screenshots, logs) under a local folder; optionally comment results back here.
    4. If status is cannot_repro / needs_setup, satisfy the listed prerequisites first, then re-attempt and flip labels: remove cannot_repro, add has_repro when conclusive.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghas_reproConclusive reproduction exists (test/script/CLI evidence). See docs/bug-reproductions/os:Windows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions