Repository navigation
feat(typesafe): bundle TypeSafe AI decision models - #152298
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 19, 2026, 6:36 PM ET / 22:36 UTC (Revision 10). ClawSweeper reviewWhat this changesAdds an opt-in TypeSafe AI plugin for typed decisions and an optional evaluation tool, with documentation, credential handling, validation, and focused test-fixture repairs. Merge readiness⛔ Blocked before merge - 1 item remains This remains useful, maintainer-sponsored work absent from current main. No blocking defect was found; the updated compatibility assessment resolves the previous review’s prototype-transition concern. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw’s decision runtime sends explicitly selected evidence and questions to a configured provider. The TypeSafe adapter translates those requests into Jev evaluations and returns validated choices, scores, and Boolean probabilities to consumers. flowchart LR
A[Agent decision selection] --> C[Decision runtime]
B[Consumer evidence and questions] --> C
C --> D[TypeSafe adapter]
E[Prepared credential] --> D
D --> F[Guarded TypeSafe request]
F --> G[Validated typed answers]
G --> C
Before merge
Agent review detailsSecurityNone. PR surfaceSource +935, Tests +1303, Docs +214, Config +24, Generated 0, Other +10. Total +2486 across 37 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep vendor translation in this opt-in plugin, reuse host-owned lifecycle and credentials, and retain the documented external-install transition. Do we have a high-confidence way to reproduce the issue? Not applicable to the primary feature request; the supplied Gateway observations exercise the new adapter, and no introduced failure was established. Is this the best way to solve the issue? Yes. The adapter consumes the merged generic decision contract and shares transport between native evaluations and the optional tool; the configuration comparison supports the stated prototype transition. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c5ad7506abae. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (9 earlier review cycles; latest 8 shown)
|
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
Add an opt-in decisionModel role for typed choices, scores, and boolean probabilities, with global defaults and per-agent inheritance or disablement. Keep provider lifecycle and prepared credentials host-owned, and expose manifest-only decision choices separately from conversational model catalogs. Adapt the provider foundation from #152237 to the decisions contract. Existing configurations keep decision calls disabled until a model is selected. Co-authored-by: Josh Lehman <[email protected]>
d220d8c to
52a6341
Compare
Security-sensitive guard clearedCurrent revision: This PR no longer changes files in the maintainer security-review tier. Separate CODEOWNERS requirements still apply to security policy and enforcement files. |
Preserve the reviewed adapter and contributor ancestry while targeting main. Keep TypeSafe documentation additions and regenerate config metadata after resolving the stack integration. Validation: all 107 TypeSafe tests, glossary check, generated metadata, and clean managed P0-P2 review. Adapter production and test files are identical to the stress-tested candidate. Co-authored-by: Josh Lehman <[email protected]>
The auto-stop fixture polled active status before SQLite-backed admission reached the provider. Wait for each existing start fixture with the test abort signal, then release its gate and keep the original assertions and polling deadlines. The unchanged file and a controlled admission delay reproduced the failure; the synchronized version passes the same delayed proof. Validation: 83 sibling tests, final 9-test file, owning typecheck, lint, formatting, and clean managed P0-P2 review.
|
Merged via squash.
|
Bundle TypeSafe AI's Jev models as an opt-in decisionModel provider, with global and per-agent selection and the optional typesafe_evaluate tool. Keep vendor translation, fixed-endpoint transport, validation, and prepared credential consumption inside the plugin while reusing the host's decision and lifecycle contracts. Compile fixed schemas once, reducing paired local adapter overhead by 57–79%. Preserve provider-reported probabilities, authored SecretRefs, and the existing tool configuration. A transcript CI fixture now awaits provider readiness before its unchanged status assertions. Validation includes 107 adapter tests, 1,024 synthetic concurrent transport operations with complete cleanup, live evaluations through a built isolated Gateway, 118 source-selection tests, and clean independent P0–P2 reviews. Exact-head CI and its required gate passed on 871cf07. Thanks @jalehman for the adapter, expressive schemas, optional tool, and lifecycle validation work. Co-authored-by: Josh Lehman <[email protected]> Co-authored-by: Peter Steinberger <[email protected]>
Related: #152234
What Problem This Solves
Makes TypeSafe AI’s Jev models available as an official bundled plugin for fast typed choices, scores, and boolean probabilities.
User Impact
Select
typesafe/jev-latestortypesafe/jev-1.13.0through the global or per-agentdecisionModelsetting and configure the plugin’s API-key SecretRef. The role stays disabled until selected. Evaluations send the consumer’s supplied state to TypeSafe and use its normal API billing. The optionaltypesafe_evaluatetool remains available with its own default model.Why This Change Was Made
Builds on Josh Lehman’s bundled adapter while adopting the generic decisions contract from #152237. Vendor translation, validation, credentials, and transport stay in
extensions/typesafe; Jev appears in the separate decision-model catalog. Native evaluations always use the host-selected model.The adapter uses OpenClaw’s guarded HTTP helpers against the documented fixed HTTPS endpoint, with bounded input/output, a deadline covering the whole request, cancellation and release that both settle, and sanitized errors. No new vendor SDK dependency, redirects, automatic retries, or dependency cooldown exception is needed. Provider-reported probabilities and scores remain intact after structural and range validation.
Thanks @jalehman for the adapter, expressive schemas, optional tool, lifecycle integration, and follow-up validation work. The SecretRef prerequisite #152236 and decisionModel foundation #152237 are merged. This PR targets main. Separate Workshop and memory consumers are outside this change.
Evidence
All 107 TypeSafe tests and 49 package-manifest tests passed, alongside production/test typechecks, type-aware lint, a full integrated build, generated metadata checks, and docs validation. Independent P0–P2 review is clean. Five captured-response cancellation/release regressions fail before the fix and pass afterward.
Live proof used the actual built isolated Gateway, normal bundled loading, a prepared SecretRef, a separate consumer plugin, and the public Gateway client. Inherited and per-agent pinned selections both returned valid Choice, Score, and Boolean results (373 ms and 189 ms); a disabled agent made no provider call. Inspection recorded two successes and zero active requests, and Jev appeared only in the decision-model catalog. Shutdown completed cleanly in 42 ms. These two synthetic batches verify the live contract, not general model quality or a latency benchmark.
The fixed input/result schemas are compiled once per module. Two A/B runs through the registered adapter measured 57–79% lower local overhead across four synthetic workloads; the largest median fell from 8.80 to 2.20 ms. All validation bounds and correspondence checks remain intact. A 1,024-request synthetic transport stress run at up to 64 concurrent operations completed all releases and body cancellations, covered 16 credential loss/recovery cycles, and left zero active requests. No vendor traffic was used for this load test. The incremental performance change passed independent P0–P2 review and all 107 adapter tests.
After integrating the landed foundation, all 107 TypeSafe tests and a fresh independent P0–P2 review passed. The adapter runtime and tests remain byte-for-byte identical to the stress-tested candidate. Exact-head hosted CI and native landing gates remain required before merge. The foundation’s approved SDK surface increment is applied and its guard passes.
Current-main CI exposed an existing transcript auto-start fixture race: its status polling deadline started before SQLite admission reached the provider. An unchanged-file reproduction and paired delayed-admission probe established the cause. The six-line fixture repair waits for provider readiness without changing production code, assertions, or polling deadlines. All 83 lifecycle/occupancy tests, the final nine-test file, typecheck, lint, and independent P0–P2 review pass.
Maintainer compatibility assessment: the audited prototype's authored configuration schema is unchanged, including the
apiKeySecretRef,model,timeoutMs, defaults, and bounds. Plugin ID, activation, secret-input declarations, optional tool contract, and skill declaration are preserved. The existing built-Gateway proof exercises that authored SecretRef through normal preparation and the registered adapter. The new native decision role remains opt-in.extensions/typesafe/src/schema.tsvalidates transient API requests and responses; it creates no stored data, database schema, or migration requirement.Source selection follows the existing duplicate-ID precedence contract: explicit
plugins.load.pathsoverrides keep precedence, tracked global installs override ordinary bundles, and source-checkout bundles precede tracked globals. All 118 canonical manifest-registry tests pass, including those source-selection cases. To retain an external implementation, keep its explicit path. To adopt the bundled implementation, preserve the authored entry and its SecretRef, change the selected source, refresh secrets/reload, and verify the selected plugin and an evaluation. No plugin files or credentials are deleted by this PR.If removing an external package with the plugin management flow, save and reapply the entry and re-enable the bundled plugin afterward:
--keep-filespreserves files but does not preserve the configuration or policy entry. The supported transition preserves the audited authored contract; no compatibility shim or storage migration is needed. This resolves the review's prototype-transition question and its heuristic stored-schema flag.