Skip to content

fix(build): avoid duplicate asset copies during merge conflict resolution - #148907

Merged
roboclaw-bot merged 1 commit into
mainfrom
openclaw/qa-build-source-inventory
Sep 17, 2026
Merged

roboclaw-bot merged 1 commit into
mainfrom
openclaw/qa-build-source-inventory

Conversation

@roboclaw-bot

@roboclaw-bot roboclaw-bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Fixes repeated asset discovery and copying when a plugin’s working-tree package.json is resolved but the Git index still contains multiple merge stages.

User Impact

Development builds copy each package’s declared asset once in that state. Normal asset membership, copied bytes, malformed-package errors, custom-filesystem handling, and build selectors stay unchanged. No configuration, permission, or migration changes.

Why This Change Was Made

Static-asset discovery now consumes the existing tracked plugin-metadata inventory instead of maintaining its own Git/deleted-file scanner. Package-only filtering remains in the asset adapter; all-file build discovery and filesystem-only generated-asset discovery retain their distinct contracts. This removes 36 net production lines without adding another mode, cache, or manager.

Evidence

  • Real Git/filesystem proof: three retained index stages caused five copies for three destinations before the repair; the shared inventory yields three copies with identical bytes. Normal, external-plugin, custom-filesystem, empty-index, Git-failure, and malformed-package controls were checked; Git metadata discovery made no directory-scan calls.
  • After the patch-identical base refresh, the parent reran the real Git/filesystem probe, 116 targeted tests across three files, and the core TypeScript boundary check on 21da8de8782e37742655d8b23f810dee1adb0987; all passed. All three changed file blobs and the patch identity match the independently reviewed implementation.
  • Original pre-refresh validation at e5553ac6fab9 included 125 focused tests, all 22 changed checks, both full builds, and unchanged hashes for 16 normal static assets. These historical results are not labeled as fresh-head CI.
  • Independent P0–P2 review of the unchanged owner-level patch found no actionable issues.
  • Fresh exact-head CI and current-head ClawSweeper review remain required before native landing.
Previous baseline failure

Run 34946426677 failed on duplicate secrets-test shard assignments inherited from main’s #148889, not this three-file asset delta. The historical failure is retained. Main was repaired through #148826; no CI gate was overridden.

Worked on by: @steipete, @vincentkoc

Work session: https://team.openclaw.ai/chat/roboclaw/dashboard/87f70663-f8cc-4245-b720-dd460489dc35

@clawsweeper

clawsweeper Bot commented Sep 15, 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.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: S maintainer Maintainer-authored PR labels Sep 15, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 15, 2026
@clawsweeper

clawsweeper Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 16, 2026, 2:25 PM ET / 18:25 UTC (Revision 5).

ClawSweeper review

What this changes

Development builds reuse the shared plugin inventory to avoid copying static assets repeatedly while Git retains multiple merge-conflict stages, with regression coverage.

Merge readiness

✅ Ready for maintainer review

This fix remains useful: current main and the latest release retain the duplicate-discovery path. No actionable correctness or security defects were found, and exact-head CI passed.

Priority: P2
Reviewed head: 21da8de8782e37742655d8b23f810dee1adb0987

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-level repair with meaningful regression coverage, recorded filesystem validation, and passing exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: The bot/member PR is exempt from the external-contributor proof gate; its body nevertheless records production asset-copy observations using real Git index stages and files, with five copies reduced to three and bytes preserved.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The bot/member PR is exempt from the external-contributor proof gate; its body nevertheless records production asset-copy observations using real Git index stages and files, with five copies reduced to three and bytes preserved.
Evidence reviewed 9 items Verified introduced change: The local merge-base-to-head diff matches the supplied introduction evidence: it exports the existing inventory, replaces the independent asset scanner, and adds the conflict-stage regression. Unrelated endpoint drift was excluded.
Existing owner provides deduplication: The inventory accumulates metadata in a Map keyed by plugin directory, filters deleted paths, returns null on Git failure, and does not parse manifests. The asset adapter retains package-only filtering and custom-filesystem fallback.
Current main still needs the repair: Current main maps each Git output line to a package independently; repeated index-stage entries therefore survive into discovery and the copy loop.
Findings None None.
Security None None.

How this fits together

OpenClaw’s build tooling reads plugin package declarations and copies their static files into build outputs. The shared inventory turns tracked metadata paths into one entry per plugin before asset discovery.

flowchart TD
  A[Git metadata paths] --> B[Shared plugin inventory]
  B --> C[Packages with metadata]
  D[Filesystem fallback] --> C
  C --> E[Declared static assets]
  E --> F[Build output copies]
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +53, Other -36. Total +17 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 53 0 +53
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 2 8 44 -36
Total 3 61 44 +17

Review metrics

None.

Technical review

Best possible solution:

Keep one shared tracked-metadata inventory while preserving asset-specific package filtering, build selectors, and filesystem fallback.

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

Yes, from source: retained Git index stages produce repeated package entries and repeated copies on current main. The regression fixture encodes that trigger; this reviewer did not execute it.

Is this the best way to solve the issue?

Yes. Reusing the existing directory-keyed inventory removes the duplicate scanner while preserving the asset adapter’s distinct contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 29069179def6.

Labels

Label justifications:

  • P2: This repairs redundant development-build work during merge conflict resolution with limited operational impact.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The bot/member PR is exempt from the external-contributor proof gate; its body nevertheless records production asset-copy observations using real Git index stages and files, with five copies reduced to three and bytes preserved.

Evidence

What I checked:

  • Verified introduced change: The local merge-base-to-head diff matches the supplied introduction evidence: it exports the existing inventory, replaces the independent asset scanner, and adds the conflict-stage regression. Unrelated endpoint drift was excluded. (scripts/lib/static-extension-assets.mts:64, 21da8de8782e)
  • Existing owner provides deduplication: The inventory accumulates metadata in a Map keyed by plugin directory, filters deleted paths, returns null on Git failure, and does not parse manifests. The asset adapter retains package-only filtering and custom-filesystem fallback. (scripts/lib/bundled-plugin-source-utils.mts:50, 21da8de8782e)
  • Current main still needs the repair: Current main maps each Git output line to a package independently; repeated index-stage entries therefore survive into discovery and the copy loop. (scripts/lib/static-extension-assets.mts:87, 29069179def6)
  • Latest release retains the old scanner: The v2026.9.4 source also contains the independent scanner without deduplication; this is not an already-shipped repair. (scripts/lib/static-extension-assets.mts:81, 3a9d69db306c)
  • Regression exercises the production copy boundary: The added test creates three actual Git index stages, invokes production asset copying with real files, checks three copy operations, verifies package membership, and reads back identical bytes. Invalid manifests also guard against accidentally introducing manifest parsing. (test/scripts/runtime-postbuild.test.ts:179, 21da8de8782e)
  • Captured validation and review continuity: The supplied body snapshot, sourceRevision 01cef93039aeb2bedb1b20c43f365d1e34134877778d8190f0f7130eb1bfb184, reports a real Git/filesystem probe reducing five copies to three with identical bytes, rerun on the reviewed head alongside 116 targeted tests and a core typecheck. The previous completed review of this same head records no findings. These are submitted observations; this read-only review did not execute tests. (21da8de8782e)

Likely related people:

  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)
  • unknown: The claimed source-line change could not be verified from bounded local history. (role: source history unknown; confidence: low)

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 (4 earlier review cycles)
  • reviewed 2026-09-15T08:19:07.046Z sha e5553ac :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T08:24:58.347Z sha e5553ac :: needs maintainer review before merge. :: none
  • reviewed 2026-09-15T09:13:12.677Z sha e5553ac :: needs maintainer review before merge. :: none
  • reviewed 2026-09-16T18:00:50.960Z sha 21da8de :: needs maintainer review before merge. :: none

@roboclaw-bot
roboclaw-bot marked this pull request as ready for review September 15, 2026 08:20
@roboclaw-bot
roboclaw-bot force-pushed the openclaw/qa-build-source-inventory branch from e5553ac to 21da8de Compare September 16, 2026 17:54
@roboclaw-bot
roboclaw-bot merged commit aceff32 into main Sep 17, 2026
87 checks passed
@roboclaw-bot
roboclaw-bot deleted the openclaw/qa-build-source-inventory branch September 17, 2026 00:58
@roboclaw-bot

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

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

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant