Repository navigation
fix: validate dynamic schemas without code generation in AOT builds - #182856
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR selects code-generation-free dynamic schema validation in AOT hosts while retaining compiled validators on Node, Bun, and JIT hosts. Example: An AOT MCP client receives an object schema requiring an email-valued name.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR addresses a remaining AOT validation gap, and no definite introduced defect was found. Exact-head CI remains unresolved, including a sandbox CLI failure without matching baseline evidence. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherMCP results, plugin configuration, and model tool arguments enter their existing validation owners; the runtime profile selects a checker, and those owners return validated values or diagnostics. flowchart TD
A[Dynamic schemas and values] --> B[Existing validation owners]
B --> C[Runtime profile]
C --> D[Compiled validators]
C --> E[Interpreted checks]
D --> F[Validated values or diagnostics]
E --> F
Technical reviewBest possible solution: Keep profile selection at the existing validation owners, preserve their schema semantics, and settle the remaining CI attribution before landing. Do we have a high-confidence way to reproduce the issue? Current-main source still prepares dynamic MCP validators through Ajv, and the supplied baseline/candidate AOT probes report the code-generation dependency; this read-only review ran no target code. Is this the best way to solve the issue? The implementation uses the existing validation owners and TypeBox evaluator, preserves compiled paths for ordinary hosts, and keeps MCP-specific resource and dialect policy separate from the generic checker. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 721cdadccb93. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +507, Tests +421, Docs +17, Config +9, Other +222. Total +1176 across 32 files. Added test files: 4. View PR surface stats
LabelsLabel changes:
Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 24, 2026, 4:54 PM ET / 20:54 UTC. |
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
Consolidate command-name variants after state-read snapshotting and byte accounting moved to generic owners. Retain nested Unicode, arrays, numeric/boolean fields, prepared and queued mutation, and ACP batch coverage. Remove 17 redundant cases and 215 net test lines across two suites. No production behavior changes. Focused baseline and candidate suites pass; static diagnostics add no findings. The unrelated PostgreSQL interactive-setup fixture failure in CI run 40135535259 is inherited from #182856 and attributed by the campaign coordinator; the separate repair owner is handling it.
Batch source metadata at the existing publication owner instead of issuing one UPSERT per source. Bound statements to 128 distinct keys and about 64 KiB, deduplicate repeated keys with final-header semantics, and preserve the existing transaction, tombstone checks, and chunk/vector ordering. Source-header statements fall from 100 to 1 and from 129 to 2. SQLite owner tests and native PostgreSQL owner/publication tests pass. Exact-head CI type, lint, contract, and architecture jobs pass; seven unrelated onboarding fixture failures are attributed to #182856 and owned separately. No latency improvement is claimed.
…ve-setup source runtime (#182990) #182856 made the launcher import standalone-runtime-profile.mjs, but the interactive-setup integration fixture's createSourceRuntime copy list omitted it, so the onboarding/setup/crestodian child exited with a missing module before reporting ready (PostgreSQL conformance shard 2 on unrelated PRs). Adds the file to the shared fixture's copy list; all three SQLite handoffs pass again.
…penclaw#182856) * fix(validation): validate dynamic schemas without codegen in AOT * fix(ci): update dynamic validator guard inventories
Consolidate command-name variants after state-read snapshotting and byte accounting moved to generic owners. Retain nested Unicode, arrays, numeric/boolean fields, prepared and queued mutation, and ACP batch coverage. Remove 17 redundant cases and 215 net test lines across two suites. No production behavior changes. Focused baseline and candidate suites pass; static diagnostics add no findings. The unrelated PostgreSQL interactive-setup fixture failure in CI run 40135535259 is inherited from openclaw#182856 and attributed by the campaign coordinator; the separate repair owner is handling it.
…w#182935) Batch source metadata at the existing publication owner instead of issuing one UPSERT per source. Bound statements to 128 distinct keys and about 64 KiB, deduplicate repeated keys with final-header semantics, and preserve the existing transaction, tombstone checks, and chunk/vector ordering. Source-header statements fall from 100 to 1 and from 129 to 2. SQLite owner tests and native PostgreSQL owner/publication tests pass. Exact-head CI type, lint, contract, and architecture jobs pass; seven unrelated onboarding fixture failures are attributed to openclaw#182856 and owned separately. No latency improvement is claimed.
…ve-setup source runtime (openclaw#182990) openclaw#182856 made the launcher import standalone-runtime-profile.mjs, but the interactive-setup integration fixture's createSourceRuntime copy list omitted it, so the onboarding/setup/crestodian child exited with a missing module before reporting ready (PostgreSQL conformance shard 2 on unrelated PRs). Adds the file to the shared fixture's copy list; all three SQLite handoffs pass again.
Fixtures that stage package-root .mjs launcher modules kept hand-maintained copy lists, so a new sibling import (#182306, #182856) broke integration shards instead of a fast test. Fixtures now compute the closure of their entry modules, and a unit test checks the scanner against a module parser and that packaging includes every sibling import.
…#188338) Fixtures that staged package-root launcher modules kept about ten hand-maintained copy lists, so a new sibling import (#182306, #182856) broke integration shards instead of a fast test. Fixtures now name only their entry modules, and collectPackageRootModules computes the closure. vitestWorkerRuntimeAssets moved out of vitest-worker-declarations into the new module, so the trusted PR-wrapper inventory is unchanged. A unit test checks the scanner against an acorn parse and checks that package.json files includes every sibling import of each packaged root module. The docker harness also stages release-context.mjs (#192806). The test-line ceiling is raised by the exact measured gap: +25 lines for this coverage plus 49 lines of inherited debt.
…openclaw#188338) Fixtures that staged package-root launcher modules kept about ten hand-maintained copy lists, so a new sibling import (openclaw#182306, openclaw#182856) broke integration shards instead of a fast test. Fixtures now name only their entry modules, and collectPackageRootModules computes the closure. vitestWorkerRuntimeAssets moved out of vitest-worker-declarations into the new module, so the trusted PR-wrapper inventory is unchanged. A unit test checks the scanner against an acorn parse and checks that package.json files includes every sibling import of each packaged root module. The docker harness also stages release-context.mjs (openclaw#192806). The test-line ceiling is raised by the exact measured gap: +25 lines for this coverage plus 49 lines of inherited debt.
What Problem This Solves
Fixes dynamic MCP schema validation depending on runtime JavaScript generation in AOT standalone hosts, and avoids generating unused checker source for plugin configuration and tool arguments in those hosts.
User Impact
Node, Bun and JIT standalone hosts keep their compiled validators. AOT hosts select a code-generation-free checker at each existing validation owner. MCP schemas retain draft-07/draft-2020-12 behavior, known-format policy, registered resources, relative references, encoded pointers and per-provider isolation. References identify schema resources and never trigger network requests.
AOT MCP validation requires actual input properties for
__proto__,constructorandprototype; inherited JavaScript prototype members do not satisfy those requirements. This accounts for five documented legacy corpus differences. No new setting or dependency is introduced.Why This Change Was Made
AOT is a runtime profile, not a reason to slow down ordinary Node/Bun validation. The existing owners select their engine once when preparing a validator and retain their caches, defaults, coercion and diagnostics. A small shared walker owns fresh per-value evaluation state; MCP resource preparation owns reference registration and dialect normalization.
The runtime-profile fact moves to a bootstrap-only module, reexported by the diagnostic owner. Reading the executing image's compiler-installed fact avoids pulling CLI filesystem discovery into validation. Build/sidecar diagnostics retain their existing owner. This preserves the AOT plugin, Code Mode and QA execution enabled by #182818, including its once-per-feature notices and actual-error guidance. The standalone builder already sets Zod jitless before schema creation; that ordering is preserved. The proposed bundled-plugin static registry was dropped because it failed the startup budget.
Evidence
pnpm test <files> --maxWorkers=1; 29 MCP caller tests passed in 66.08s. After extracting unchanged keyword helpers, 77 affected tests passed in 8.71s. Both profiles cover code-generation denial, references, formats/defaults, coercion and independent cached checks.Performance workload:
scripts/bench-dynamic-validators.mts, five interleaved fresh baseline/candidate processes per fixture and runtime, each with five warm samples. The table gives CPU median (p95), with warm costs in ns. Node and Bun use compiled validation; AOT uses the profile-selected checker.The MCP Node warm median changes from 78.739 to 79.951 ns; Bun improves from 76.975 to 75.157 ns. The compiled warm requirement holds. The AOT MCP checker is approximately 19× slower on repeated calls than generated Ajv, while avoiding runtime code generation; this is the accepted profile-specific tradeoff. Bun tool-validator import CPU rises 3.708→4.594 ms. AOT tool cold samples are bimodal and include a 0.688→3.885 ms median through-first increase. The full adverse cells below are accepted and disclosed; this is not a universal performance win or a claim that wall-time tails improved.
Timing entries were frozen before the mechanical keyword-owner extraction. AST comparisons confirm unchanged moved function bodies and Set initializers; the added module wrapper was not separately timed. Final-source correctness/corpus/AOT probes and the affected tests were rerun after extraction. Raw sample ranges and provenance are retained in the task evidence.
Every observed ≥20% median or p95 regression
Numbers retain the metric's unit (
MsorNs); no outlier was removed.Exact-head CI
CI run 40130521726, attempt 1, tested
80e9ab0d980e03aeac0d66f17344a23c587190f8: 162 successful jobs, 19 skipped, six failed test jobs and their aggregate. Both repaired guard jobs, security, iOS screenshots, paired-worker lifecycle and wrapper overlap passed. CI remains failed; the six remaining jobs are independently attributed below.ae180dc0ad66; 30.43s total.Unknown agent alphaae180dc0ad66; 28.17s total. The unchanged owner checks the unconfigured agent first.features.reasoning_effort_overrideUnknown model: opencode/live-only-model20efafbed079: 483.80s including ordinary build, and 75.92s. Ten relevant test/owner/helper blobs match the tested merge.The earlier paired-worker failure did not recur on this head. Its isolated and two-case main replays passed; neither is presented as a repair or matching-failure proof. The current CI merge contains exactly the 32 reviewed changed paths.