loopx icon indicating copy to clipboard operation
loopx copied to clipboard

[Bug]: native Windows guided start-goal emits an unrunnable connect command

Open JasonBuildAI opened this issue 1 month ago • 0 comments

Preflight

  • [x] I searched existing issues and discussions for this behavior.
  • [x] This report is not an unpatched security vulnerability.
  • [x] The report and attachments contain no credentials or private/internal material.

Issue origin

Observed or reproduced in a real environment.

LoopX version or commit

265ec9b78bc6ba76ab4dc940973fb98e364d116c (current upstream main). The same command rendering is present in released v1.4.2 and v2.0.0.

Host or runtime surface

Custom or external worker: native Windows PowerShell 7 (PowerShell 7.6.5, Win32NT).

LoopX area

Control plane (goals, todos, quota, scheduler, registry, runtime).

Problem

Impact: a fresh project on native Windows cannot complete the documented shell/custom-runner onboarding path. The README directs that surface to loopx start-goal --guided; for an unconnected project, the generated connect_if_needed step is a required mutation, and nothing after it can proceed until the project is connected. The emitted command therefore blocks project connection, agent identity selection, Todo authoring, and host-loop activation for every new project started through this documented packet path.

The connection command is generated with POSIX backslash line continuations. PowerShell does not treat \ as a line continuation, so it rejects the packet's own copy-ready command before loopx bootstrap starts. The same renderer also uses POSIX single-quote escaping, so a project path or goal text containing an apostrophe is not PowerShell-safe even after the continuation syntax is removed. This is not a display-only issue: the generated string is exposed as guided_transaction.ordered_steps[1].command, recommended_next_step.identity_selection_gate.fresh_agent_registration.connect_if_needed_command, and several command_pack.commands fields that hosts may execute.

Why this is especially important

  • Concrete supported surface: README.md lists loopx start-goal --guided --project . --goal-text "<task>" as the recommended entry for Cursor, shell, or custom runners, while the install guide explicitly supports native Windows PowerShell 7.
  • Real Windows first-run evidence: #6015 is an active native Windows Shell or custom runner first-run report, so this is a used host category rather than a hypothetical platform.
  • Blocking severity: the failure occurs at the first write-bearing guided step and leaves .loopx\registry.json absent. The agent cannot fall through to later onboarding steps, and a model following the packet's instruction to run the canonical command is blocked without a valid alternative.
  • Maintainer precedent: #6121 reported the adjacent problem where loopx connect printed POSIX-only repair commands on native Windows; #6122 fixed that rule. This packet has the same host-runnable-command requirement on the guided onboarding path but still emits POSIX-only continuation syntax.
  • Persistent and released: the generator was present in both v1.4.2 and v2.0.0 source and remains on current main; this is not transient output from a local customization.

Minimal reproduction

On native Windows PowerShell 7, with an empty disposable project:

$project = Join-Path $env:TEMP 'loopx-guided-powershell-empty'
New-Item -ItemType Directory -Force -Path $project | Out-Null

loopx --format json start-goal --guided `
  --project $project `
  --goal-id windows-guided-connect `
  --goal-text 'Verify native PowerShell guided connection' `
  --host-surface codex-app > packet.json

$packet = Get-Content packet.json -Raw | ConvertFrom-Json
$packet.recommended_next_step.identity_selection_gate.fresh_agent_registration.connect_if_needed_command |
  Set-Content connect.ps1
pwsh -NoLogo -NoProfile -File connect.ps1

The generated command is:

cd '<empty-project>'
loopx bootstrap \
  --project . \
  --goal-id windows-guided-connect \
  --objective 'Verify native PowerShell guided connection' \
  --adapter-kind read_only_project_map_v0 \
  --adapter-status connected-read-only

Expected behavior

The command emitted for a PowerShell host parses and runs, connecting the project and creating the project-local registry and Goal state, including when the project path or goal text contains an apostrophe. POSIX output should remain runnable as it is today.

Actual behavior

PowerShell exits 1 before running loopx bootstrap:

ParserError: connect.ps1:3
Line |
   3 |    --project . \
     |      ~
     | Missing expression after unary operator '--'.

.loopx\registry.json is not created. The first line is treated as an incomplete command because the trailing \ is not PowerShell line continuation syntax; the following argument lines are parsed separately.

Sanitized diagnostics

  • PowerShell: 7.6.5, PSEdition=Core, Platform=Win32NT
  • Packet generation exit: 0
  • Generated connect command exit: 1
  • Registry present after the failed command: false
  • No goal content, credentials, local runtime state, or machine-specific paths are included above.

Additional context

  • Related active first-run report: #6015
  • Adjacent host-command fix: #6121 / #6122
  • The affected packet is also the source used by the new-user onboarding closed-loop qualification, where connect_if_needed is the first required transition.

JasonBuildAI avatar Oct 22 '26 12:10 JasonBuildAI