Skip to content

fix: prevent package import scans from stalling on helper calls - #158705

Closed
fuller-stack-dev wants to merge 1 commit into
mainfrom
fix/package-import-scanner-cpu
Closed

fuller-stack-dev wants to merge 1 commit into
mainfrom
fix/package-import-scanner-cpu

Conversation

@fuller-stack-dev

@fuller-stack-dev fuller-stack-dev commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

Related: #158673

What Problem This Solves

Release verification can spend minutes on one CPU while scanning a generated browser asset with repeated helper-call arguments.

User Impact

The affected package import scan completes promptly. Node worker bootstrap retains its dependency decisions. Earlier Mac worker pruning results are historical because canonical Bun migration retired that path. No configuration change or migration is required.

Why This Change Was Made

The scanner expanded arguments even when an opaque call could not use their origins. It now resolves possible callees first and computes demanded argument origins once per invocation. This also avoids repeated argument scans across ambiguous Node path callees. Scope, writes, cycles, working-directory changes and immutable path snapshots keep their behavior. There is no cross-query cache or file exclusion.

Native qualification also required credited fixture and consumer repairs. These include canonical CommonJS closure resolution from #160583 and the existing recovery-helper bundle allowance from #160717. Private Git fixtures now sanitize before bootstrap; worker cleanup joins owned children; port and lease fixtures preserve their actual lifetime contracts. Original credit for Jason (Json)'s reviewed work and Peter Steinberger's canonical fixes remains in the commits.

Evidence

Published head remains 8b115300897146a5afa7a5bae076e6849ca8642d. Local correction ef789ababa565f801053480e7d3a24c797c42b0f is unpublished and unmerged. It integrates canonical 18154cae312943e32491b9d788ad3b6e3bb1ff11, including fs-safe 0.22, CoW copy/restore, and native wrapper/runtime preparation changes, while preserving original publication ancestry. Both scanner source files are unchanged from the previously qualified repair. The credited pinned-pnpm normalization now matches the canonical lockfile. Its no-op startup proof covers that normalization, not the newly integrated dependency graph.

The integration preserves the reviewed daemon fixture from Jason (Json)'s bacb2e7bafd2e86c9e4a44cb9de0166dbe9bb8c2. Inline ENOSPC refusal before authoritative publication and file-backed compensation remain separate cases, checking real partial writes, artifacts, receipts, no restart, and warning history. The complete 708-line file was audited. Its exact source passed independent P0-P2 review and 14 daemon cases within a 90-case supplier run, plus typed lint and formatting. That run preceded fs-safe 0.22 and is not current combined-context clearance.

Canonical #162599 now owns checkpoint equivalence through committed-content generation checks. This correction removes the superseded Windows checkpoint callbacks, successor-generation promotion and extracted removal module. Canonical restore, cache and generation production files are preserved exactly. The distinct native-reader refusal and successful same-fixture retry regression remains for both agent and shared databases.

Native correction review validates READY FOR /prepare-pr, meaning source readiness for the required gates. Before the latest dependency/restore integration, matching-source qualification passed 58 planner and 17 restore cases in 163.99 seconds across two shards. The reviewed browser fixtures passed all 44 cases across three files. A negative control showed that the old delete-failure test could pass without reaching the fault; the corrected test rejects the same input and now observes both close and fault occurrence. Deferred checkpoint waits reject early operation settlement and join their work in finally. Whole touched tests and helpers were audited; distinct regressions and failure assertions remain. Independent P0-P2 reviews passed within their stated source-context limits.

On unchanged canonical production, native Windows recovery qualification passed the real native-close failure, same-owner retry, reopen and subsequent restore observation. This falsified a separate remaining cleanup defect; the temporary observation was consumed and removed. Independent canonical acceptance passed normal restore and foreign-write refusal, with committed WALs observed before restore and fresh persisted reads afterward. The separate second-normal invocation clause was not rerun on canonical source.

Earlier seven-case Windows qualification and all three acceptance clauses passed on the now-superseded prerequisite. Its declaration and fault-target spelling failures remain historical evidence. Those earlier results are not presented as proof for the canonical replacement.

Current combined build/check/test, corrected-head CI and fresh ClawSweeper completion remain pending. No scanner compiler or broad suite is running while the preceding coordinated native gate is active. The latest canonical scanner still contains the original affected implementation, so this repair remains necessary.

On predecessor 59a5f370fca967e98d79d6ac833856c0e789ed89, native build passed in 13m35.5s and full check passed. The process shard then failed one assertion comparing node.exe with node.EXE; 859 tests passed and 55 had existing skips. The full gate was cancelled after this failure, admitted children settled, and exact-token native lock recovery succeeded. This is a failed gate, with cancelled coverage unproven.

The unchanged 33-case child-adapter file reproduced that failure. A private filesystem probe proved both spellings identify the same executable inode; the explicit PATHEXT controls which spelling the resolver returns. The one-line fixture correction names its file node.EXE to match .EXE, preserving the exact entrypoint, prompt arguments and shell-escaping assertions. All 33 cases now pass, as do 22 adjacent cases with 28 existing Windows-only skips on macOS. Typed lint, formatting and independent P0–P2 review passed. The whole touched test file and its helpers were audited; no cases, assertions, skips or deadlines were removed or weakened. Production resolution is unchanged.

A credited browser fixture simplification clears the strict line cap encountered by the shared prerequisite gate. It preserves all 28 cases and assertions while sharing repeated setup and joining the paused sweep in finally. The exact supplier preimage and postimage were verified. Supplier lint changed from failing to passing; all 28 cases passed before and after, with typed lint and independent review also passing. This is scoped supplier evidence, not a completed scanner gate. A further credited fixture correction uses canonical storage keys to test malformed fields, rejects early sweep settlement, and awaits database closure before restart and teardown. All 28 cases and 93 assertions remain. Its supplier passed 44 cases across three files with independent review.

The current composition adopts canonical updater progress and Kysely lint owners from c03ee95e109d671ed7f4d918346a7cdc0f419d69, replacing the superseded supplier implementation while preserving contributor ancestry. Terminal publication now owns final progress disposal; the temporary public pause API and only its obsolete assertions are removed. Useful immutable-snapshot, committed-row and package-generator tests remain. The canonical lint fixture also retains direct and striped malformed-SQL failure checks. At that earlier qualification stage, all 59 shared prerequisite postimages matched the reviewed composition, with whole-file audits and independent review recorded. The owner's 76-case recovery/planner run passed, as did the five-case lint fixture. These are scoped supplier results, not a current scanner full-suite pass. The earlier supplier CI run 36828820775 remains failed evidence. The Windows rollback repair now has the scoped native proof described above; combined-context gates remain pending.

On predecessor 7d1d31e4de14a47f3586d7ec322351dc5bb7f672, native build passed in 14m55.5s. Full check stopped during preflight: 22 guards passed and the added withTestTimeout readiness call in the node-worker fixture failed the rule against new wall-clock test deadlines. Types, lint and tests were not reached. The reviewed correction uses Vitest's cancellation signal through the existing withinTest owner. Both real-child cases and their assertions remain; the supplier proved the ratchet red/green and both cases passed. Native failure recovery completed after owned processes settled. This remains a failed full-gate attempt.

The correction also incorporates canonical #162431 for explicit Gateway port reservation and a reviewed fixture resolution from identical base/local/main inputs. All three resulting files match the supplier's tested source. Its 32 acquisition cases and 19 listener/environment cases passed. The complete touched tests were audited, with no cases, assertions, skips or budgets weakened. These are matching-source supplier results, not a new full-suite pass on the scanner head. The missing UI scope-error import is now on canonical main as 03137c1d729e.

Matching scanner and surviving-consumer source passed 242 tests across four files on Node 24.21. The exact supplied asset scanned in 210.931 ms and returned its sole relative import; installed-root manifest validation took 229.986 ms with no errors. The two permanent CPU regressions took 205 ms and 106 ms; their single-worker file shard took 2.05s. Current hosted cost is unmeasured. The fixture was only read and parsed. Canonical Bun migration retired Mac node-worker pruning and its test, so earlier Mac-pruning results below are historical.

Earlier correction qualification

On parent 2e1a1c83f289bdf03ea8ce098bad0fd9394582bd, native build passed in 675.6s and full check passed. The Skills shard failed “replans a directory replaced between source planning and the first scan” with path-mismatch caused by a real ENOENT. It completed 136 files with 133 passed, one failed and two existing skips; 1,735 tests passed, one failed and four were skipped. The full gate was cancelled after that footer, all owned children settled, and native lock recovery completed. An unchanged replay of all 136 executed files in the same observed order passed 1,736 tests in 205.93s. It did not reproduce the original concurrent full-suite load and does not clear the failed gate.

The final correction serializes the fixture's injected replacement against overlapping descendant plans before their real filesystem probes. The selected root still finishes planning before replacement, and replacement still precedes its watch invocation. A controlled comparison reproduces the original path-mismatch/ENOENT and passes with the corrected fixture under the same imposed schedule. This demonstrates the race mechanism; historical scheduling was not directly observed. A rejected first draft exposed a stale descendant scope and was discarded before commit. Production behavior, strict startup rejection, all ten fixture cases and their assertions remain unchanged. The barrier releases in finally.

The correction passed 27 focused cases across the missing-root, registration-gap and filesystem recovery files, plus the services type graph, scoped typed lint and formatting. A real filesystem failure control preserves ENOENT and verifies joined close, zero watcher owners, closed subscriptions and removal of its private root. Independent source-blind validation passed seven clauses across fault, regular and red/green comparison runs. Its first-scan observation is the watch invocation before watcher creation, not a direct internal scan timestamp. API review found no P0–P2 issue in the diff and supplied lifecycle/helper context; the full touched file was unavailable to that reviewer and was separately audited in full by the lead and coordinator. These scoped results do not qualify the historical full-suite schedule or a live Gateway.

On predecessor 6ea03340eca4f2c92f64907ee443404c9e82b2cb, native build passed in 12m46.9s and full check passed. Full tests were cancelled after the UI pairing case "expires only the currently active setup" reported 17 remaining timers instead of zero. An unchanged replay of the original 73-file UI prefix passed all 3,071 tests in 91.59s. One passive diagnostic repeated that same observed order and passed all 3,071 tests in 99.16s, with an empty final timer heap and only the two expected pairing timers observed. Neither result explains the original failure or proves a fix; the original full-group conditions were not reproduced. That bounded uncertainty remains recorded under the repository's normal review/CI continuation policy. No assertion, timeout, retry or skip was changed. Prior phase and supplier results do not constitute a completed full gate for the current correction.

  • Canonical c849a831a17fd4508684a5cda94e688b0c00c7eb, with Babel 8.0.6, exceeded a 10-second scanner bound on the exact 190,454-byte asset. Parse/bind took 99 ms. The corrected scanner took 152 ms and returned the sole expected relative import; installed-root manifest validation took 213 ms with no errors. A separate ambiguous-callee regression failed on the prior candidate and completes in 59 ms with the correction.
  • The composed scanner and direct consumers passed 247 cases across five files, including CommonJS bootstrap, installed-package validation and Mac pruning. The unchanged scanner also retains 23 independent source-blind semantic cases. Both permanent CPU regressions run bounded subprocesses against parsed source. The supplied fixture is never executed.
  • The final Git-fixture composition passed 15 selected cases across three files. Matching supplier evidence includes the actual two-case red/green, complete 161-case closeout/merge suite, 87-case planner suite, 20 local-command cases and five final request-mode cases. These are scoped results, not a full-suite pass on this head.
  • Independent review covers the scanner correction and each later composition. The latest supplier deltas were reused only after verifying matching preimages, helpers and affected owners. Entire touched test files were audited, with distinct failure-path coverage preserved.

Fixture SHA256: 798095b29965d623b069bab48f10a7ebf384a7047e1c25a85a4c38797db23980.

The earlier 6 MiB recovery-helper guard and CommonJS closure refusals are addressed by the composed canonical consumer repairs and focused proof. No completed full release:check, successful whole-package bootstrap archive, signed Mac qualification or Darwin freeze clearance is claimed.

Earlier native qualification and remaining full-suite gap

On predecessor 20a416758aac6482b5bf8ea3722282f922e91e1c, local build passed in 12m19s and full check passed. The Testbox run exited 255 after roughly two hours during tooling tests, without a finalized failing case. The lease completed and its Actions run was cancelled. Provider/transport diagnosis remains separate from scanner correctness.

Completed outer groups, excluding nested fixture summaries:

Group Files passed / skipped Tests passed / skipped Time
unit-fast 1,655 / 4 19,656 / 25 274.89s
unit-src 685 / 3 7,929 / 27 363.01s
unit-security 37 / 0 363 / 0 14.27s
unit-support 281 / 0 4,667 / 1 26.65s
support-boundary 12 / 0 140 / 0 19.59s

A later local run on 4f31cdabc783a7c26a4fe21441ea972c77f311ad passed build in 11m06.3s and all typecheck lanes. It was cancelled during lint before tests when the Git bootstrap fixture defect was proved. Those phase results remain historical; neither run supplies a completed gate for the current correction.

Subsequent local qualification exposed additional fixture failures and a Gateway SIGSEGV. The original crash remains unattributed. A later Gateway control passed 109 files and 3,737 tests with two existing skips before cancellation; it used a new compiler cache and leaves 226 original files unqualified. Skills notification timing and historical FTS failures retain their recorded evidence limits. Later fixture controls qualify their own repairs without retroactively clearing failed full runs.

Shared gate prerequisites

Credited transfers retain their original attribution and scoped proof:

  • The correction integrates reviewed canonical 2b4055f8dd703e9c09985940dce9a9c6fc3c29bf. The live-build fence uses its canonical stopped-service check and discovery owner. Both spawn-broker fixtures retain strict transport callbacks and joined cleanup. Seven matching composition files are covered by the supplier’s 210 passing cases with one existing skip across 13 files in 197.017s. These are matching-source results, not a full Scanner gate.

  • Credited 6158df93e876df8225a39b16cb04ffc47282cb6c keeps supervisor markers independent of state-path imports, so private test HOME is installed before state paths are captured. Three fresh-child cases fail before the repair; the original config-I/O case remains. The final supplier passed 46 focused cases, 12 independent source-blind children, and changed checks. The initial new cleanup assertion incorrectly included a preexisting loader cache; it was corrected to require home removal while preserving those exact prior entries. Original sandbox assertions were unchanged. The complete test, helpers and both owner modules were audited, and all three transferred files match the reviewed supplier.

  • 7e13890ecccc4d66035e6fe00ac52b7540a424da disposes chat view state in three UI fixture teardowns before existing cleanup. In the supplier's original-relative-order four-file reproduction, 28 cases passed and the viewport case failed with four scheduled frames; the correction passed all 29 cases with one frame. Independent original/reverse-order and viewport-alone controls passed 29/29/11 cases, and scoped types, lint and formatting passed. All 18 fixture cases remain after whole-file/helper audit. Matching preimages and postimages justify reuse here. This repairs a separately proved fixture leak and does not establish the Scanner pairing-timer failure's cause.

  • The correction integrates canonical 3420ad1714228fb8fe2c08afe3c3a799ced4732f. Four matching fixture files passed 154 cases in the supplier’s native run, covering local-command MCP settlement, model switching, snapshot cleanup ownership and signal custody. Complete local-command and cleanup-owner test audits preserve their assertions and failure paths. The scanner owner, tests and dependency inputs are unchanged.

  • Credited 2b01ada1baa9a00fc080dc94add08a3e8c4437d9 makes yielded-followup fixtures join persisted cleanup after the canonical awaited-cleanup change. A controlled delayed acknowledgment reproduced the old finite-poll failure; ten cases then passed, and source-blind acceptance passed 580 cases across 16 files. That acceptance preceded an equivalent Object.assign lint adjustment; the final bytes passed scoped lint and types. This does not establish the historical Gateway crash cause or a new Scanner full-suite pass.

  • Current qualification also includes reviewed model-switch settlement, spawn bootstrap/transport fixture corrections, FTS watcher/clock isolation, and signal-custody fixture isolation. The signal fixture uses a private singleton key while exercising the real cleanup callback; all ten cases and assertions remain. The supplier reproduced five failures in the original 137-file command, then passed 135 files and 1,367 tests with two existing file skips and six existing test skips. Three predecessor/successor controls passed 30 cases. The FTS supplier passed all 26 cases. These are matching-source supplier results, not new Scanner full-suite results.

  • The signal controls preserve an earlier cleanup owner and its listeners, restore the intercepted registration, and verify real successor bytes are removed. Source-blind output did not separately expose SQLite-open/worker counters; the unchanged per-case forbidden-call assertion was independently source-audited. Original command order does not establish historical per-worker scheduling.

  • b87659c38b5c680c70e9578eb865d89c4f604e14 and 2cba7ab4bb15fef297730dd7b54149bef2993f9c isolate native PR fixtures from inherited Git/config state, including bootstrap. Real private repositories verify foreign index, refs and hook behavior. d705a34117660cc4651e844576332fa4ca0a347b applies the existing environment owner to four planner bootstrap calls.

  • The obsolete outer MCP file-order wrapper is retired under current native routing, which separates its original memory/requester pairing. Those owner tests remain. A separate later runtime/local-command mutation control verifies singleton isolation for that composition; it does not prove the old pairing or historical timeout cause. Local-command setup and teardown await runtime disposal before retiring the fixture transport factory. All four transport cases and real request expectations remain.

  • 0fa080f71eb40c9eb1f5a3b6b7c97f6dafc448d5 uses real lifecycle errors and restores lease timers; 27 lease/adjacent cases pass.

  • 74442a24f612087a9304dd9a22dc6327d04a27c9 retains native acquisition port claims through adoption and cleanup; the causal regression and all 32 acquisition cases pass.

  • Canonical bbbb3b464a9fe6094a65cc391ce3db94a1c29c07 and 1f7886c4ad8ded9bf83de04555b0c2776b110930 serialize fixture journal writes and join owned children before state removal. Causal red/green, original recovery cases, permanent cleanup regressions and independent cleanup clauses cover settlement and refusal.

  • b464a9a55d1bbe07c457d3be131ff4bcb83b1a51 keeps GitHub item icons with their first label line while oversized labels wrap. Seven browser tests and six independent clauses across 80 combinations cover LTR/RTL overflow and overlap.

  • Reviewed Slack fixture extraction, session-roster type extraction, restart-fixture isolation and canonical 3a300c650a5b87c4f84afeea7c2ff3a1df70e4ee scenario-reference repair address qualification prerequisites. Original credit is preserved in the commits.

Entire touched tests, fixtures, imports, setup/teardown and skips were audited. Source-text checks were replaced with observable private-Git behavior. Obsolete MCP cohabitation and literal fixture self-checks were removed for recorded ownership and redundancy reasons. Distinct regressions remain; assertions, retries and timeouts were not weakened. Historical failures remain failed evidence, and reused owner results are not represented as new full-suite passes.

The captures below use the same synthetic component fixture, Chromium renderer and 200/208-pixel columns. Base: 1fe560c198c2917154e2e1b130b0df3352ac5114. Head: b464a9a55d1bbe07c457d3be131ff4bcb83b1a51, byte-identical to the transferred CSS/test. This proves component layout, not a full Gateway workflow or every browser engine.

Theme Before After
Light Before, light, icon stranded above label After, light, icon shares first label line
Dark Before, dark, icon stranded above label After, dark, icon shares first label line

Before video:

https://91b59577e757131d68d55a471fe32aca.r2.cloudflarestorage.com/openclaw-crabbox-artifacts/crabbox-artifacts/v2/org/b3BlbmNsYXc/owner/Z2l0aHViOjI2MzA2MDIwMg/pr-158680/publish/20260928-061345-944996000/before.mp4?X-Amz-Expires=604800&X-Amz-Date=20260928T061345Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=a677a1e59413a4e54bcc2da5fec6164a%2F20260928%2Fauto%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=7e738bc0a2aaf033c3881374b5d220d472c0fd32ed2f6df84af0a21ee47a6ef1

After video:

https://91b59577e757131d68d55a471fe32aca.r2.cloudflarestorage.com/openclaw-crabbox-artifacts/crabbox-artifacts/v2/org/b3BlbmNsYXc/owner/Z2l0aHViOjI2MzA2MDIwMg/pr-158680/publish/20260928-061345-944996000/after.mp4?X-Amz-Expires=604800&X-Amz-Date=20260928T061345Z&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=a677a1e59413a4e54bcc2da5fec6164a%2F20260928%2Fauto%2Fs3%2Faws4_request&X-Amz-SignedHeaders=host&X-Amz-Signature=a95c81c2122825713eddf588b9638379ea62a6816c358381340a468443784943

Contract · Raw before · Raw after · Artifact manifest

The four screenshots were independently downloaded, hash-verified and visually inspected before reuse. They are attached in the originating chat and were verified loaded and visible on this public PR page in Chromium. Links expire October 5, 2026.

@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@fuller-stack-dev
fuller-stack-dev marked this pull request as ready for review September 26, 2026 06:33
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. 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 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 1, 2026, 9:05 AM ET / 13:05 UTC (Revision 24).

ClawSweeper review

What this changes

The PR delays argument tracing in OpenClaw’s package dependency scanner and adds a subprocess regression for repeated opaque helper calls.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked before merge - 4 items remain

The optimization remains necessary, but both previously reported defects remain in the published head. The author’s correction and its qualification results are explicitly unpublished; they cannot clear this head.

Priority: P2
Reviewed head: 8b115300897146a5afa7a5bae076e6849ca8642d

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused optimization is useful, but the published implementation retains a CPU regression and a type error despite positive qualification of an unpublished correction.
Proof confidence 🌊 off-meta tidepool Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply. The full captured body reports real-asset scanner and installed-manifest results for an explicitly unpublished correction; those results do not validate the defective published head. No stored-data contract changes.
Patch quality 🦐 gold shrimp (3/6) 2 actionable review findings remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author is a repository MEMBER, so the external-contributor proof gate does not apply. The full captured body reports real-asset scanner and installed-manifest results for an explicitly unpublished correction; those results do not validate the defective published head. No stored-data contract changes.
Evidence reviewed 9 items Verified introduced patch: The pinned base-to-head diff introduces lazy argument tracing and one bounded subprocess regression. The original head’s raw commit records the supplied base as its parent.
Prior performance blocker remains: Each possible resolve or join callee invokes locations() separately. Conditional callee origins are unioned, so nested ambiguous calls recursively retrace their arguments for both alternatives; the base computed those arguments once.
Prior type blocker remains: The factory branch combines an Origin[] expression with a fresh uncontextualized ["unknown"] array. Its callback parameter widens to string, which is incompatible with callerValues.has accepting Origin. The author’s comment independently acknowledges the published TS2345 error.
Findings 2 actionable findings [P2] Compute demanded argument origins once per call
[P2] Keep the factory fallback typed as an Origin
Security None None.

How this fits together

The package dependency scanner reads JavaScript source without executing it and identifies imports belonging to the package. Release validation and Node bootstrap packaging consume those results to check dependencies and retain required files.

flowchart TD
  A[Package JavaScript] --> B[Parse source and bindings]
  B --> C[Trace possible callees]
  C --> D[Trace required arguments]
  D --> E[Collected imports]
  E --> F[Release dependency validation]
  E --> G[Node bootstrap packaging]
Loading

Before merge

  • Compute demanded argument origins once per call (P2) - When a callee resolves to both path.resolve and path.join, each alternative invokes locations() and recursively traces the same arguments again. A nested chain using choose ? path.resolve : path.join doubles this work at every level, whereas the base computed arguments once. This previously reported blocker remains in the published head; reuse demanded origins within the invocation and retain an ambiguous-callee regression.
  • Keep the factory fallback typed as an Origin (P2) - The new conditional combines Origin[] with an uncontextualized ["unknown"], widening the mapped location to string. Passing it to callerValues.has(location) produces TS2345 because that set accepts Origin, blocking typechecking. This previously reported defect remains; provide the fallback through an explicitly typed origin value or array without widening the contract.
  • Resolve merge risk (P1) - Nested ambiguous path callees can monopolize CPU during synchronous package scans because the introduced lazy argument function repeats recursive work for each callee alternative.
  • Complete next step (P2) - Publish the invocation-scoped argument reuse and typed factory fallback with an ambiguous-callee regression, then validate the corrected published source and its package consumers.

Findings

  • [P2] Compute demanded argument origins once per call — src/infra/package-root-imports.ts:371-372
  • [P2] Keep the factory fallback typed as an Origin — src/infra/package-root-imports.ts:377-381
Agent review details

Security

None.

PR surface

Source +4, Tests +36. Total +40 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 16 12 +4
Tests 1 36 0 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 52 12 +40

Review metrics

None.

Merge-risk options

Maintainer options:

  1. Reuse arguments within each invocation (recommended)
    Resolve the possible callees first and compute their demanded argument origins once, retaining an ambiguous-callee CPU regression.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Repair invocation-scoped argument reuse in the package import scanner, retain opaque-call coverage, add ambiguous resolve/join regression coverage, and preserve existing scope, cycle, cwd and immutable-snapshot semantics.

Technical review

Best possible solution:

Keep the existing scanner owner and dependency semantics, with invocation-scoped reuse of demanded argument origins and a correctly typed factory fallback.

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

Yes, source establishes both mechanisms: repeated opaque arguments expand eagerly on main, while nested conditional resolve/join callees repeat argument tracing in this patch. No target code or tests were executed during this read-only review.

Is this the best way to solve the issue?

Yes, demand-driven tracing in the existing scanner is the narrow repair, provided demanded origins are reused within each invocation and the factory fallback remains typed as Origin.

Full review comments:

  • [P2] Compute demanded argument origins once per call — src/infra/package-root-imports.ts:371-372
    When a callee resolves to both path.resolve and path.join, each alternative invokes locations() and recursively traces the same arguments again. A nested chain using choose ? path.resolve : path.join doubles this work at every level, whereas the base computed arguments once. This previously reported blocker remains in the published head; reuse demanded origins within the invocation and retain an ambiguous-callee regression.
    Confidence: 0.99
  • [P2] Keep the factory fallback typed as an Origin — src/infra/package-root-imports.ts:377-381
    The new conditional combines Origin[] with an uncontextualized ["unknown"], widening the mapped location to string. Passing it to callerValues.has(location) produces TS2345 because that set accepts Origin, blocking typechecking. This previously reported defect remains; provide the fallback through an explicitly typed origin value or array without widening the contract.
    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 medium; reviewed against 9bf17b16a878.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded package-scanning performance repair with two unresolved published-head defects.
  • merge-risk: 🚨 availability: The introduced per-callee argument tracing can turn nested ambiguous path calls into exponential synchronous CPU work.
  • 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: The author is a repository MEMBER, so the external-contributor proof gate does not apply. The full captured body reports real-asset scanner and installed-manifest results for an explicitly unpublished correction; those results do not validate the defective published head. No stored-data contract changes.

Evidence

Acceptance criteria:

  • [P1] pnpm test src/infra/package-root-imports.test.ts --maxWorkers=1.
  • [P1] node scripts/run-vitest.mjs test/openclaw-npm-postpublish-verify.test.ts.
  • [P1] pnpm tsgo:core.
  • [P1] git diff --check.
  • [P1] Run the surviving Node bootstrap runtime-chunk consumer tests and record source-specific real-asset scanner and installed-manifest timings without executing the inspected asset.

What I checked:

  • Verified introduced patch: The pinned base-to-head diff introduces lazy argument tracing and one bounded subprocess regression. The original head’s raw commit records the supplied base as its parent. (src/infra/package-root-imports.ts:371, 8b1153008971)
  • Prior performance blocker remains: Each possible resolve or join callee invokes locations() separately. Conditional callee origins are unioned, so nested ambiguous calls recursively retrace their arguments for both alternatives; the base computed those arguments once. (src/infra/package-root-imports.ts:402, 8b1153008971)
  • Prior type blocker remains: The factory branch combines an Origin[] expression with a fresh uncontextualized ["unknown"] array. Its callback parameter widens to string, which is incompatible with callerValues.has accepting Origin. The author’s comment independently acknowledges the published TS2345 error. (src/infra/package-root-imports.ts:377, 8b1153008971)
  • Current main still needs the optimization: The complete current-main scanner retains eager argument tracing. The pinned base and fetched main have identical scanner contents; inspection of v2026.9.7 also shows the eager implementation. No merged scanner performance replacement is established by the related context. (src/infra/package-root-imports.ts:370, 9bf17b16a878)
  • Release behavior checked: The latest release’s call-expression branch computes all argument origins before resolving the callee, preserving the original opaque-call performance problem. (src/infra/package-root-imports.ts:370, c074824a27c9)
  • Production consumer: Node bootstrap packaging calls the scanner on package JavaScript and uses its relative imports to retain runtime chunks. This confirms that scanner CPU growth can stall a production packaging boundary. (src/gateway/worker-environments/node-bootstrap-runtime-chunks.ts:62, 9bf17b16a878)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • RomneyDa: 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.

  • Publish invocation-scoped argument reuse, the ambiguous-callee regression and the typed factory fallback.
  • Validate the corrected published scanner and direct package consumers with source-specific timing evidence.

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 (23 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-01T08:42:28.402Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T09:14:29.629Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T09:30:00.458Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T10:52:28.878Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T11:09:59.404Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T11:16:51.529Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T11:50:37.101Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin
  • reviewed 2026-10-01T11:58:57.955Z sha 8b11530 :: blocked before merge. :: [P2] Compute demanded argument origins once per call | [P2] Keep the factory fallback typed as an Origin

@fuller-stack-dev

fuller-stack-dev commented Sep 26, 2026 •

Copy link
Copy Markdown
Member Author

The correction remains unpublished. GitHub still has 8b115300897146a5afa7a5bae076e6849ca8642d; the reviewed local candidate is ffcc164fe808b3330c6a71ec65978e7f34a1d4ee.

The ambiguous-callee finding was real. The earlier candidate exceeded five seconds on 24 nested calls whose callee could be path.resolve or path.join; the correction completed that probe in 59 ms. It resolves callees once and prepares their required arguments once per invocation. The published TS2345 error is also corrected.

The scanner files are unchanged from the independently reviewed correction. On the current candidate, the exact original asset scans in 390 ms with the same import result. Current-context proof includes 183 focused tests and 23 independent source-blind semantic cases. The fixture is parsed only, never executed.

The previous native build and check passed, but its full test run was cancelled after the known browser/TUI baseline failures. Landed #158683 and #158748 are now incorporated. The candidate also carries the canonical #158778 lint prerequisite with author credit; focused lint, formatting, and three existing UI cases pass.

Native correction review validates READY. Full native correction gates are waiting for the coordinated local test slot; corrected-head publication, CI, and fresh Claw review still follow. No full-suite or release:check pass is claimed.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Sep 28, 2026
@fuller-stack-dev fuller-stack-dev self-assigned this Sep 29, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Sep 29, 2026
@fuller-stack-dev

Copy link
Copy Markdown
Member Author

Closing as superseded by #167121, merged as 245b7f6.

Current main at 9c199dc retains that scanner implementation. It resolves callees before exploring arguments and computes the required argument origins once per invocation, covering both the original opaque-call stall and the repeated ambiguous-callee work identified in this PR's review.

The merged PR records the same published rfb asset scanning in 196 ms, a regression that fails on the original implementation and passes through the release-verification consumer, and 78 passing tests. This reconciliation checked current source and that published evidence; it did not rerun those tests.

The intended fix is already on main. This PR's unpublished correction is preserved while its additional work is reconciled.

@RomneyDa
RomneyDa deleted the fix/package-import-scanner-cpu branch October 22, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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.

1 participant