Skip to content

fix: Replaced mutable module-global workspacePackagePaths - #64310

Closed
lucia-w wants to merge 1 commit into
openclaw:mainfrom
lucia-w:replace-mutable-list
Closed

lucia-w wants to merge 1 commit into
openclaw:mainfrom
lucia-w:replace-mutable-list

Conversation

@lucia-w

@lucia-w lucia-w commented Apr 10, 2026 •

Copy link
Copy Markdown

…ble base list

Summary

This PR fixes scripts/audit-seams.mjs so repeated main() calls in the same Node process are idempotent and do not duplicate workspace package entries.

  • workspacePackagePaths was a mutable module-level array.
    collectWorkspacePackagePaths() appended extension package paths on every main() invocation, so calling main() multiple times in-process caused duplicate missingPackages entries.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #
  • Related #
  • This PR fixes a bug or regression

Root Cause (if applicable)

For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write N/A. If the cause is unclear, write Unknown.

  • Root cause:
  • Missing detection / guardrail:
  • Contributing context (if known):

Regression Test Plan (if applicable)

For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write N/A.

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file:
  • Scenario the test should lock in:
  • Why this is the smallest reliable guardrail:
  • Existing test that already covers this (if any):
  • If no new test is added, why not:

User-visible / Behavior Changes

List user-visible changes (including defaults/config).
If none, write None.

Diagram (if applicable)

For UI changes or non-trivial logic flows, include a small ASCII diagram reviewers can scan quickly. Otherwise write N/A.

Before:
[user action] -> [old state]

After:
[user action] -> [new state] -> [result]

Security Impact (required)

  • New permissions/capabilities? (Yes/No)
  • Secrets/tokens handling changed? (Yes/No)
  • New/changed network calls? (Yes/No)
  • Command/tool execution surface changed? (Yes/No)
  • Data access scope changed? (Yes/No)
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS:
  • Runtime/container:
  • Model/provider:
  • Integration/channel (if any):
  • Relevant config (redacted):

Steps

Expected

Actual

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
  • Edge cases checked:
  • What you did not verify:

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.

Compatibility / Migration

  • Backward compatible? (Yes/No)
  • Config/env changes? (Yes/No)
  • Migration needed? (Yes/No)
  • If yes, exact upgrade steps:

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk:
    • Mitigation:

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Apr 10, 2026
@greptile-apps

greptile-apps Bot commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes scripts/audit-seams.mjs by converting workspacePackagePaths from a mutable module-level array to a local variable returned by collectWorkspacePackagePaths(), and threading it explicitly into buildMissingPackages. The change correctly makes repeated main() calls idempotent with no duplicate entries.

The only minor observation is that buildMissingPackages still calls .toSorted(compareStrings) on the paths array (line 500) even though collectWorkspacePackagePaths() already returns a pre-sorted result — this is redundant but harmless.

Confidence Score: 5/5

Safe to merge — the fix is correct, well-scoped, and introduces no regressions.

The only finding is a P2 redundant sort call that has no effect on correctness or output. All other aspects of the change are solid: idempotency is achieved, buildMissingPackages is not exported so the ?? [] default is safe, and no other callers exist.

No files require special attention.

Comments Outside Diff (1)

  1. scripts/audit-seams.mjs, line 500 (link)

    P2 Redundant sort in buildMissingPackages

    collectWorkspacePackagePaths already returns a sorted array (via .toSorted(compareStrings) in its return statement), so the .toSorted(compareStrings) call here is a no-op. Consider removing it or adding a comment if the defensiveness is intentional.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: scripts/audit-seams.mjs
    Line: 500
    
    Comment:
    **Redundant sort in `buildMissingPackages`**
    
    `collectWorkspacePackagePaths` already returns a sorted array (via `.toSorted(compareStrings)` in its return statement), so the `.toSorted(compareStrings)` call here is a no-op. Consider removing it or adding a comment if the defensiveness is intentional.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: scripts/audit-seams.mjs
Line: 500

Comment:
**Redundant sort in `buildMissingPackages`**

`collectWorkspacePackagePaths` already returns a sorted array (via `.toSorted(compareStrings)` in its return statement), so the `.toSorted(compareStrings)` call here is a no-op. Consider removing it or adding a comment if the defensiveness is intentional.

```suggestion
  for (const relativePackagePath of workspacePackagePaths) {
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: Replaced mutable module-global work..." | Re-trigger Greptile

@clawsweeper

clawsweeper Bot commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Keep open: current main still has the mutable module-global package-path list, and the proposed state-localizing change is a narrow, likely correct fix. It is not merge-ready because this external PR still lacks after-fix real behavior proof and needs a branch refresh for the required Dependency Guard path.

Canonical path: Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

So I’m closing this here because the remaining work is already tracked in the canonical issue.

Review details

Best possible solution:

Close this stale PR. The latest review rated it F, the branch still lacks merge-ready proof, and there has been no human follow-up after the durable review.

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

No high-confidence live reproduction was completed because the read-only runtime probe could not load the missing local typescript dependency. Source inspection clearly shows repeated in-process main() calls append extension package paths into the same module-global list before missing-package scanning reads it.

Is this the best way to solve the issue?

Yes, this is the best fix shape: collecting a fresh list per invocation removes the shared mutable state at the source. De-duplicating only inside buildMissingPackages() would hide duplicate output while preserving the underlying mutation.

Security review:

Security review cleared: No concrete security or supply-chain concern found; the diff only changes local array lifetime in an in-repo audit script.

AGENTS.md: found and applied where relevant.

What I checked:

  • stale F-rated PR: PR was opened 2026-04-10T12:52:19Z, is older than 60 days, and the latest review rated it F.
  • proof blocker: real behavior proof is missing and proof tier is F, so this branch is not merge-ready without contributor follow-up.
  • no human follow-up: live comments and timeline hydrated by apply contain no non-automation activity after the ClawSweeper review.

Likely related people:

  • Takhoffman: GitHub file history shows this account introduced and expanded the audit-seams inventory surface and added adjacent tests in March 2026. (role: feature-area contributor; confidence: high; commits: ea476de1e488, 5cd8d43af923, 50d996a6ec7c; files: scripts/audit-seams.mjs, scripts/audit-plugin-sdk-seams.mjs, test/scripts/audit-seams.test.ts)
  • steipete: Recent history shows changes to the same audit script and the bundled-plugin path helper used by the workspace package collection path. (role: recent adjacent contributor; confidence: medium; commits: 8e0ab35b0ed0, b653d949183d, c8bb7330b5cf; files: scripts/audit-seams.mjs, scripts/lib/bundled-plugin-paths.mjs, test/scripts/audit-seams.test.ts)
  • vincentkoc: Earlier history on the previous audit script name changed optional bundled-cluster and missing-package classification logic near the affected surface. (role: adjacent missing-package contributor; confidence: medium; commits: 73539ac78720, d8008a9a678c; files: scripts/audit-plugin-sdk-seams.mjs, scripts/audit-seams.mjs)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels May 19, 2026
@openclaw-barnacle openclaw-barnacle Bot added the triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. label May 19, 2026
@clawsweeper

clawsweeper Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper PR egg

🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat.

Where did the egg go?
  • The egg game starts only after the PR passes the real-behavior proof check.
  • Before that, no creature or rarity is rolled. The treat waits for real proof.
  • This is still just collectible flavor: proof affects review readiness, not creature quality.

@RomneyDa

Copy link
Copy Markdown
Member

Heads up: this PR needs to be updated against current main before the new required Dependency Guard check can pass.

@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale due to inactivity.
Please add updates or it will be closed.

@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

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

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XS stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants