Skip to content

fix(update): preserve original update failure diagnostics - #156189

Merged
steipete merged 9 commits into
mainfrom
upd/npm11-allow-scripts-swap
Sep 23, 2026
Merged

steipete merged 9 commits into
mainfrom
upd/npm11-allow-scripts-swap

Conversation

@steipete

@steipete steipete commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Refs #156112

Thanks to @shadesurgeon for the failure report.

What Problem This Solves

Failed updates can silently clip npm errors or replace a package baseline scan's original failure with a secondary identity-fallback error.

User Impact

Release-note context: update failure records retain the first five sanitized npm error lines in order, explicitly mark truncated lines, and identify failed package baseline scans with their original cause.

Long npm lines retain a UTF-8-safe prefix plus …[truncated] within the existing 200-byte budget per line. They are not dropped in favor of later lines. Baseline failures record baseline-scan-failed through update history and the sanitized public report; a timeout whose identity fallback succeeds remains an advisory.

The reporter's original arm64 swap failure remains unconfirmed. These diagnostics apply when the updated updater runs; candidate code cannot replace an already-running 2026.9.4 updater.

Why This Change Was Made

The swap owner retains the original scan error before trying identity fallback, clears it after a successful fallback, and uses the existing error-fact redaction and public-code projection. Other activation and recovery failures retain their existing classifications.

The npm diagnostic owner redacts each complete line before applying its byte budget. The shared redactor's optional cap is presentation-only: credential, path, and command redaction all precede it, so disabling that cap does not disable redaction. truncateUtf8Prefix preserves complete UTF-8 characters and reserves space for the explicit marker. No omission-count line is added.

Net changes: +16 production LOC, +105 test LOC, and +6 documentation lines. The refinement from the previously reviewed head removes three production lines. Remaining growth preserves the original baseline error across fallback and makes diagnostic truncation explicit; it adds no configuration, schema, dependency, or npm-policy changes.

Evidence

  • The final five-case regression fails against f17b5d9852327c1fd427e738c2349916c305e341 because it omits the long cause line. All seven npm report tests pass with this refinement (pnpm test src/infra/update-npm-failure.test.ts --maxWorkers=1: 17.72 s runner wall, 89 ms summed test time).

  • All 119 tests in seven additional diagnostic owner files pass (24.85 s runner wall), covering redaction, UTF-8 truncation, report persistence, transport, recovery, and artifacts.

  • All 378 tests in the original 15-file cross-lane set pass, including rollback integrity, baseline-scan failures, CLI recovery, and both self-replacement scenarios. The longest individual test took 7.18 s. The 515.27 s runner wall includes 6m 34.4s shared runtime build preparation; the self-replay E2E tests took 6.08 s including setup.

  • node scripts/check-changed.mjs --timed -- src/infra/update-npm-failure.ts src/infra/update-npm-failure.test.ts docs/cli/update/status-and-history.md passed: core typecheck, all 25 test-typecheck graphs, formatting, guards, and lint with zero warnings/errors. The earlier full eight-file changed gate also passed. All eight final source hashes were unchanged after validation; no suppression or baseline relaxation was added.

  • Five baseline regressions failed before the baseline fix. The timeout case previously recorded identity fallback unavailable and lost the original timeout. Coverage checks recorded history/public reports, unchanged installation/launchers, successful timeout fallback, and non-baseline classifications.

  • The standalone self-replay fixture failed both on the original base and the candidate because its raw esbuild bundle omitted canonical SQL inlining. Its build now adapts the existing state-schema inliner, preserving the assertions and matching production's build contract.

  • Independent Codex P1 review of the combined fix and fresh P1 review of the final refinement: scoped-clean, no actionable findings.

  • The first refinement run exposed a test expectation that assumed a synthetic credential mask survived repeated public-report redaction unchanged. The corrected assertion checks the retained token line and absence of secret bytes, without depending on the mask format.

  • The hosted failure on the previous head in session-lifecycle-state.persistence (owner-claim waitFor) is assigned to a separate repair lane; this PR does not change that test.

Earlier single-worker costs for the unchanged tests in this PR were 17.96 s for the 58 integrity tests, 17.51 s for the 14 swap tests, and 381.03 s for the two self-replay tests (including 6m 10s shared build; Vitest 5.77 s), on lease tbx_01m3654p0a6s6mr234rfreapdz.

Proof provider: Blacksmith Testbox, lease tbx_01m36az98rw799d8wqpsmbhsjs (run).

The earlier isolated Linux x86-64 reproduction used Node 26.7.0/npm 11.19.0 with allow-scripts unset: published 2026.9.4 → 2026.9.5, openclaw update --tag 2026.9.5 --yes --no-restart --json, exit 0 in 38.72 s (npm staging 5.02 s; swap 7.59 s). The swap does not invoke npm, and npm 11.19.0's unset allowlist is advisory. No service-restart or arm64 fix is claimed.

Failure records keep whole leading npm error lines and explicitly report oversized omissions within the existing diagnostic limits. Refs #156112.
Record baseline-scan-failed with the initiating error before identity fallback can replace it. Keep recovered timeouts advisory and preserve non-baseline classifications.

Use canonical schema inlining in the self-replay fixture; the unchanged base reproduced its missing SQL asset failure.

Release-note context: failure records identify the original package baseline scan cause.
Refs #156112. Thanks @shadesurgeon for the report.
@steipete
steipete marked this pull request as ready for review September 23, 2026 05:00
@clawsweeper

clawsweeper Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review blocked

Automated review did not run, so no review verdict was produced.

Reason: The input-safety check rejected material in this revision. No detected value, path, or scanner output is reproduced here.

ClawSweeper will not retry this unchanged revision.

Next step: If this is a genuine credential, remove and rotate it. If it is an intentional test fixture, a maintainer must review and qualify it.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: S labels Sep 23, 2026
@steipete
steipete disabled auto-merge September 23, 2026 07:51
steipete added a commit that referenced this pull request Sep 23, 2026
…6466)

Close fixture responses so grammY cannot reuse a socket as the native HTTP server expires its idle lifetime. Preserve production ambiguity handling and the terminal-delivery assertions.

Refs #155040. Reproduced the PR #156189 run 35834470541 typing-only failure at the native idle boundary; the same case passes with the fixture header. Linux proof includes 30 delayed-response stress trials, 243 tests across 13 files, check:changed, and independent review.
@steipete
steipete merged commit 4663b6e into main Sep 23, 2026
204 checks passed
@steipete
steipete deleted the upd/npm11-allow-scripts-swap branch September 23, 2026 12:43
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…nclaw#156466)

Close fixture responses so grammY cannot reuse a socket as the native HTTP server expires its idle lifetime. Preserve production ambiguity handling and the terminal-delivery assertions.

Refs openclaw#155040. Reproduced the PR openclaw#156189 run 35834470541 typing-only failure at the native idle boundary; the same case passes with the fixture header. Linux proof includes 30 delayed-response stress trials, 243 tests across 13 files, check:changed, and independent review.
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 24, 2026
…56189)

* fix(update): preserve whole npm failure lines

Failure records keep whole leading npm error lines and explicitly report oversized omissions within the existing diagnostic limits. Refs openclaw#156112.

* fix(update): retain the original baseline scan failure

Record baseline-scan-failed with the initiating error before identity fallback can replace it. Keep recovered timeouts advisory and preserve non-baseline classifications.

Use canonical schema inlining in the self-replay fixture; the unchanged base reproduced its missing SQL asset failure.

Release-note context: failure records identify the original package baseline scan cause.
Refs openclaw#156112. Thanks @shadesurgeon for the report.

* fix(update): mark truncated npm diagnostic lines

* docs(update): fix code span in truncation note
@roboclaw-bot roboclaw-bot mentioned this pull request Sep 24, 2026
2 of 8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant