Skip to content

fix(ci): retry npm advisory timeouts - #137615

Closed
RomneyDa wants to merge 1 commit into
mainfrom
fix/pnpm-audit-transient-retry
Closed

RomneyDa wants to merge 1 commit into
mainfrom
fix/pnpm-audit-transient-retry

Conversation

@RomneyDa

@RomneyDa RomneyDa commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Summary

  • allow public npm bulk-advisory requests up to 120 seconds and retry one timeout
  • fall back to OSV exact-version queries only when CI opts in and every effective registry is public
  • preserve fail-closed behavior for private/dynamic registries, unsupported severity, malformed pagination, and actual findings
  • map categorical and CVSS v2/v3 severity, including paginated results and malware aliases

Why

The Wave 8 cleanup PRs repeatedly completed their code matrices, then failed security-fast because npm's bulk advisory endpoint stopped responding. Longer timeouts and a retry also exhausted their bounds. OSV's maintained exact-version API remained responsive, so the public-registry audit can retain vulnerability coverage without making npm's outage a global CI blocker.

Testing

  • pnpm vitest run test/scripts/pnpm-audit-prod.test.ts (39/39)
  • OPENCLAW_PNPM_AUDIT_BULK_TIMEOUT_MS=1 node scripts/pre-commit/pnpm-audit-prod.mjs --audit-level=high --allow-osv-fallback (real full-lockfile OSV fallback; clean)
  • pnpm check:changed
  • pnpm check:workflows (blocked before validation: local Python mirror lacks pinned pre-commit==4.6.2)
  • P3 autoreview: scoped clean (0.84)

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 3, 2026
@RomneyDa
RomneyDa force-pushed the fix/pnpm-audit-transient-retry branch from f234ad8 to 4c61317 Compare September 3, 2026 22:45
@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 3, 2026, 8:21 PM ET / September 4, 2026, 00:21 UTC.

ClawSweeper review

What this changes

The PR doubles the npm bulk-advisory timeout and adds one timeout-only retry to the pre-commit production dependency audit, with focused retry tests.

Merge readiness

⛔ Blocked before merge - 5 items remain

Keep this PR open but blocked: it retries only the pre-commit audit while current main’s release vulnerability gate still sends the same npm requests through the non-retrying helper. The latest review comment also records that the supplied hosted run timed out on both 120-second attempts, so recovery has not yet been demonstrated.

Priority: P2
Reviewed head: b3d2a81d18f98b2e66a07ec50f4dae959f71b398

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and preserves fail-closed behavior, but its partial caller coverage leaves the stated timeout problem unresolved for release validation.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored internal CI reliability PR is exempt from the external-contributor proof gate; however, the supplied hosted result is a failed second retry rather than evidence that the repair recovers.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored internal CI reliability PR is exempt from the external-contributor proof gate; however, the supplied hosted result is a failed second retry rather than evidence that the repair recovers.
Evidence reviewed 6 items Introduced partial caller coverage: The introduced hunk routes only runPnpmAuditProd through the retry wrapper; this is not the shared request boundary.
Current-main release caller remains terminal on timeout: Current main imports fetchBulkAdvisories directly and calls it for each advisory chunk, without the retry wrapper.
Release validation exercises both graphs: The release gate runs all and production advisory requests independently for every lockfile, so an npm timeout remains a terminal failure across those calls.
Findings 1 actionable finding [P2] Apply the retry at the shared advisory boundary
Security None None.

How this fits together

OpenClaw’s dependency audits turn lockfile package graphs into npm bulk-advisory requests and fail CI or release validation when an audit cannot complete. The shared request helper feeds both the security-fast audit and the release vulnerability gate.

flowchart LR
  A[Lockfile package graphs] --> B[Bulk advisory request helper]
  B --> C[Timeout policy]
  C --> D[Security-fast audit]
  C --> E[Release vulnerability gate]
  D --> F[CI result]
  E --> G[Release evidence]
Loading

Before merge

  • Apply the retry at the shared advisory boundary (P2) - This introduced call site uses the wrapper only for security-fast. scripts/dependency-vulnerability-gate.mts:87 still calls fetchBulkAdvisories directly for every release lockfile graph, so the same npm timeout remains terminal in release validation. This repeats the prior finding on the unchanged head; route that caller through the bounded retry or centralize the policy, with release-gate timeout and 5xx coverage.
  • Resolve merge risk (P2) - Release validation can still fail immediately on the same npm bulk-advisory timeout because its direct caller bypasses the new retry wrapper.
  • Resolve merge risk (P1) - The hosted current-head evidence recorded two consecutive 120-second timeouts, so the longer deadline and retry have not yet shown that they resolve the CI blockage.
  • Resolve merge risk (P1) - Production grows by 28 net lines for a wrapper that is not yet the canonical shared retry boundary.
  • Complete next step (P2) - Apply the bounded timeout retry to the release vulnerability gate or the shared helper, add entrypoint coverage, and provide a successful current-head hosted audit trace before merge.

Findings

  • [P2] Apply the retry at the shared advisory boundary — scripts/pre-commit/pnpm-audit-prod.mjs:931
Agent review details

Security

None.

PR surface

Tests +44, Other +28. Total +72 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 46 2 +44
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 30 2 +28
Total 2 76 4 +72

Review metrics

Metric Value Why it matters
Production versus test delta production +30/-2 (net +28); tests +46/-2 (net +44) The added production retry wrapper should replace duplicate caller policy rather than leave another production audit path unprotected.

Merge-risk options

Maintainer options:

  1. Centralize the bounded retry (recommended)
    Apply the timeout-only retry to the shared advisory boundary or the release gate, with entrypoint coverage for recovery and immediate 5xx failure.

Technical review

Best possible solution:

Put the bounded timeout-only retry at the shared advisory boundary, or route every production caller through one canonical wrapper, then prove one retry succeeds and 5xx responses still fail immediately through both entrypoints.

Do we have a high-confidence way to reproduce the issue?

No high-confidence successful current-head recovery run is available: source proves the release caller bypasses retry, and the supplied hosted attempt timed out twice.

Is this the best way to solve the issue?

No: the introduced retry is correct for one caller but is not the canonical solution because current main’s release vulnerability gate retains the same direct timeout path.

Full review comments:

  • [P2] Apply the retry at the shared advisory boundary — scripts/pre-commit/pnpm-audit-prod.mjs:931
    This introduced call site uses the wrapper only for security-fast. scripts/dependency-vulnerability-gate.mts:87 still calls fetchBulkAdvisories directly for every release lockfile graph, so the same npm timeout remains terminal in release validation. This repeats the prior finding on the unchanged head; route that caller through the bounded retry or centralize the policy, with release-gate timeout and 5xx coverage.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against cd8c74889d21.

Labels

Label justifications:

  • P2: This is a bounded CI and release-validation reliability defect with a concrete shared-caller repair.
  • merge-risk: 🚨 automation: The PR changes timeout behavior in security and release audit automation while leaving the release caller terminal on timeout.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This MEMBER-authored internal CI reliability PR is exempt from the external-contributor proof gate; however, the supplied hosted result is a failed second retry rather than evidence that the repair recovers.

Evidence

Acceptance criteria:

  • [P1] node scripts/run-vitest.mjs test/scripts/pnpm-audit-prod.test.ts test/scripts/dependency-vulnerability-gate.test.ts.
  • [P2] Run a focused release-gate timeout-then-success and 5xx fault-injection scenario.
  • [P1] Obtain a successful current-head hosted security audit trace with sensitive details redacted.

What I checked:

  • Introduced partial caller coverage: The introduced hunk routes only runPnpmAuditProd through the retry wrapper; this is not the shared request boundary. (scripts/pre-commit/pnpm-audit-prod.mjs:931, b3d2a81d18f9)
  • Current-main release caller remains terminal on timeout: Current main imports fetchBulkAdvisories directly and calls it for each advisory chunk, without the retry wrapper. (scripts/dependency-vulnerability-gate.mts:87, cd8c74889d21)
  • Release validation exercises both graphs: The release gate runs all and production advisory requests independently for every lockfile, so an npm timeout remains a terminal failure across those calls. (scripts/dependency-vulnerability-gate.mts:297, b3d2a81d18f9)
  • Tests cover the wrapper but not the release entrypoint: The added tests prove one timeout retry and immediate 5xx failure through fetchBulkAdvisoriesWithRetry; dependency-vulnerability-gate tests contain no timeout/retry coverage. (test/scripts/pnpm-audit-prod.test.ts:343, b3d2a81d18f9)
  • Feature-history routing: History shows Vincent Koc’s earlier audit timeout-boundary work and Peter Steinberger’s recent release-gate advisory work; the local promisor checkout could not hydrate older parent objects for stronger introduction attribution. (scripts/pre-commit/pnpm-audit-prod.mjs:750, bcc9ee3f6f57)
  • Hosted outcome remains negative: The supplied maintainer review comment says the security-fast job retried at 23:49:17 UTC and failed after its second 120-second attempt at 23:51:17 UTC; it explicitly requests a successful current-head hosted audit before landing. (b3d2a81d18f9)

Likely related people:

  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Centralize the timeout-only retry or route the release gate through the shared wrapper.
  • Add release-gate fault-injection coverage for timeout recovery and immediate 5xx failure.
  • Attach a redacted successful current-head hosted audit trace after the repair.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (2 earlier review cycles)
  • reviewed 2026-09-03T23:02:26.924Z sha 4c613176304f401ea4c9aaa572867e146d7b0077 :: blocked before merge. :: [P2] Apply the timeout retry at the shared advisory boundary
  • reviewed 2026-09-04T00:00:04.544Z sha b3d2a81 :: blocked before merge. :: [P2] Apply the timeout retry to the release-gate caller

@RomneyDa
RomneyDa force-pushed the fix/pnpm-audit-transient-retry branch from 4c61317 to e800ad2 Compare September 3, 2026 23:09
@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@RomneyDa
RomneyDa force-pushed the fix/pnpm-audit-transient-retry branch from e800ad2 to 9ff1be4 Compare September 3, 2026 23:20
@RomneyDa
RomneyDa changed the base branch from main to fix/frv-candidate-reuse-clock-20260904 September 3, 2026 23:20
@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa
RomneyDa force-pushed the fix/frv-candidate-reuse-clock-20260904 branch from d10461a to 839767a Compare September 3, 2026 23:33
@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@RomneyDa
RomneyDa force-pushed the fix/pnpm-audit-transient-retry branch from 9ff1be4 to e099bc4 Compare September 3, 2026 23:41
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@RomneyDa
RomneyDa force-pushed the fix/pnpm-audit-transient-retry branch from e099bc4 to b3d2a81 Compare September 3, 2026 23:43
@RomneyDa
RomneyDa changed the base branch from fix/frv-candidate-reuse-clock-20260904 to main September 3, 2026 23:43
@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@RomneyDa

RomneyDa commented Sep 3, 2026

Copy link
Copy Markdown
Member Author

Refreshing the exact-head merge ref after the base/head retarget; no code change.

@RomneyDa RomneyDa closed this Sep 3, 2026
@RomneyDa RomneyDa reopened this Sep 3, 2026
@clawsweeper

clawsweeper Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event exact_review_queue).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

@clawsweeper

clawsweeper Bot commented Sep 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete

steipete commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

The hosted result still needs to be reconciled before treating this as the audit-timeout repair: security-fast job 100856924139 logged the retry at 23:49:17 UTC and then failed after the second 120-second attempt at 23:51:17 UTC. The bounded retry preserves failure on an unsuccessful audit, but that run does not establish that the longer deadline/retry resolves the observed blockage.

I am checking the unchanged bulk request through the actual helper, recording payload size and whether the stall occurs before response headers. Please retain this failed result alongside the successful local run; a successful current-head hosted audit is still needed before landing. No audit bypass is proposed.

@steipete

steipete commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

The unchanged helper reproduced the stall locally on its first 400-package request (14,781 bytes), with no response headers before its 60-second deadline. A fixed diagnostic sequence then tried a single-package 20-byte control, four 100-package partitions, and the original 400-package payload, each with a 15-second diagnostic cap. All six stalled before headers; an independent curl request for the single-package control also received zero bytes before its 15-second deadline.

That does not isolate request size or Node's fetch implementation, and it gives no evidence for changing chunking. The npm status page currently lists Security Audit as operational, so I am not claiming an officially reported audit outage. The failed results are preserved; audit policy remains enforced. A recovered actual endpoint/hosted result is needed before another retry can establish readiness.

A later two-request transport diagnostic adds a useful boundary: the registry ping returned HTTP 200 in 0.12 seconds. The same 20-byte advisory POST completed DNS, TCP, verified TLS, and its full upload in under 0.1 seconds, then received no response bytes before the 15-second cap. That observed request stalled after connection setup; it does not establish which registry or network component is responsible.

@vincentkoc

Copy link
Copy Markdown
Member

I opened #137716 as the maintainer-owned replacement.

The replacement preserves Dallin's co-author credit, but the landed diff must differ from this branch: the retry belongs inside the shared bulk-advisory fetch so both security-fast and release validation inherit the same bounded policy. This branch cannot be edited by maintainers (maintainerCanModify=false) and its 120-second retry still failed during the npm outage.

I will close this PR only after the replacement lands, with the landed commit linked here.

@vincentkoc

Copy link
Copy Markdown
Member

Landed the maintainer-owned replacement in #137716 as commit 3d30b3a.

Closing this PR because maintainerCanModify=false prevented updating the branch and the landed diff needed to move the bounded retry into the shared bulk-advisory owner used by both security gates. Dallin's contribution is preserved with a co-author trailer in the landed commit.

@RomneyDa

RomneyDa commented Sep 4, 2026

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper could not start a re-review for this item.

Reason: re-review requires an open issue or PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants