Skip to content

fix(lobster): validate workflows without runtime code generation in AOT - #182928

Merged
steipete merged 2 commits into
mainfrom
fix/lobster-aot-validation
Oct 24, 2026
Merged

steipete merged 2 commits into
mainfrom
fix/lobster-aot-validation

Conversation

@steipete

@steipete steipete commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes Lobster workflow validation failing in standalone AOT builds.

User Impact

Lobster can request input, resume workflows, and validate LLM output on AOT hosts. Fixed schemas no longer compile during startup on any host; Node and JIT Bun retain native Ajv for dynamic schemas. No new configuration is required.

Why This Change Was Made

Lobster compiled two fixed schemas during import. The narrow dependency patch generates those checks with Ajv at build time, including its Unicode-length helper. The existing host profile selects dynamic validation once, when the runtime is first acquired: native Ajv for JIT, the shared codegen-free provider for AOT. Request-local compiler selection and dependency-owned reference namespaces preserve concurrent requests and schema references across recreated runners.

The profile and AOT compiler load lazily, so the plugin's native static import list is unchanged. Narrow typed SDK subpaths expose the shared validator and the existing profile getter without loading the broader runtime/logging surface on first use; that broader surface was measured and would regress first acquisition. CI's existing generated-validator check covers the patched output, Ajv version, and helper hash.

Evidence

  • 36 owning/sibling tests passed in 37.92s; after the typed-entry correction, all 24 affected runner/profile/compiler cases passed in 31.17s. Both profiles exercise workflow resume rejection, LLM output rejection/recovery, and references across recreated runners.
  • The corrected pnpm build passed, including 160 public SDK subpaths (7m05.2s in build phases, following artifact-lock preparation). It reported the same inherited UI CSS warnings (296.5/296.3 KiB gzip; 1558.7/1558.1 KiB raw).
  • After replay onto the merged dynamic-validator base, the reviewed patch ID is unchanged. All 36 owning/sibling tests passed again in 118.85s wall time (including worker-cache rebuilding), and generated-validator freshness passed.
  • Targeted core, extension, script and test types/lints, mock-export guard, SDK exports and generated-validator freshness passed. Independent Codex review is clean.
  • The public SDK API comparison passed: two added entrypoints (json-schema-validator and runtime-profile), four added exports, and no removals. Acknowledgement digest: 6c875951 (--require-acknowledgement --acknowledge 6c875951).
  • The committed-head native import profile passed with clean source/build provenance, no qualification gaps, and 106.9 MiB peak RSS.
  • A strict NodeNext consumer imports the getter and exhaustively checks its published profile type through actual package exports, with no source aliases; its emitted JavaScript passes with string compilation disabled.
  • The packed plugin includes the patched dependency. Its five changed files match installed bytes, and the extracted plugin imports the built SDK and validates Unicode with Node string compilation disabled.
  • A small experimental Bun AOT probe fails before the change with EvalError and passes afterward, including real ask/workflow valid and invalid resumes plus compiler scope/cache checks. The final public-import probe compiled 437 modules in 3.982s. This is not a whole-application AOT build or an interpreter-free claim.

Exact-head CI

Run 40135040447, attempt 1 completed on 0d32d99a9d400d389d5b1f3bc9552f6a74b58786: 147 jobs passed, 21 skipped, six primary jobs failed plus their aggregate. Security and all selected Android jobs passed. CI remains failed; it was not rerun.

All six failures are attributed to baseline behavior. The Docker memory-store cases fail to resolve @openclaw/fs-safe; both reproduce on clean exact CI base 90d9772 with the same generated chunk (2 failed, 60 skipped; 119.75s total). The hooks newline and sandbox agent assertions match retained clean-main reproductions. Codex fixtures omit the unchanged producer's reasoning flag; model-discovery and delayed-catalog assertions match retained main failures. Their causal input blobs match the current CI base and tested merge. The failure report labels five jobs unknown and the packaging job new; the independent exact-base proof supplies the attribution rather than relabeling CI green.

CI tested merge c13c7f9 has the exact PR head and recorded main baseline as parents. Its 22-path authored change record is byte-identical to the reviewed branch patch. Native inherited-failure admission retains this evidence and does not waive security or review gates.

Performance

Fifteen paired fresh processes importing native packaged plugin entries, on a shared host:

Cold import Node before → after Bun before → after
CPU median 261.874 → 259.031ms 342.911 → 342.012ms
Wall median 212.469 → 212.118ms 99.599 → 97.709ms
CPU p95 291.748 → 331.739ms 924.046 → 1649.392ms
Wall p95 254.297 → 283.863ms 172.692 → 160.702ms

Medians are within noise; tail regressions remain visible. The earlier eager-profile version and all samples with increases of at least 20% are retained in the task evidence. No startup speedup is claimed.

At the package boundary, removing import-time compiler warmup moves cost to the first dynamic compilation: Node 9.509 → 16.846ms, Bun 22.141 → 33.082ms. Total import plus first validation CPU decreased from 179.281 → 170.835ms on Node and 159.675 → 109.179ms on Bun. The longer Node warm-validation run measured 2296.438 → 2256.982ns median and 2328.055 → 2419.240ns p95 (+3.92%). These are scoped validator measurements, not whole-application startup claims.

Dependency and follow-up

Ajv 8.20.0 was already Lobster's pinned runtime dependency; the new direct declaration is build-only. It is MIT-licensed, was released April 24, 2026, and its repository is active/not archived (last push September 6; latest commit f177fe323420ccb23e1a79445fd470cbf80aee7c). npm reports 249,308,485 downloads for October 16–22.

Port the generated fixed validators and scoped compiler hook to openclaw/lobster. Remove the patch when a published version passes the same runner and AOT/codegen-ban proof. No new runtime dependency is introduced.

@clawsweeper

clawsweeper Bot commented Oct 24, 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.

@steipete
steipete marked this pull request as ready for review October 24, 2026 21:37
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-24T21:39:32.911602Z 0d32d99 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: lobster Extension: lobster scripts Repository scripts plugin: file-transfer labels Oct 24, 2026
@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Oct 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Dependency graph changes

This maintainer PR changes the dependency graph.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 0d32d99a9d400d389d5b1f3bc9552f6a74b58786
  • Maintainer: @steipete
  • Repository role: admin

These dependency graph changes were made:

  • pnpm-lock.yaml
  • patches/@[email protected]
  • patches/README.md
  • pnpm-workspace.yaml
  • package.json

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 24, 2026
@clawsweeper

clawsweeper Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR generates Lobster’s fixed validators ahead of time and selects the shared codegen-free validator for dynamic schemas on AOT hosts.

Example: An AOT-hosted workflow requests an integer answer of at least 1.

  • Before: Loading Lobster or compiling the answer schema can fail with EvalError.
  • After: The workflow requests input, rejects {"answer":0}, and accepts {"answer":2}.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is coherent and has meaningful boundary tests, but supplied runtime results are narrative reports and CI attribution remains incomplete.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its body reports real dependency run/resume and AOT/codegen-ban probes, while inspectable committed tests exercise the runner with real dependency code and loopback HTTP.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Lobster workflows cannot reliably load or validate answers and LLM output when the host forbids runtime string compilation.
Reason: The maintainer-authored direction repairs an existing optional capability without a user setting and records why the narrow SDK seams and temporary dependency patch are needed.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR addresses a distinct Lobster AOT failure that remains on main; inspection found no actionable introduced defect, but CI is still failed.

Priority: P2
Reviewed head: 0d32d99a9d400d389d5b1f3bc9552f6a74b58786

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The body reports small AOT and package probes, but supplies no inspectable shipped OpenClaw tool invocation or raw red/green probe artifact.
Agent review details

How this fits together

The optional Lobster plugin passes workflow and resume requests into its embedded dependency, which validates input and LLM output before returning workflow envelopes.

flowchart TD
  A[Lobster tool request] --> B[Embedded runner]
  B --> C[Host runtime profile]
  C --> D[Native Ajv on JIT]
  C --> E[Shared validator on AOT]
  D --> F[Lobster workflow runtime]
  E --> F
  F --> G[Result or resumable checkpoint]
Loading

Technical review

Best possible solution:

Retain dependency-owned caching, generate fixed checks, and route AOT dynamic validation through the existing shared provider.

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

The original dependency hunks show import-time Ajv compilation and dynamic compilation without AOT selection; the body reports a baseline EvalError and passing candidate probe, but this review executed no code.

Is this the best way to solve the issue?

The implementation addresses both fixed and dynamic compilation through existing owners, preserves JIT validation and dependency namespaces, and avoids reviving the retired process-global shim.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Embedded runtime loading and compiler ownership keeps the original intent (refactor(lobster): remove stale Ajv cache shim #106179: Remove OpenClaw's global Ajv monkeypatch because the dependency already owns memoized compilation.)
  • Shared dynamic validator behavior keeps the original intent (4a38dbd: Provide codegen-free dynamic schema validation on AOT hosts while retaining existing caller policies and JIT behavior.)
  • Generated-validator tooling keeps the original intent (f52fb07: Generate fixed validators ahead of time and verify freshness in the existing validator gate.)
  • Structured input validation and resumability keeps the original intent (839907a: Pass structured answers through the plugin while leaving schema validation and saved continuation with Lobster, including retries after invalid answers.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: Inspected the merge-base-to-head diff, including the complete dependency patch; base-only changes were excluded from PR ownership. (0d32d99a9d40)
  • Current-main gap: Fetched main still loads the dependency directly without AOT compiler selection; the earlier shared-validator repair does not cover Lobster. (extensions/lobster/src/lobster-runner.ts:180, f544cdc93fc6)
  • Compiler ownership and isolation: The patch preserves dependency-owned compile caches, separates compiler identities, and uses AsyncLocalStorage for request-local selection; the adapter preserves each Ajv owner's reference namespace. (patches/@[email protected]:1211, 0d32d99a9d40)
  • Prior ownership decision: refactor(lobster): remove stale Ajv cache shim #106179 removed a global Ajv monkeypatch because Lobster already owned compilation caching; this PR retains that boundary. (extensions/lobster/src/lobster-runner.ts, 477499c9c08a)
  • Applicable dependency contract: The PR patches and executes @clawdbot/lobster, so its repository policy applies; its root AGENTS.md and validation owner were read, including the dependency's rationale for per-Ajv memoization. (AGENTS.md:1, bfad09a49747)
  • Recorded direction and tradeoffs: The maintainer-authored body records the two narrow SDK additions, temporary dependency patch and upstream removal plan, package-boundary checks, small AOT probe, and adverse timing results without claiming a whole-application AOT build or startup speedup. (0d32d99a9d40)

Likely related people:

  • Peter Steinberger: Raw commit 4a38dbd adds src/shared/json-schema-validator.ts:169 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 4a38dbdb6b1d; files: src/shared/json-schema-validator.ts)
  • Miguel Branco: Raw commit 839907a adds extensions/lobster/src/lobster-runner.ts:12 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 839907a43b35; files: extensions/lobster/src/lobster-runner.ts)

PR surface

Source +120, Tests +244, Docs +60, Config +12, Other +1468. Total +1904 across 22 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 5 122 2 +120
Tests 4 244 0 +244
Docs 5 68 8 +60
Config 2 13 1 +12
Generated 0 0 0 0
Other 6 1473 5 +1468
Total 22 1920 16 +1904

Review metrics

Metric Value Why it matters
Public SDK expansion 2 typed subpaths; 4 exports Publishes the validator provider and runtime-profile getter with their types; the body records API comparison and strict package-consumer checks.

Labels

Label changes:

  • add P2: Repairs validation for the optional Lobster plugin on AOT hosts while preserving the ordinary JIT path.
  • add merge-risk: 🚨 compatibility: Adds documented public SDK contracts and patches a runtime dependency; the maintainer-authored direction explicitly covers those additions and their validation.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Label justifications:

  • P2: Repairs validation for the optional Lobster plugin on AOT hosts while preserving the ordinary JIT path.
  • merge-risk: 🚨 compatibility: Adds documented public SDK contracts and patches a runtime dependency; the maintainer-authored direction explicitly covers those additions and their validation.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Resolve attribution of the remaining memory-packaging and session-catalog CI failures before landing.

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 October 24, 2026, 5:54 PM ET / 21:54 UTC.

@steipete
steipete merged commit ee66e3f into main Oct 24, 2026
337 of 349 checks passed
@steipete
steipete deleted the fix/lobster-aot-validation branch October 24, 2026 23:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 25, 2026
…OT (openclaw#182928)

* fix(lobster): validate workflows in AOT runtimes

* fix(plugin-sdk): publish lightweight runtime profile types
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. dependencies-changed PR changes dependency-related files docs Improvements or additions to documentation extensions: lobster Extension: lobster plugin: file-transfer scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant