Skip to content

fix(step): include installer output in update failure messages - #277

Open
li-xiu-qi wants to merge 1 commit into
stepfun-ai:mainfrom
li-xiu-qi:fix/update-installer-output
Open

li-xiu-qi wants to merge 1 commit into
stepfun-ai:mainfrom
li-xiu-qi:fix/update-installer-output

Conversation

@li-xiu-qi

@li-xiu-qi li-xiu-qi commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #276

Problem

When step update runs from the TUI and the installer script exits non-zero,
the only error shown is install.ps1 exited with code 1 — no installer
output, so users cannot see why the installer failed and cannot file an
actionable report.

Two things cause this in packages/coding-agent/src/step/local-update.ts:

  • installLatestStepRelease builds the failure message from the exit code
    alone; the installer's stdout/stderr are never captured.
  • runCommand spawns the installer with stdio: "inherit", but the TUI
    renders full-screen, so the child's output is overwritten before the user
    can read it.

Changes

  • runCommand now pipes and captures the child's stdout/stderr instead of
    inheriting them, returning { code, output }.
  • New formatInstallerFailure(scriptName, code, output) builds the failure
    message with the tail of the captured output (last 20 lines, noting how
    many earlier lines were omitted).
  • installLatestStepRelease uses it for the non-zero-exit message.

Behavior and compatibility

  • runCommand is module-private with a single caller
    (installLatestStepRelease); no other call sites.
  • No changes to public interfaces, configuration keys, CLI arguments,
    persisted sessions, or provider responses.
  • Installer output is no longer passed through to the parent terminal. This
    function only runs in the TUI update path (maybeUpdateStep's
    installUpdate default), where inherited output was already invisible
    under the full-screen render — so there is no visible-output regression.
    The CLI step update command takes the archive path
    (runStepUpdateCommand) and does not go through this function.
  • The success message is unchanged (Updated Step in …).

Validation

  • New tests in local-update.test.ts: three for formatInstallerFailure
    (no output / short output / long-output tail truncation) and one
    end-to-end test that mocks the installer download with a failing script,
    spawns it for real, and asserts the failure message contains the
    installer's output.
  • vitest run src/step/local-update.test.ts — 8/8 pass (4 pre-existing
    findArchiveRoot tests + 4 new).
  • A standalone script driving installLatestStepRelease with a mocked
    failing installer (real powershell/bash spawn) confirms the message
    content: the fixed code embeds the installer output, the pre-fix code
    shows the bare exit code only.
  • npm run check — all green (biome, tsgo with zero errors, repo check
    scripts).
  • Verified on Windows 11 x64.

Limitations

  • Installer output on success is no longer echoed to the terminal. Under
    the TUI it was never visible; if a future CLI path reuses this function,
    pass-through would need revisiting.

When the installer script (install.ps1 / install.sh) exits non-zero during
a TUI update, the failure message only contained the exit code, leaving
users unable to see why the installer failed. Capture the installer's
stdout/stderr in runCommand and append the tail to the failure message.

- runCommand now pipes and captures child output instead of inheriting
  (inherited output is overwritten by the TUI's full-screen render)
- formatInstallerFailure builds the message with the last 20 lines of
  installer output, noting how many earlier lines were omitted
- tests cover the message formatting and an end-to-end installer failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] step update in TUI shows only "install.ps1 exited with code 1" without installer output

1 participant