Repository navigation
Conversation
Share data classification only within one synchronous iterator-result read. Preserve mutation rechecks and nested consumer admission while reducing repeated payload walks. Add an old-code-failing regression and a reproducible streaming allocation benchmark.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs maintainer review before merge. Reviewed September 28, 2026, 8:13 PM ET / September 29, 2026, 00:13 UTC (Revision 5). ClawSweeper reviewWhat this changesThe branch shares plain-data classification during one synchronous plugin stream result read and adds a regression test and runnable allocation benchmark. Merge readiness✅ Ready for maintainer review Keep open. Current main still repeats payload classification across nested plugin stream readers. The branch has measured benefit and no identified blocking defect; the linked CI repairs address separate failures. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw wraps plugin-produced stream events before host consumers read them. The plugin instance classifies payloads and enforces the consuming plugin lease before returning data or scoped callable views. flowchart LR
A[Plugin stream event] --> B[Plugin instance wrapper]
B --> C[Iterator result reader]
D[Consumer lease] --> C
C --> E{Plain data?}
E -->|Yes| F[Host receives payload]
E -->|No| G[Scoped plugin access]
G --> F
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +24, Tests +37, Config +1, Other +95. Total +157 across 4 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep classification scoped to one synchronous result read while preserving fresh mutation checks and every consumer lease check. Do we have a high-confidence way to reproduce the issue? Yes. Current-main source shows repeated classification across projected nested result reads, and the PR supplies a baseline comparison; this read-only review did not execute the benchmark. Is this the best way to solve the issue? Yes. The change stays in the existing plugin instance reader, shares only a synchronous fact, and adds no persistent cache or public SDK surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3ea44e871e1a. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
…stream-event-20260919
…0208) Share data classification only within one synchronous iterator-result read. Preserve mutation rechecks and nested consumer admission while reducing repeated payload walks. Add an old-code-failing regression and a reproducible streaming allocation benchmark.
What Problem This Solves
Nested plugin stream boundaries repeatedly walk the same event payload during a single value read, increasing allocation and garbage-collection pressure during streamed replies.
User Impact
Reduces stream-boundary allocation without changing the Plugin SDK, configuration, event identity, or lifecycle behavior. Arbitrary mutable payloads still require an initial classification, and iterator calls retain their scope and authority checks. Live Gateway impact has not been measured.
Why This Change Was Made
Carry a completed data classification through one synchronous chain of branded iterator-result readers. Discard it after that read and before executable fallbacks. Later reads reclassify mutations, and callable chunks still receive each consumer's lifecycle fence. No persistent object cache or new invalidation owner is introduced. Production growth is 24 net lines.
Register
bench:plugins:streamas the benchmark's runnable package command so dependency analysis recognizes its real entrypoint.Evidence
Synthetic provider fixture: 2,000 events (4,157-byte base payload plus a sequence field) and one 204,934-byte tool result, with zero or five additional managed forwarding layers. Five timing samples per scenario; V8 allocation sampling at 512 bytes, including collected objects. Run with
pnpm bench:plugins:stream.Refreshed comparison on Node v24.19.0, pinned main baseline
b884d2a10f77versus candidateaf98c7c11a29, on Blacksmith Testbox leasetbx_01m3n4c1cs5x93c6md18n7kkzm(run):Allocation fell 54.6% and median time/event fell 39.9% in the refreshed comparison, consistent with the earlier 54–55% allocation reduction. The single-boundary control measured 0.02160 → 0.02228 ms/event and 65.2 → 65.5 KB/event. Timing varies between runs; this is a bounded improvement, not O(1) processing.
Previous unchanged-production proof: the regression failed on baseline with two payload walks instead of one, and verifies that methods added between reads receive the outer consumer's fence. SDK/embedded-runner coverage passed 7,525 tests in 654 files, with 13 existing skips. The changed test file passed 28 tests in 17.13 s wrapper wall (15.04 s Vitest, mostly cold transformation). The original proof and final measurement used Blacksmith Testbox leases
tbx_01m3k6mb08pcy8xer43epf7d2xandtbx_01m3k8favfbew8b9ekbtpcm6g2(run).CI repair attribution
The interrupted integration of main was completed without changing the production optimization, regression, or benchmark bytes.
check-dependencies/ job109032564584: Knip reportedscripts/bench-plugin-stream.tsas its sole unused file. Fixed by registering the package command; no ignore or budget exception was added.check-source-contracts/ job109032562718: nine daemon CLI export collisions, reported before the successful SQLite schema check. Incorporated main's385ac2893544andf010fc0b5790(fix(tooling): stop reporting lazy imports as duplicate exports #160558), which repair the forwarder/export scanner behavior. These paths are outside this PR's diff.checks-node-changed-compact-small-40/ job109032573990: the large piped JSON case inhelp-exit.process.test.tstimed out after 100000 ms. Main's2ca9f7b710f7applies the shared child-process/V8 policy. The original hang was not reproduced and its cause remains unresolved; this is not a claim that a passing replay proves a fix.checks-ui-e2e (4/9)/ job109032562633: Markdown table landscape width was 350 instead of 892. This PR changes no UI files. The exact test passed in 4125 ms on main run36486479600, SHAa46cde88785d, job109144735009; all 11 tests in its file passed. No speculative UI change was made.The same main run also passed source-contracts job
109144734974and compact-small-40 job109144738667.Refreshed remote validation
Provider
blacksmith-testbox, profileopenclaw-check, leasetbx_01m3n4c1cs5x93c6md18n7kkzm. The native sync checkout has its own Git checkpoint; all four candidate file hashes were verified before execution. Missing dependencies were installed once withpnpm install --frozen-lockfile. No local suites, typechecks, or builds ran.node scripts/run-vitest.mjs src/plugins/plugin-instance src/plugins/runtime/gateway-request-scope --reporter=dot: 75 tests in four files passed, 27.09 s wrapper wall.node scripts/run-vitest.mjs src/plugins/plugin-instance-{iterables,constructors,callbacks,arguments,reflection,invocation,registry,error}.test.ts --reporter=dot: 259 tests in eight files passed, 12.58 s wrapper wall. Combined focused proof: 334 tests / 12 files.node --expose-gc --import ./scripts/tsx.mjs scripts/bench-plugin-stream.ts: baseline and candidate both completed on the same lease; baseline used a detached temporary worktree, removed afterward. Results above.node --import ./scripts/tsx.mjs scripts/check-export-name-collisions.mts: passed.pnpm deadcode:unused-files: both production and full-tree scans passed with zero entries.node scripts/check-changed.mjs --base b884d2a10f77d9fb53ee385abb959b525e7232ea -- package.json scripts/bench-plugin-stream.ts src/plugins/plugin-instance-iterables.test.ts src/plugins/plugin-instance-value-views.ts: conflict markers, line-cap, and max-lines checks passed; its embedded environment-count check failed because the existing budget is 476 while both baseline and candidate have exactly 477 names. An independent baseline/candidate comparison found no added or removed names. No budget exception was added.The existing completed review at
bc1081a956a7has no actionable findings; the production, test, and benchmark bytes remain identical, so that review is retained for the mechanical integration. Fresh autoreview attempts did not produce a report: one exited with an engine failure and two stalled and were stopped. They are not counted as passing reviews.Initial lease
tbx_01m3n3sjte3zmdnnr7f70jmtmkwas stopped after native full synchronization hit the five-minute completion watchdog; no validation ran there. The replacement synchronized successfully. No live Gateway was modified or profiled.The 35 remaining leaf checks from the changed-check plan were then run serially on the same lease: 34 passed, including core types (68.62 s), all 26 core-test type groups (1287.84 s), script types (49.50 s), SDK surface/exports/boundaries, script lint, dead exports, and the remaining architecture guards. Broad
pnpm lint:corefailed on unchanged line-limit violations:src/gateway/worker-environments/node-launch-adapter.test.ts(1009/1000),src/gateway/talk/relay/session-create.ts(702/700),src/commands/doctor/shared/missing-configured-plugin-install.repair.ts(746/700), andsrc/config/config-env-vars.ts(798/700). The four files and.oxlintrc.jsonwere verified identical to the pinned main baseline. No suppressions or baseline increases were added.node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json src/plugins/plugin-instance-iterables.test.ts src/plugins/plugin-instance-value-views.tspassed with zero warnings/errors in 5.9 s. Final candidate hashes still matched. Both lane leases are stopped.Final hosted CI
CI run 36501433313 completed successfully for
af98c7c11a298810bff2b75cf7d9ded484f4d478, with no failed jobs. Source contracts, dependencies, all Node shards, UI shard 4/9, both core-lint jobs, baseline ratchets, Docker seed E2E, andopenclaw/ci-gatepassed. The earlier pinned-baseline failures remain documented above.GitHub auto-merge completed at 2026-09-29 00:34 UTC as
fd17d340ad9e69e4fcecd9c2be2931657eed29de.