Skip to content

validate_candidate hardcodes /bin/sh, breaks all validation gates on Windows (WinError 2) #11

Closed

Description

@Gotens

auto-re-agent 0.3.0, Windows 11, Python 3.12. Every configured build/test/runtime validation command fails with [WinError 2] because verification/candidate.py runs them via ["/bin/sh", "-lc", expanded], which does not exist on Windows. Local workaround: platform-branch to ["cmd", "/d", "/s", "/c", expanded] when os.name == "nt" (same idiom process.py already uses for start_new_session). Happy to PR this if wanted.

Activity

  1. Gotens commented on Sep 9, 2026

    @Gotens
    Author

    Follow-up on Windows validation: second half of the same bug. _expand_shell() always emits POSIX ${VAR} placeholders, so under cmd.exe the candidate path arrives literally (cl reports D9024/D9027, compiles nothing, exit 0 -> false PASS, worse than failing). Fix: emit %VAR% when os.name == nt. With both patches, validation gates run for real on Windows.

  2. Gotens commented on Sep 9, 2026

    @Gotens
    Author

    Windows validation now fully green locally with two minimal patches (shell branch + bare %VAR% expansion, details in issue). Verified: checker PASS + objective PASS + real cl compile gate PASS + parity green on a sample function. The quoting trap is worth fixing upstream alongside the shell one: nested Popen-list2cmdline + cmd /s turns quoted placeholders into literal single-quoted filespecs, and cl exit 0 on ignored files makes it a silent false PASS (worse than failing).

  3. Dryxio commented on Sep 9, 2026

    @Dryxio
    Owner

    Thanks for the report and the follow-up on placeholder handling. Native Windows validation is supported in v0.4.0, now published to PyPI, through the argument-array commands added in #12.

    python -m pip install --upgrade "auto-re-agent>=0.4.0"

    Please migrate build/test/runtime command strings to arrays. For example, from a Visual Studio Developer Command Prompt with cl available:

    validation:
      build_commands:
        - [cl, /nologo, /c, "{candidate_file}", "/Fo{overlay_root}/candidate.obj"]
      require_build: true
      trust_configured_commands: true

    Arrays execute directly, and {candidate_file}, {overlay_root}, and {source_file} expand into argument values, including paths with spaces. Do not add shell quotes inside array values. Arrays do not expand %VAR%, $VAR, pipes, or other shell syntax. Existing string commands retain POSIX /bin/sh behavior; doctor reports when that shell is unavailable.

    Windows Python 3.12 CI passed with 193 tests passing and six skipped; Linux, macOS, lint, and package checks also passed. This is CI coverage of the portable command path, not a replay of your exact MSVC project.

    If an AI agent handles your setup, it should detect the environment and perform this migration as part of its normal setup workflow; no Windows-specific user prompt is required. The setup-agent instructions now make this explicit. The ReAgent runner does not itself rewrite existing configurations.

    Closing as resolved in the published release. Migration documentation.

  4. Gotens commented on Sep 11, 2026

    @Gotens
    Author

    Verified on 0.4.0: migrated our validation to array form (cmd /d /s /c compile-check.bat + placeholder), local patches removed by upgrade. Trial shows objective PASS + real cl compile gate PASS + parity green. Thanks for the fast turnaround.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions