Repository navigation
feat(decisions): add explicit evaluation and Labs opt-in foundation - #155134
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 22, 2026, 6:01 PM ET / 22:01 UTC (Revision 18). ClawSweeper reviewWhat this changesAdds provider-neutral decision evaluation, provider capability metadata, and a separate default-off Labs preference while retiring TypeSafe’s standalone evaluation tool. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this remains useful, coordinated work absent from current main. No blocking patch defect remains, and the supplied proof and verified release boundary resolve the previous compatibility concern. Priority: P2 Review scores
Verification
How this fits togetherThe agent’s configured Decision model routes explicitly supplied evidence through OpenClaw’s shared evaluation runtime to a provider, returning typed answers. Labs separately stores consent for future automatic consumers without starting inference. flowchart TD
A[Agent evidence and questions] --> B[Tool policy and agent model selection]
B --> C[Shared Decision runtime]
D[Provider capability metadata] --> B
C --> E[Selected provider]
E --> F[Typed answers or unavailable result]
G[Labs preference] --> H[Future automatic consumer eligibility]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +492, Tests +623, Docs +146, Config 0, Generated 0, Other +4. Total +1265 across 56 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Keep explicit evaluation on the shared Decision runtime and reserve Labs consent for separately reviewed automatic consumers. Do we have a high-confidence way to reproduce the issue? Not applicable as a bug reproduction: this adds capability. The supplied real-provider trace and inspected UI evidence demonstrate the proposed behavior on the reviewed implementation. Is this the best way to solve the issue? Yes: reusing the existing selection, evaluation, manifest, and Labs owners avoids competing implementations; the unshipped TypeSafe cutover does not require speculative legacy compatibility. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bc635fc9400d. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (17 earlier review cycles; latest 8 shown)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Pushed This addresses the latest review blockers:
Verification: focused Oxfmt check and |
Live Behavioral Proof for
|
|
Follow-up verification: after expanding the sparse repair worktree and linking the existing installed dependencies, the focused lane passed: |
Bind decision_evaluate to the calling agent and existing Decision runtime. Move capability discovery to manifests and remove the TypeSafe tool surface. Validate host resource bounds before hashing and keep diagnostics current. Preserve the contributor commits and provider transport behavior. Refs: dec-508
Merge main at a3815a8 while preserving the contributor history. Regenerate the config baseline from the combined source and retain both independent SDK documentation changes. Refs: dec-621
Merge pinned main 9eec298 into the existing contributor branch. Resolve the generated config hash conflict with config:docs:gen; preserve Decision, provider, and Labs behavior. Co-authored-by: jalehman <[email protected]>
Exact-head real Decision-provider proofHead: Real ONNX Runtime 1.29.0 CPU inference with GLiClass Edge v3, not a fixture provider or hosted Jev. The 131,130,181-byte graph and tokenizer were downloaded anonymously from the plugin's revision-pinned preset and verified against its SHA256s. Inference ran in the provider's persistent local child process; there was no network inference endpoint or hosted credential. The source-mode composition harness used normal config validation/writes,
Secretless AWS lease Command inside the admitted checkout: OPENCLAW_STATE_DIR="$PWD/.openclaw/tmp/real-provider-state" \
OPENCLAW_CONFIG_PATH="$PWD/.openclaw/tmp/real-provider-state/openclaw.json" \
node --import ./scripts/tsx.mjs .openclaw/tmp/real-decision-proof.tsActual captured outputTool output below is the returned [
{
"event": "artifacts",
"model": "gliclass-edge-v3.0",
"source": {
"kind": "hub",
"repository": "cnmoro/gliclass-edge-v3.0-onnx",
"revision": "1167c26c90183f20165120292dc5c7684af406ae",
"files": [
{
"name": "model.onnx",
"path": "model.onnx",
"bytes": 131130181,
"sha256": "5289497ae11bb612806e56eefa168c6338e3e5d9f548e8012f1e10560e19fa8f"
},
{
"name": "tokenizer.json",
"path": "tokenizer.json",
"bytes": 3583864,
"sha256": "b6e09abceac75851eae141e7d51224a9da835c0c03684282fe2d5c42c745754f"
}
]
},
"downloadVerifyMs": 185
},
{
"event": "environment",
"head": "5bbb43b00508e85c768231ffb86dc4a3b67a3206",
"tree": "0b19ce14797cb7e0ad5b01da052ed7d1ea089bde",
"node": "v24.19.0",
"provider": "onnx",
"model": "gliclass-edge-v3.0",
"backend": "onnxruntime-node 1.29.0 CPU, persistent local child process; no network inference endpoint",
"warmupMs": 1150,
"instrumentation": "forwarding wrapper counts calls to the registered real provider.evaluate; no response substitution"
},
{
"event": "labs-transition",
"enabled": false,
"toolPresent": true,
"dispatchDelta": 1,
"elapsedMs": 49,
"result": {
"status": "ok",
"result": {
"model": "gliclass-edge-v3.0",
"answers": {
"topic": {
"type": "choice",
"choice": "travel",
"probabilities": {
"travel": 0.9997163843562904,
"finance": 0.0002579638862212876,
"science": 0.00002565175748839849
}
},
"sentiment": {
"type": "score",
"score": 1.9998024959862652,
"probabilities": [
5.9037527186859644e-8,
0.00019738593868051524,
0.9998025550237923
]
},
"holiday": {
"type": "boolean",
"probabilityTrue": 0.9999995527152532
}
},
"usage": {
"inputTokens": 78
}
},
"provenance": {
"providerId": "onnx",
"rubricVersion": "decision-v1-eae3f044b9e1b37ef4b5bf09",
"runtimeGeneration": "b9b32827-ec82-49d5-8d08-961b9c169cab"
}
}
},
{
"event": "labs-transition",
"enabled": true,
"toolPresent": true,
"dispatchDelta": 1,
"elapsedMs": 25,
"result": {
"status": "ok",
"result": {
"model": "gliclass-edge-v3.0",
"answers": {
"topic": {
"type": "choice",
"choice": "travel",
"probabilities": {
"travel": 0.9997163843562904,
"finance": 0.0002579638862212876,
"science": 0.00002565175748839849
}
},
"sentiment": {
"type": "score",
"score": 1.9998024959862652,
"probabilities": [
5.9037527186859644e-8,
0.00019738593868051524,
0.9998025550237923
]
},
"holiday": {
"type": "boolean",
"probabilityTrue": 0.9999995527152532
}
},
"usage": {
"inputTokens": 78
}
},
"provenance": {
"providerId": "onnx",
"rubricVersion": "decision-v1-eae3f044b9e1b37ef4b5bf09",
"runtimeGeneration": "b9b32827-ec82-49d5-8d08-961b9c169cab"
}
}
},
{
"event": "labs-transition",
"enabled": false,
"toolPresent": true,
"dispatchDelta": 1,
"elapsedMs": 20,
"result": {
"status": "ok",
"result": {
"model": "gliclass-edge-v3.0",
"answers": {
"topic": {
"type": "choice",
"choice": "travel",
"probabilities": {
"travel": 0.9997163843562904,
"finance": 0.0002579638862212876,
"science": 0.00002565175748839849
}
},
"sentiment": {
"type": "score",
"score": 1.9998024959862652,
"probabilities": [
5.9037527186859644e-8,
0.00019738593868051524,
0.9998025550237923
]
},
"holiday": {
"type": "boolean",
"probabilityTrue": 0.9999995527152532
}
},
"usage": {
"inputTokens": 78
}
},
"provenance": {
"providerId": "onnx",
"rubricVersion": "decision-v1-eae3f044b9e1b37ef4b5bf09",
"runtimeGeneration": "b9b32827-ec82-49d5-8d08-961b9c169cab"
}
}
},
{
"event": "oversized-host-bound",
"stateUtf8Bytes": 1048577,
"dispatchDelta": 0,
"result": {
"status": "unavailable",
"reason": "unsupported-input",
"guidance": "Shorten the state or rubric, reduce question counts, and check the selected model's declared limits. Host bounds are 256 questions, 1 MiB of JSON, 20000 JSON nodes, and depth 32. No evidence was truncated or sent on a host-bound rejection."
}
},
{
"event": "empty-agent-override",
"freshToolPresent": false,
"dispatchDelta": 0,
"result": {
"status": "unavailable",
"reason": "disabled",
"guidance": "Decision evaluation is disabled for this agent. Ask the operator to select a decisionModel or enable its provider."
}
},
{
"event": "unavailable-local-artifacts",
"selectedModel": "onnx/gliclass-base-v3.0",
"toolPresent": true,
"dispatchDelta": 1,
"result": {
"status": "unavailable",
"reason": "transport",
"guidance": "The selected provider could not be reached. Check its service or endpoint before trying again."
}
},
{
"event": "summary",
"passed": true,
"totalProviderDispatches": 4
}
]Reproducible source-mode harness (synthetic input only)Save at import assert from 'node:assert/strict';
import fs from 'node:fs/promises';
import path from 'node:path';
import { execFileSync } from 'node:child_process';
const root=process.cwd();
const state=process.env.OPENCLAW_STATE_DIR!;
const modelDir=path.join(state,'models','onnx');
const record=(event:string,data:unknown)=>console.log('REAL_PROOF '+JSON.stringify({event,...data as object}));
await fs.mkdir(state,{recursive:true});
const configInput={agents:{ownership:'explicit',defaults:{decisionModel:'onnx/gliclass-edge-v3.0',experimental:{decisionAssistance:false}},entries:{main:{},disabled:{decisionModel:''}}},plugins:{allow:['onnx'],load:{paths:[path.join(root,'extensions/onnx')]},entries:{onnx:{enabled:true,config:{modelDir,threads:2,maxLoadedModels:1}}}}};
await fs.writeFile(process.env.OPENCLAW_CONFIG_PATH!,JSON.stringify(configInput));
const {findModel}=await import('../../extensions/onnx/src/catalog.ts');
const {downloadModel,verifyModel}=await import('../../extensions/onnx/src/artifacts.ts');
const model=findModel('gliclass-edge-v3.0')!;
const dlStart=performance.now();
await downloadModel(modelDir,model,AbortSignal.timeout(180_000));
await verifyModel(modelDir,model);
record('artifacts',{model:model.id,source:model.source,downloadVerifyMs:Math.round(performance.now()-dlStart)});
const {readConfigFileSnapshot,setRuntimeConfigSnapshot,writeConfigFile,getRuntimeConfig}=await import('../../src/config/config.ts');
const {loadAndActivateRootPluginRegistry}=await import('../../src/plugins/loader.ts');
const {startPluginServices}=await import('../../src/plugins/services.ts');
const {disposePluginRegistryInstances}=await import('../../src/plugins/runtime.ts');
const {createOpenClawTools}=await import('../../src/agents/openclaw-tools.ts');
const {isDecisionAssistanceEligible}=await import('../../src/agents/decision-assistance.ts');
const snapshot=await readConfigFileSnapshot();
assert.equal(snapshot.valid,true,JSON.stringify(snapshot.issues));
setRuntimeConfigSnapshot(snapshot.config,snapshot.sourceConfig);
const registry=loadAndActivateRootPluginRegistry({config:snapshot.config,onlyPluginIds:['onnx'],preferBuiltPluginArtifacts:false,cache:false,throwOnLoadError:true});
assert.equal(registry.decisionProviders.length,1,JSON.stringify(registry.diagnostics));
const provider=registry.decisionProviders[0]!.host.provider;
assert.equal(provider.id,'onnx');
// Transparent observation only: all requests delegate unchanged to the real provider.
const evaluate=provider.evaluate.bind(provider);
let dispatches=0;
provider.evaluate=async (...args)=>{dispatches++;return evaluate(...args);};
const started=performance.now();
const services=await startPluginServices({registry,config:snapshot.config,throwOnStartError:true,onHandle:()=>{}});
const toolFor=(id='main')=>createOpenClawTools({config:getRuntimeConfig(),agentSessionKey:'agent:'+id+':main',disablePluginTools:true,disableMessageTool:true}).find(t=>t.name==='decision_evaluate');
const batch={state:'I loved the quiet beach holiday and would happily go back.',questions:{topic:{type:'choice',criteria:{travel:'travel and holidays',finance:'finance and banking',science:'scientific research'}},sentiment:{type:'score',criteria:['negative sentiment','neutral sentiment','positive sentiment']},holiday:{type:'boolean',criteria:{true:'The text describes a holiday',false:'The text is unrelated to holidays'}}}};
record('environment',{head:execFileSync('git',['rev-parse','HEAD'],{encoding:'utf8'}).trim(),tree:execFileSync('git',['rev-parse','HEAD^{tree}'],{encoding:'utf8'}).trim(),node:process.version,provider:'onnx',model:model.id,backend:'onnxruntime-node 1.29.0 CPU, persistent local child process; no network inference endpoint',warmupMs:Math.round(performance.now()-started),instrumentation:'forwarding wrapper counts calls to the registered real provider.evaluate; no response substitution'});
try {
const retained=toolFor();assert.ok(retained);
for(const enabled of [false,true,false]){
const cfg=getRuntimeConfig();
await writeConfigFile({...cfg,agents:{...cfg.agents,defaults:{...cfg.agents?.defaults,experimental:{...cfg.agents?.defaults?.experimental,decisionAssistance:enabled}}}});
const before=dispatches;
const tool=toolFor();assert.ok(tool);
assert.equal(isDecisionAssistanceEligible(getRuntimeConfig(),'main'),enabled);
assert.equal(toolFor('disabled'),undefined);
assert.equal(dispatches,before);
const start=performance.now();const result=await retained.execute('live-'+enabled,batch);
record('labs-transition',{enabled,toolPresent:!!tool,dispatchDelta:dispatches-before,elapsedMs:Math.round(performance.now()-start),result});
assert.equal((result.details as any).status,'ok');assert.equal(dispatches-before,1);
}
const before=dispatches;
const result=await retained.execute('host-bound',{...batch,state:'x'.repeat(1024*1024+1)});
record('oversized-host-bound',{stateUtf8Bytes:1024*1024+1,dispatchDelta:dispatches-before,result});
assert.equal((result.details as any).reason,'unsupported-input');assert.equal(dispatches,before);
const cfg=getRuntimeConfig();await writeConfigFile({...cfg,agents:{...cfg.agents,entries:{...cfg.agents?.entries,main:{...cfg.agents?.entries?.main,decisionModel:''}}}});
assert.equal(toolFor(),undefined);
const disabled=await retained.execute('disabled',batch);
record('empty-agent-override',{freshToolPresent:false,dispatchDelta:dispatches-before,result:disabled});
assert.equal((disabled.details as any).reason,'disabled');assert.equal(dispatches,before);
await writeConfigFile(cfg);
const missing={...cfg,agents:{...cfg.agents,defaults:{...cfg.agents?.defaults,decisionModel:'onnx/gliclass-base-v3.0'}}};
await writeConfigFile(missing);
const unavailableTool=toolFor();assert.ok(unavailableTool);
const missBefore=dispatches;const unavailable=await unavailableTool.execute('missing-artifacts',batch);
record('unavailable-local-artifacts',{selectedModel:'onnx/gliclass-base-v3.0',toolPresent:true,dispatchDelta:dispatches-missBefore,result:unavailable});
assert.equal((unavailable.details as any).status,'unavailable');
record('summary',{passed:true,totalProviderDispatches:dispatches});
}finally{await services.stop({strict:true});await disposePluginRegistryInstances(registry);}Compatibility disposition: the Labs Boolean is optional and injects no default or automatic work; existing saved-model/reset behavior is preserved. The TypeSafe adapter is absent from stable tag |
|
@clawsweeper re-review — current head 5bbb43b resolves the generated-baseline conflict. Exact-head real ONNX registered-tool proof, actual host-bound output with zero dispatch, and the compatibility disposition are now linked in the PR body: #155134 (comment). The visible Revision 16 still reviews the previous head. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Merged via squash.
|
* commit '7d7f977ccfc1ac177526232e4f4960febd010015': (91 commits) test: avoid unused target setup in package profile fixtures (#155972) fix(worktrees): batch snapshot metadata reads test(plugin-state): distinguish borrowed and foreign lifecycle owners refactor(agents): share external harness session and attempt machinery (#152181) chore(i18n): refresh native locales (#156006) chore(test): retain Doctor fixture settlement diagnostics (#155944) perf(codex): reuse unchanged inference request bytes (#155987) perf(test): prepare snapshot ownership subprocess imports (#155973) perf(test): consolidate channel registry coverage (#155014) fix(runtime): preserve Node worker dependencies and cleanup diagnostics (#155292) perf(test): prepare worktree GC child runtime (#155928) fix(ui): open browser cards after delayed panel renders (#153253) fix(update): retain the running updater by hard link instead of copying the package (#155977) feat(decisions): add explicit evaluation and Labs opt-in foundation (#155134) fix(state): preserve lifecycle custody across worker dispatch improve: reuse shared tooling fixtures and defer legacy updater proof (#155731) improve(ui): reduce real-Gateway test preparation (#155979) perf(state): move session RPC SQL off the Gateway main thread (#155740) docs(freebsd): explain native Codex runtime limits (#155980) fix(qa): count Code Mode nested tool activity as transcript tool evidence (#155976) ...
…penclaw#155134) Add provider-neutral explicit Decision evaluation through the existing runtime, declared provider capabilities, and a default-off Labs consent foundation. Keep explicit evaluation independent of Labs and retire the unreleased TypeSafe-specific tool. No automatic consumer or public selection/local-availability inspection API is added. Verified the registered core tool with real ONNX CPU inference, host-bound rejection before dispatch, and agent disablement. Preserve the contributor implementation and the reviewed Labs UI/config behavior. Related: openclaw#155115, openclaw#155314, openclaw#155317 Co-authored-by: Jacqueline Henriksen <[email protected]> Co-authored-by: jalehman <[email protected]> Co-authored-by: Josh Lehman <[email protected]>
Related: #155115, #155314, #155317
Supersedes: #155795
What Problem This Solves
Agents need one provider-neutral way to evaluate explicit evidence using their configured Decision model, with discoverable provider constraints and a separate opt-in boundary for future automatic experiments.
User Impact
Agents with an effective
decisionModelcan use the coredecision_evaluatetool under normal tool policy and harness capabilities. It supports Boolean, Choice, and Score questions, preserves provider results and provenance, and provides bounded guidance for unsupported input or unavailable providers. The tool works independently of Labs. An explicit empty per-agent model override disables selection; transient provider health does not churn the tool definition.Provider-declared capabilities are exposed through
models.list.decisionModelsand used in tool guidance. TypeSafe and ONNX declare supported question types and constraints, including input limits/accounting and confidence semantics. Undeclared limits remain unknown, not unlimited; metadata is not a live-readiness probe.The TypeSafe-specific evaluation tool registration, tool-specific configuration, and bundled evaluation skill are removed in favor of the shared tool. TypeSafe remains responsible for provider transport and credentials. Callers use explicit shared
stateand typed questions; provider/model selection comes from the trusted calling agent, not a per-call vendor model override. This description does not claim an automatic migration of legacy tool-policy/configuration entries.Settings → Labs gains a default-off Decision assistance preference, backed by
agents.defaults.experimental.decisionAssistance. Future automatic consumers can use a shared eligibility check requiring explicit global opt-in and the owning agent's effective Decision model, inherited globally or configured per agent. Saved intent is distinct from eligibility; unreadable configuration is shown as unknown. No automatic consumers are connected, and enabling the switch starts no inference. It neither gates the explicit tool nor grants action authority.Scope boundary: the public, agent-scoped selection/local-availability inspection API requested in the original tool proposal is not implemented here. This PR is related to that proposal rather than automatically closing its remaining requirements.
Why This Change Was Made
isDecisionAssistanceEligible(config, agentId)helper consumes prepared config and canonical model selection without provider probes, secret resolution, or inference.Evidence
Current implementation head:
5bbb43b00508e85c768231ffb86dc4a3b67a3206. Earlier foundation and UI evidence below remains historical; fresh combined-head checks and real-provider proof are listed separately, not added to the original test count.Conflict resolved: merged pinned main
9eec298184e08a6a3612016bca9932e30cbc2459without rewriting contributor ancestry. The sole conflict,docs/.generated/config-baseline.sha256, was regenerated withpnpm config:docs:gen, thenconfig:docs:check; coupled counts were regenerated and unchanged. The Knip entry auto-merge preserves both owners.Combined-head checks passed: 152 focused tests across 7 files (baseline renderer/writer, runtime config publication/reread, Decision eligibility/registered tool, and Labs), core/UI typechecks, relevant formatting, and production/full-tree dead-export checks. All exited 0 in secretless Crabbox. The Labs page, registry, copy, and visual styles are unchanged; existing screenshots are reused, not claimed as new captures.
Exact-head real ONNX proof: normal plugin/config/service initialization, registered core tool, and real GLiClass Edge CPU inference. Boolean/Choice/Score succeeded with Labs off → on → off. A 1-MiB-plus state was rejected before provider dispatch; empty agent override disabled evaluation without fallback. Missing local model artifacts returned bounded unavailability while the tool remained present. Captured output, forwarding-only dispatch counts, source/tree, commands, model hashes, timings, and run link are in the proof comment; this is not hosted Jev or credential-failure proof.
Compatibility checked: the optional Labs Boolean injects no default or automatic work. TypeSafe is absent from stable
v2026.9.5, declares host/API>=2026.9.6, and documents first publication as pending; the public npm lookup returned 404. No stable-release Doctor migration is introduced or claimed for private/nightly legacy entries.210 focused tests passed for eligibility/schema, registered core tool composition with the real Decision runtime and a fixture provider, and Labs state/save/reset behavior. Coverage includes Labs off → on → off without disabling the explicit tool, inherited/per-agent model selection, empty overrides, ordinary tool denies, and no provider dispatch from eligibility checks alone.
Selected format/type/lint/i18n/config-baseline/dead-export/import-cycle checks passed. Generated config baselines were regenerated; docs config examples and 14,329 internal links passed. Independent review of the foundation found no actionable P0–P2 findings.
Later UI-copy recheck: 61 Labs tests passed, plus a fresh Chromium save/reload/reset flow with a synthetic Gateway and no console/page errors. All contributor-code execution used secretless AWS isolation with trusted bootstrap tooling.
Focused test wall times (
pnpm test <file> --maxWorkers=1): eligibility 2.16s, registered tool 30.34s, final Labs UI 4.62s. The new combined tool case took 0.480s; the registered-flow file includes cold core/runtime imports.Validation limits: no current-head live TypeSafe/Jev result or all-green hosted CI result is claimed. Pre-port CI at
746c168had integration failures outside the port's changed paths; they were not repaired in this consolidation. Evaluate current-head checks separately.Before/after
Actual production-built Control UI with a synthetic Gateway, dark theme, 1280×960. Before: contributor head
746c168. After: current copy with saved consent and no Decision model. The footer version is a fixture; no automatic consumer runs.Before
After
Historical proof and temporary foundation scaffolding
MertBasar0's live Jev proof covers the earlier
fb90f77c8head. Its provider invocation, host-bound rejection, and unavailable-provider results are historical evidence; its Labs-gating assertions are superseded and do not describe the current explicit tool. The original transcript remains in that comment rather than being duplicated here.The consumer-free eligibility module has a narrow Knip entry, documented for removal when its first production consumer imports it. The new Boolean config field is represented in regenerated config baselines. Neither is a second runtime or a new plugin framework.
Contributor credit
Original explicit-tool, provider-capability, and integration work by @jjjhenriksen, preserved with its commit ancestry. Labs foundation and consolidation requested by @jalehman; the port commits include his co-author credit.
Work sessions
These links describe the Labs port, not the contributor's original implementation.
View the OpenClaw team session