Skip to content

perf(ci): avoid duplicate receipt input validation - #198708

Merged
vincentkoc merged 1 commit into
mainfrom
perf/ci-receipt-path-validation-20261114
Nov 14, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
perf/ci-receipt-path-validation-20261114

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Warm extension boundary checks validate the same input paths twice while parsing compiler receipts.

User Impact

This is an internal CI optimization. Compiler diagnostics, cache invalidation and physical checkout boundaries remain unchanged.

Why This Change Was Made

Validate lookup paths once, require the input inventory to match the sorted successful read lookups exactly, and return that validated inventory. The receipt still rejects malformed, duplicate, noncanonical and escaping inputs.

Evidence

  • Exploratory full 146-plugin baseline on a 4-CPU / 8-GiB Boat runner: cold pass 434.19 seconds; instrumented warm pass 93.55 seconds with all 146 compiles skipped.
  • The exploratory profile attributed about 60 seconds to receipt parsing and counted 6,136,395 native realpath calls and 7,976,220 existence checks. This is diagnosis, not a paired savings claim.
  • Independent static review of the complete two-file diff against 7e69bf4c26b3cd00789f55ee4f6185af8aa2dbf3: no actionable correctness or security findings.
  • Four focused boundary/snapshot suites passed (two Vitest shards; 27.31 seconds wall). The extended receipt suite passed in 2.00 seconds. Script and tooling-test typechecks, scoped lint, and oxfmt/Bun parity all passed on the exact candidate bytes.
  • Local committed-range ClawSweeper review completed against base 7e69bf4c26b3cd00789f55ee4f6185af8aa2dbf3 and head 275391d43f6a450a90f0a5850df3f62affeda941: no actionable correctness or security findings.
  • Five-pair warm qualification passed the acceptance rule below. Median compile-phase time decreased 11.2%; median total wall time decreased 11.1%; median total CPU decreased 11.1%. No memory or p95 limit regressed.
  • Actual candidate cold full boundary pass: all 146 plugins compiled, exit 0, 496.78s wall, 348.98s compile phase, 147.51s preparation, 1,023.30 CPU seconds and 5,090,664 KiB peak RSS. No source overlay or NODE_OPTIONS was used. The earlier unpaired baseline cold run took 434.19s; this single later cold run is slower and is correctness proof, not controlled evidence of a cold-path speedup. The acceptance timing comparison above is warm-only. Cold run: run_586e22053bcf5a78e131a0f3bfb28115.

Performance acceptance rule — recorded before qualification

Run the full 146-plugin CLI in compile mode on the same frozen source, dependency installation, hardware and prepared receipts. Use exact baseline/candidate source overlays so compiler-generator identity does not force recompilation between variants. Exclude one warmup per variant, then run five serial alternating baseline/candidate pairs.

Accept only with at least 5% lower median compile-phase time, no increase in median total wall time or total CPU, and no 20% regression in median or p95 wall time, compile time, total CPU or peak RSS. Report all samples, median and p95, filesystem operation counts, observed hardware/load and an unchanged receipt digest. Profile the accepted candidate. The complete candidate also needs a cold full boundary pass.

Command: CI=true OPENCLAW_CI_EXTENSION_BOUNDARY_FULL=1 node scripts/check-extension-package-tsc-boundary.mts --mode=compile.

Measured warm results

Frozen base: 7e69bf4c26b3cd00789f55ee4f6185af8aa2dbf3. Candidate: 275391d43f6a450a90f0a5850df3f62affeda941.
Boat direct Linux runner, observed 4 CPUs / affinity 4 / 8,130,928 KiB memory. Measured-pair load averages were about 1.0–1.3. Requested profile: standard. This is Boat evidence, not Blacksmith billing evidence.

The same complete 64,951-file source tree, installation and receipts were used for both variants. The exact source overlay was inherited by Node preparation children as well as the parent. Physical generator inputs stayed fixed during the paired run. A priming run and one warmup per variant were excluded. All ten measured runs compiled 0 and skipped all 146 plugins.

Pair Variant Wall (s) Compile phase (s) CPU user + system (s) Peak RSS (KiB)
1 baseline 90.65 80.577 94.27 1172692
1 candidate 83.11 73.744 86.71 1176876
2 baseline 92.75 82.396 96.91 1177380
2 candidate 81.39 72.068 85.20 1204192
3 baseline 95.84 85.836 99.80 1186076
3 candidate 82.41 73.186 86.19 1176560
4 baseline 94.31 83.638 98.23 1181192
4 candidate 83.88 73.944 87.84 1174300
5 baseline 92.11 81.735 96.01 1177100
5 candidate 81.63 72.106 85.27 1188732
Metric Baseline median / p95 Candidate median / p95
Wall (s) 92.748 / 95.841 82.414 / 83.884
Compile phase (s) 82.396 / 85.836 73.186 / 73.944
CPU user + system (s) 96.91 / 99.80 86.19 / 87.84
Peak RSS (KiB) 1,177,380 / 1,186,076 1,176,876 / 1,204,192

p95 is nearest-rank (the maximum for five samples). Peak-RSS p95 increased 1.5%, below the 20% rejection limit.

Separate instrumented runs counted the SDK-preparation Node process, not the whole process tree: existence checks 804,181 → 739,336; native realpath calls 659,537 → 594,692; file reads unchanged at 44,851; stat calls unchanged at 56,607. These counts are diagnostic and excluded from timing aggregates.

The final candidate CPU profile still shows filesystem path work as the main cost (self samples: native realpath 20.57s, path resolve 10.69s, existence checks 9.98s). No new cache or relaxed boundary check was introduced.

All 438 receipt JSON files remained byte-for-byte unchanged through the paired, count and profile runs; aggregate SHA-256 6e779aa09314357ca3cddf57623d54acc3c5a1540391b6c1afd44bedabda6bc4.

Benchmark run: run_6d9344274f499fee7faef9507f06fdc1; Boat lease cbx_9af785c7e75e. No public run URL was provided. This establishes a warm-path runtime gain on the measured machine; it does not estimate fleet-wide or dollar savings.

@vincentkoc vincentkoc self-assigned this Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 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: XS labels Nov 14, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 14, 2026
@clawsweeper

clawsweeper Bot commented Nov 14, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR removes repeated input-path validation by reusing validated successful compiler lookups.

Example: A valid receipt lists src/index.ts as both an input and a successful readFile lookup.

  • Before: The parser validates src/index.ts through both inventories.
  • After: The parser validates the lookup once and requires the input inventory to match it exactly.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is minimal and source-supported; reported focused validation supports correctness, while performance benefit remains unqualified.
Proof confidence 🦐 gold shrimp (3/6) This internal CI optimization requires no user-facing shipped-entry-point demonstration; the existing test exercises the real compiler and receipt owner.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Performance · Worth it: Yes · Fix scope: Complete
User problem: Warm extension boundary checks spend unnecessary filesystem work validating paths already validated in compiler lookups.
Reason: The maintainer-authored direction removes demonstrated duplicate work without adding state, configuration, or a competing implementation.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep this maintainer-authored PR open: the change is focused and preserves receipt validation, with no actionable correctness or security findings.

Priority: P3
Reviewed head: 275391d43f6a450a90f0a5850df3f62affeda941

Before merge

  • Complete next step - The PR author should complete the recorded alternating baseline/candidate qualification and cold full boundary pass, then publish the results against the existing acceptance rule.

Findings

None.

Agent review details

How this fits together

Extension boundary CI consumes compiler receipts and checkout files, validates recorded inputs and resolution facts, and decides whether cached compilation results remain reusable.

flowchart LR
  A[Boundary CI] --> B[Compiler receipts]
  B --> C[BoundaryInputSnapshot]
  D[Checkout files] --> C
  C --> E[Validated inputs and lookups]
  E --> F[Reuse or compile]
Loading

Technical review

Best possible solution:

Keep the existing receipt parser as the sole validation owner and qualify this minimal removal of redundant work against the recorded acceptance rule.

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

Current-main source directly shows the same input paths validated through lookups and again through info.inputs; this read-only review ran no target code.

Is this the best way to solve the issue?

The patch is the smallest complete change: reuse already validated reads while preserving exact inventory equality, lookup uniqueness, physical containment, and resolution replay.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 569bf22dba45.

Provenance checked

  • Compiler receipt input validation keeps the original intent (f7468c5: Enable reuse across unrelated file additions by recording compiler resolution observations and requiring an exact successful-read inventory.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned change preserves validation: Every lookup path still passes normalizedPath; unique sorted lookup keys and exact input-to-successful-read equality remain required. The parser returns the validated read inventory without introducing another owner. (scripts/lib/extension-boundary-inputs.mts:201, 275391d43f6a)
  • Current main retains duplicate validation: Fetched main still maps normalizedPath over info.inputs after validating lookup paths, so this optimization remains distinct work. (scripts/lib/extension-boundary-inputs.mts:201, 569bf22dba45)
  • Malformed receipt coverage: The existing production-owner test gains empty, null, escaping, and duplicate input inventories while retaining real native compilation and resolution-invalidation coverage. (test/scripts/extension-boundary-cache.test.ts:121, 275391d43f6a)
  • Original receipt intent: The original commit introduced lookup-backed reuse across unrelated file additions together with strict inventory equality; this PR preserves that intent. (scripts/lib/extension-boundary-inputs.mts:201, f7468c5161ce)
  • Qualification explicitly pending: The full PR body records exploratory baseline measurements, reports focused checks passing, and explicitly keeps the PR draft until its predefined paired performance rule and cold boundary pass succeed. (275391d43f6a)
  • Exact-head CI coverage: The five successful checks cover routing, labeling, scope detection, and actionlint; the remaining checks, including the CI gate, are skipped and establish no broad code-validation result. (275391d43f6a)

Likely related people:

  • Peter Steinberger: Raw commit f7468c5 adds scripts/lib/extension-boundary-inputs.mts:165 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: f7468c5161ce; files: scripts/lib/extension-boundary-inputs.mts)
  • Vincent Koc: Raw commit 1cd7d2e adds scripts/lib/extension-boundary-inputs.mts:266 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 1cd7d2ec2319; files: scripts/lib/extension-boundary-inputs.mts)

PR surface

Tests +4, Other -1. Total +3 across 2 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 4 0 +4
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 3 -1
Total 2 6 3 +3

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Labels

Label changes:

  • add P3: This is an internal CI efficiency improvement with unchanged compiler diagnostics and cache semantics.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P3: This is an internal CI efficiency improvement with unchanged compiler diagnostics and cache semantics.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 14, 2026, 1:45 AM ET / 06:45 UTC.

@vincentkoc
vincentkoc marked this pull request as ready for review November 14, 2026 07:08
@vincentkoc
vincentkoc enabled auto-merge (squash) November 14, 2026 07:15
@vincentkoc
vincentkoc merged commit 854d241 into main Nov 14, 2026
195 checks passed
@vincentkoc
vincentkoc deleted the perf/ci-receipt-path-validation-20261114 branch November 14, 2026 07:17
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash auto-merge.

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: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XS 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