Repository navigation
refactor(packages): deslop shared packages - #158571
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 26, 2026, 3:24 AM ET / 07:24 UTC (Revision 7). ClawSweeper reviewWhat this changesThe branch consolidates shared provider, parsing, media, memory, and Gateway-client code and repairs Unicode embedding chunk loss and cancelled browser scope-upgrade continuations. Merge readiness⛔ Blocked before merge - 1 item remains Current main and the latest release still contain the two defects addressed here, so this PR remains useful. Review of the pinned diff found no actionable introduced defect; the pending exact-head check remains part of normal merge gating. Priority: P2 Review scores
Verification
How this fits togetherShared packages connect OpenClaw’s agent and Gateway callers to model providers, memory indexing, media requests, and browser device access. They normalize inputs and results before replies are delivered or approved device tokens are stored. flowchart LR
A[Agent and Gateway callers] --> B[Shared package adapters]
B --> C{Normalize and validate}
C --> D[Model provider calls]
C --> E[Memory chunks]
C --> F[Browser scope upgrade]
D --> G[Replies]
E --> G
F --> H[Stored device token]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -1523, Tests +102, Other -2. Total -1423 across 68 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the consolidated package owners and focused regressions, preserving public exports and approved-token persistence through the normal exact-head merge gates. Do we have a high-confidence way to reproduce the issue? Yes, at source level: the old splitter can stop after backing up to an empty segment, and the old scope-upgrade path can continue after cancellation of a settled request. This read-only review did not execute either path. Is this the best way to solve the issue? Yes. The refactor reuses existing package owners, and the added regressions target the two distinct behavior fixes without adding configuration or a parallel runtime. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a7ded174bd96. 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 (6 earlier review cycles)
|
2c8f200 to
8e857ae
Compare
|
1aafe4d to
8b00dec
Compare
Consolidate shared provider setup, schema cleaning, parsing, stream projection, and type owners while preserving package entrypoints and wire contracts. Keep complete Unicode input under tiny embedding chunk limits. Retire cancelled device-scope upgrade continuations while preserving received rotated credentials and settling accepted persistence before suppressing stale reconnects. Testbox proof covers package and cross-shard consumer suites, standalone package acceptance, full build, SDK surfaces, byte-identical Markdown fixture comparisons, and the complete changed gate. Both defects have regressions that fail on base.
Use the explicit TypeScript sibling path for native Node tooling while retaining the shared string-coercion owner. Package bundling and public exports remain unchanged. The existing native declaration suite reproduced the loader failure before this repair and passes afterward. Both captured CI groups pass (3,032 tests), along with normalization tests, its standalone build, generated assets, targeted lint, built-package consumption, and fresh review.
8b00dec to
e2930e5
Compare
* refactor(packages): deslop shared packages Consolidate shared provider setup, schema cleaning, parsing, stream projection, and type owners while preserving package entrypoints and wire contracts. Keep complete Unicode input under tiny embedding chunk limits. Retire cancelled device-scope upgrade continuations while preserving received rotated credentials and settling accepted persistence before suppressing stale reconnects. Testbox proof covers package and cross-shard consumer suites, standalone package acceptance, full build, SDK surfaces, byte-identical Markdown fixture comparisons, and the complete changed gate. Both defects have regressions that fail on base. * build(workboard): refresh shared package asset reference * fix(packages): preserve native numeric coercion imports Use the explicit TypeScript sibling path for native Node tooling while retaining the shared string-coercion owner. Package bundling and public exports remain unchanged. The existing native declaration suite reproduced the loader failure before this repair and passes afterward. Both captured CI groups pass (3,032 tests), along with normalization tests, its standalone build, generated assets, targeted lint, built-package consumption, and fresh review.
What Problem This Solves
Shared packages repeated schema cleaning, stream projection, parsing, and request setup in parallel internal paths. This maintainer-requested sweep consolidates those paths and removes redundant forwarding and commentary.
User Impact
Public package exports/types, wire formats, provider selection, prompts, and Markdown rendering remain compatible. Two bounded defects found during the sweep are also repaired: tiny embedding input limits no longer discard Unicode text, and cancelled browser scope upgrades no longer start another wait or reconnect a retired client.
No dependency, configuration, protocol, schema, retention, or migration changes are included.
packages/gateway-protocolis untouched.Why This Change Was Made
The diff removes 1,523 net production lines (+807/−2,330), with 102 lines of focused regression coverage. The whole assigned production subtree was read, including all 147 files over 200 lines. Contract-bearing public facades and distinct lifecycle/security boundaries remain in place.
Simplifications and rationale
runWithConcurrencyexport remains, and the unused private alias is retired. Session splitting uses the UTF-16 owner and keyword filtering removes repeated work.Fixes found along the way
Stored-data compatibility
The automated review's data-model flags are path-name false positives; no migration or upgrade transform is needed:
agent-tools-parameter-schema.tsscope-upgrade.ts{ clientId, deviceId, role, token, scopes }receipt is unchanged; already received rotated credentials still persist.query-expansion.tsmemory-host-sdk/.../internal.tsNo database version, table, column, retention rule, or serialized state format changes. The package/SDK surface checks and existing memory, token-store, and consumer tests pass. The independent reviews found no actionable compatibility issue.
Evidence
All tests, checks, and builds ran on Linux Blacksmith Testbox. The final head is
e2930e5c64ab549506a431ee8cb10d75904a4414, based on837fad120fbab0c0df0dd7bc7009dd90decfbd38. All three commits remain patch-identical after the latest rebase. The native-loader follow-up below has its own fresh review and remote proof.pnpm buildpassed (483s).pnpm plugins:assets:checkpasses on this head: all generated bundled assets match committed bytes.pnpm plugin-sdk:check-exportsandpnpm plugin-sdk:surface:check: passed, including 373 SDK entrypoints. Standalone AI installation/export/type compatibility and SDK Gateway acceptance: 5 passed, 1 opt-in live Gateway case skipped. The packed AI compatibility test passed again after rebase (8s), using the supported prebuilt E2E contract after the successful full build.node scripts/check-changed.mjs --base deb168691b2a10fde299ec0f911c8a5cbd9d0dda: passed, 1,719s, including all 25 core-test type shards, UI types, zero unused exports, core/tooling lint, cycles, and boundary guards. The generated-manifest follow-up passed its additional changed gate (579.6s), including extension production/test types and all-extension lint with zero warnings/errors.pnpm test <file> --maxWorkers=1wall: scope upgrade 1.56s (8 cases); embedding chunk limits 1.23s (7 cases). Successful hosted job108346632967on run36220889421passed all eight scope-upgrade cases in 0.039s and all seven embedding cases in 0.001s summed, millisecond-rounded case duration. These are test execution sums, not file wall/setup times; the test sources are unchanged by the final rebase.The assertion baseline shrinks only ten changed owners, by 21 assertions. No baseline or budget expands.
CI integration fixes
The first hosted run built successfully, then correctly rejected a stale Workboard generated manifest. Workboard embeds the changed numeric-coercion owner through
plugin-sdk/string-coerce-runtime; its two content-addressed asset paths were regenerated. Normal and production-mode builds produce identical bytes, and the final-head asset guard passes. No Workboard source or rendered behavior changes.A subsequent run encountered a newer main regression: the retained-assets E2E imported
ControlUiRootStatefrom its retired owner. Upstream commitda8149b8ba7d88d76dbe7979986e307a4542e6f0now fixes it. Independent Testbox proof reproduced the original TS2459 in the exact five-graph stripe (137.29s), passed the corrected stripe (16.97s warm), and passed the unchanged Chromium E2E (542ms case, 29.99s command). The upstream file exactly matches the independently validated repair; no duplicate fix was published.The earlier build reported an advisory startup-JavaScript size warning. Existing PR #158482 owns that independently reproduced main-budget issue; this PR changes no performance budgets.
A later hosted native-tooling shard exposed an integration defect introduced by the cleanup: Node directly loads
number-coercion.ts, so the new relative.jsimport could not resolve its TypeScript sibling. The production import now explicitly uses.ts, retaining the canonical helper and the existing native fixture unchanged. Testbox reproduced the ten original failures, then passed all ten native cases plus 384 normalization tests. The captured two-group CI replay passed 3,032 tests (13 existing skips; 314s), followed by the standalone normalization build with declarations (7s), built-package consumption, targeted lint, and another successful generated-asset check. Existing package builds support the explicit source suffix; no export or dependency changed.The next hosted run passed the native-tooling repair, build, UI types, and platform checks, but encountered a newer ACP filesystem import violation on main. Its owner fixed the import through the existing SDK boundary in
9d5ab59b5af88ccfac7af258a5a872caee5eeaf5. The PR incorporates that fix without changing its own patches; all 23 filesystem boundary tests passed on the refreshed head (2.31s runner wall).A further main-only boundary-lint failure used a chained assertion for boxed-number coercion. Upstream
66b812f26e725cd709e08860d2cb46ba496cd308replaced it with nativeReflect.applycoercion. Independent proof reproduced the original lint error, passed the full 39,228-file boundary lint, core types, and 54 snapshot/projection cases, preserving BigInt rejection and JSON semantics. The upstream runtime fix matches the validated candidate; its comment is the only textual difference. This PR again rebases patch-identically onto that repair.The first attempt of final-head hosted CI passed the code gates but failed in the iPad Settings screenshot launch: XCTest reported no process ID, then timed out collecting simulator diagnostics. The original artifact (
10900687199, job108353665779) shows the exact app alive and frontmost as PID 38241 for 101 seconds, with its main thread alternating run-loop waits and rendering work; the XCTest runner was blocked in_waitForValidPIDand diagnostic collection. This supports a process-observation/diagnostics infrastructure failure during the sample, not an app crash or sustained main-thread deadlock; it does not prove full Settings responsiveness.The single unchanged-head recovery passed: attempt 2 completed successfully on
e2930e5c64ab549506a431ee8cb10d75904a4414, including iPhone/iPad capture, their evidence reducer (108366125383), the previously cancelled Android job, iOS smoke, and the requiredopenclaw/ci-gate(108366510256). The entire run was restarted because iPhone/iPad evidence must share a run-attempt identity and fail-fast cancelled the independent Android job. No test retries, timeouts, assertions, or baselines were changed. This is successful infrastructure recovery, not proof of a permanent infrastructure fix; the original failed artifact remains on GitHub.READY-TO-LAND. Exact-head required checks pass; the PR is open, non-draft, and mergeable, with auto-merge disabled. This PR is not merged.
Remote execution records
All providers below are Blacksmith Testbox, and all leases are stopped after their commands finish.
tbx_01m3d9aabzz6vbw7hccyq9harvtbx_01m3dbsf4fzn4e9sd2kgz8r5p9(run)node scripts/run-vitest.mjs, build, Markdown byte comparison, SDK surfaces, and package acceptance passed.tbx_01m3dhqhhsfm40dyystt09d6wm(run)node scripts/check-changed.mjs --base 18d218fa61ff917636ae57eb93d84042cff6196apassed (1,967s).tbx_01m3dshm4etsff684yetfrqmfn(run)tbx_01m3dx3xhmddg7y0gyfqem00za(run)pnpm plugins:assets:build --plugin workboard, deterministic production-mode regeneration, and the manifest's changed gate passed.tbx_01m3dzbq83wbt7kz57z2m6he40node scripts/run-tsgo-core-test-shards.mjs --stripe 1/5 --concurrency 2red/green plus retained-assets Chromium E2E passed.tbx_01m3e0m0q75w69wmbmg3g3nqqq(run)node scripts/run-vitest.mjs run packages/ai packages/gateway-clientandpnpm plugins:assets:checkpassed; remote tree remained clean.tbx_01m3e1qj6b3zmy8kt4tj32xpaj(run) completed the native red/green fixture, normalization tests, captured CI-group replay throughscripts/ci-run-node-test-shard.mts,scripts/build-workspace-package.mts normalization-core, generated-asset check, targeted lint, and built-package consumption. It is stopped.tbx_01m3e4bkyre2j3598kbpq2hnwd(run) passednode scripts/run-vitest.mjs run src/infra/fs-safe-import-boundary.test.tson the final head and is stopped.tbx_01m3e5dpem6n0tn2a7q5fgwa0wcompleted the independent upstream coercion repair proof: fulllint:no-chained-type-assertionsred/green,pnpm tsgo:core, existing snapshot/projection tests, and fresh review. It is stopped; the already-landed upstream fix was adopted without publishing a duplicate.The repository wrapper stalled during source staging; the installed Crabbox CLI completed proof on the same requested provider. No local tests, checks, or builds were substituted.