Skip to content

tower-cron runs task commands through cmd.exe on Windows instead of commandLaunch (Git Bash) #1930

Open

Description

@amrmelsayed

Problem

tower-cron.ts runs each cron task's command with raw child_process.exec. On native Windows that is cmd.exe /d /s /c. Every other shell-string call site goes through commandLaunch(), whose Windows implementation runs shell strings in the resolved Git Bash and never in cmd.exe (Spec 1658; packages/codev/src/lib/platform/windows/command-launch.ts).

So a cron task that adopters write the normal POSIX way (single quotes, $(…), && chains with POSIX tools) works on macOS/Linux and breaks on Windows. #1921 fixed the two shipped ci-health tasks by switching to quoting both shells accept, and documented the cmd.exe caveat. It did not change the shell, so the trap remains for user-written tasks. With an exitCode == 0 condition the failure now only logs a WARN, which means a broken task can go unnoticed.

Cause

runCommand() in packages/codev/src/agent-farm/servers/tower-cron.ts calls exec() directly. commandLaunch().execShellString returns stdout and throws on a non-zero exit. Cron needs the exit code (and the output of a failed run) as data for condition, so it cannot use that method as it stands.

Fix shape

  1. Add a commandLaunch method that runs a shell string and returns { output, exitCode } without throwing on a non-zero exit (timeout/kill still distinguishable), with the Git Bash branch on Windows and /bin/sh elsewhere.
  2. Route tower-cron's runCommand through it, keeping sanitizeAgentEnv, cwd, timeout, maxBuffer.
  3. Keep the window hidden (windows: console window flashes while an agent works in a VS Code terminal (unhidden child-process spawns) #1919).
  4. Update the cron docs paragraph added in cron: CI Health Check sends a false 'CI failing' alert on Windows (cmd.exe quoting, condition ignores exit code) #1921: commands run in a POSIX shell on every platform.

It is a cross-platform API change, so it may warrant more than BUGFIX.

Acceptance

Related: #1921 (shipped tasks + docs, PR #1929), #1919 (hides the cmd.exe window cron opens).

Activity

  1. added
    area/tower
    on Nov 18, 2026
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

    area/tower

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions