Repository navigation
fix: show the actual error when release preparation fails - #203502
Conversation
Preserve the ANSI-free end of failed preparation output within the existing detail limit, and show that stored error in the CLI. Cover the release CLI flow with a real Git fixture whose failing build ends after more than 8 KiB of colored warnings.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Rejected review findings:
Final lines of the actual CLI output: The regression failed on the base |
|
Landed the diagnostic fix: failed release preparation now keeps the ANSI-free end of command output, and the CLI shows that recorded error without losing current-version guidance. The regression is red on the base and green with the fix; all 21 focused tests and the isolated built-CLI failure/status proof passed. Thanks for the real-install failure report. |
…03502) ## What Problem This Solves A failed release build, dependency install, or fetch can hide its actual error behind a truncated block of colored warnings. Operators see that the update failed but cannot see the cause needed to repair it. ## User Impact Failed release preparation now retains the end of the error output without terminal escape codes, and `openclaw update` prints it alongside the existing guidance that the current version is still running. This improves new failure records; it cannot reconstruct output discarded by an older updater. ## Why This Change Was Made `src/update/prepare-git.ts` returns the final 8 KiB of the failed command's raw output (the package preparer follows the same pattern). `src/update/run.ts` passes that output into the failure step's `detail`. `src/infra/update-run-codec.ts` bounds `detail` to its first 1,024 characters, so the command's final error is lost. Normalize the detail at its existing producer: reuse the ANSI stripper and surrogate-safe slice helper to keep the last 1,024 characters before writing the record. The CLI reads that same stored outcome detail. No new field, schema, protocol, or dependency is introduced. ## Evidence The regression invokes the real release CLI flow against a local Git remote and a build that emits more than 8 KiB of ANSI-colored warnings followed by `fixture build failed`. On the base, the stored detail contains only warnings and the regression fails because the final error is missing. The combined release-preparation, CLI, and Gateway update-route tests passed (21 tests), including a second pass after lint cleanup. The regression took 2.8–16.5 seconds across those runs; its file took 20.1–81.3 seconds including imports and setup. Production and test typechecks passed; targeted format and lint checks passed. The complete changed-file check also found existing unused exports outside this fix; the diagnostic fix adds no exports. The built CLI also ran `openclaw update --no-restart --yes` against an isolated Git install: it exited 1, printed the real error and current-version guidance, and `update status --json` retained the error in an ANSI-free 1,024-character detail. The build's normal package-manager footer remains after the error line. A full build with declarations passed. The packed smoke passed its CLI, SDK-consumer, and bundled-channel checks, but its final workspace-bootstrap child timed out; that broader packaging proof is incomplete. The change retains the existing failure-record owner and removes no runtime path: 11 added / 4 removed production lines and 33 added / 2 removed test lines. ## Merge Danger Two-way door: reverting restores the previous diagnostic formatting without changing update preparation, activation, or rollback. The blast radius is failed release-preparation diagnostics and their CLI display; existing stored records and their schema are unchanged. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
A failed release build, dependency install, or fetch can hide its actual error behind a truncated block of colored warnings. Operators see that the update failed but cannot see the cause needed to repair it.
User Impact
Failed release preparation now retains the end of the error output without terminal escape codes, and
openclaw updateprints it alongside the existing guidance that the current version is still running. This improves new failure records; it cannot reconstruct output discarded by an older updater.Why This Change Was Made
src/update/prepare-git.tsreturns the final 8 KiB of the failed command's raw output (the package preparer follows the same pattern).src/update/run.tspasses that output into the failure step'sdetail.src/infra/update-run-codec.tsboundsdetailto its first 1,024 characters, so the command's final error is lost.Normalize the detail at its existing producer: reuse the ANSI stripper and surrogate-safe slice helper to keep the last 1,024 characters before writing the record. The CLI reads that same stored outcome detail. No new field, schema, protocol, or dependency is introduced.
Evidence
The regression invokes the real release CLI flow against a local Git remote and a build that emits more than 8 KiB of ANSI-colored warnings followed by
fixture build failed. On the base, the stored detail contains only warnings and the regression fails because the final error is missing.The combined release-preparation, CLI, and Gateway update-route tests passed (21 tests), including a second pass after lint cleanup. The regression took 2.8–16.5 seconds across those runs; its file took 20.1–81.3 seconds including imports and setup. Production and test typechecks passed; targeted format and lint checks passed. The complete changed-file check also found existing unused exports outside this fix; the diagnostic fix adds no exports.
The built CLI also ran
openclaw update --no-restart --yesagainst an isolated Git install: it exited 1, printed the real error and current-version guidance, andupdate status --jsonretained the error in an ANSI-free 1,024-character detail. The build's normal package-manager footer remains after the error line.A full build with declarations passed. The packed smoke passed its CLI, SDK-consumer, and bundled-channel checks, but its final workspace-bootstrap child timed out; that broader packaging proof is incomplete.
The change retains the existing failure-record owner and removes no runtime path: 11 added / 4 removed production lines and 33 added / 2 removed test lines.
Merge Danger
Two-way door: reverting restores the previous diagnostic formatting without changing update preparation, activation, or rollback. The blast radius is failed release-preparation diagnostics and their CLI display; existing stored records and their schema are unchanged.