Skip to content

refactor(typesafe): isolate Decision and local protocol codecs - #188248

Merged
vincentkoc merged 7 commits into
mainfrom
refactor/decision-14-typesafe-protocol
Oct 31, 2026
Merged

vincentkoc merged 7 commits into
mainfrom
refactor/decision-14-typesafe-protocol

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

TypeSafe Decision preparation and its native client contain inline question, result, image and local-server wire conversions.

User Impact

No user-visible behavior or configuration change. Part 14 of the Decision refactor stack, based on part 13.

Why This Change Was Made

Move the native mappings to one plugin-local codec. Keep catalog facts, credentials, prepared configuration, HTTP, timeouts, admission and response lifecycle in their existing owners. Native schema validation remains in the lazy client. The V1 bridge remains unchanged for the next slice to remove separately.

Three production files, +150/-123 lines. No new public SDK surface, configuration or framework. Existing transport, image, expressive-contract and lazy-registration tests remain.

Evidence

  • Independent fresh source review and local committed-range ClawSweeper review completed with no unresolved actionable findings. Corrective changes were reviewed separately; mechanical restacks were checked with git range-diff.
  • Exact-head ordinary CI passed at 81305304ba6caac258e0822001527381f4d9dbb3, including the configured runtime, type, lint and guard lanes.
  • Aggregate production build passed at final production head 5b235dd694af030aeb75e1ec6e831b71ce4b745c. Shared SDK source-audit evidence, the advisory API-report timeout and broader manual-campaign limitations are recorded in part01.
  • Pinned local formatting, limited standalone lint, content hooks and diff checks passed. Local dependencies failed qualification, so no local project runtime pass is claimed.

Landing update

Current head: f144f882eae4bcbf2755701fdf0051fc97e6ad8c; current-head CI passed at f144f882eae4bcbf2755701fdf0051fc97e6ad8c. Native landing targets main after the preceding slice merged. The own-slice commit range is patch-identical after replay onto verified landed part08 dda109cacbbefd3a6dfcc442ac97e2107b6c62c8. This resolves the part09 squash-ancestry conflict and gives fresh CI a protected-main baseline. All16 replayed ranges were checked with git range-diff and valid commit signatures. Prior CI is historical evidence at its recorded head; native review, preparation and merge checks remain required.

Earlier landing evidence

Earlier head: 5227038b6527fccfc55ed2542449782f75bf8337; that head's CI is pending. After part04 landed, the remaining stack was replayed onto its actual protected-main commit 63dbee6a514580948082dc20cb930c7e748c019e to resolve the named CI/base-context gap in part05. All 20 commit ranges remain patch-identical by git range-diff; the allocation guard passes. Earlier CI/build evidence above remains historical. Each slice lands through the native main-targeted review, preparation, and merge workflow after its predecessor.

The reviewed main reconciliation retains the canonical System One decoder. TypeSafe retains its inline executor and native V2 execution without a V1 round trip.

@vincentkoc vincentkoc self-assigned this Oct 30, 2026
@clawsweeper

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

@vincentkoc
vincentkoc marked this pull request as ready for review October 30, 2026 10:16
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR moves TypeSafe question, result, image, and local-server conversions into a plugin-local codec.

Example: A local Kev evaluation uses score criteria [null, "Urgent"].

  • Before: The client sends ["", "Urgent"] and restores the original criteria in the returned legend.
  • After: The extracted codec performs the same conversion and restoration.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, behavior-preserving extraction with green current-head checks and no actionable findings; runtime evidence remains limited to test coverage.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor proof gate; supplied evidence consists of source review and passing current-head CI, without a recorded shipped-entry-point run.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction isolates vendor conversions without adding configuration, state, public APIs, or competing implementations.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored extraction preserves existing behavior, has passing current-head CI, and introduces no actionable correctness findings.

Priority: P3
Reviewed head: 81305304ba6caac258e0822001527381f4d9dbb3

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: No shipped CLI or Gateway execution of the extracted path is supplied; existing loopback and mocked transport suites provide supporting coverage.
Agent review details

How this fits together

The TypeSafe plugin translates prepared Decision batches into System One requests; its lazy client validates inputs, performs guarded HTTP, validates responses, and returns typed answers.

flowchart LR
  A[Prepared Decision batch] --> B[TypeSafe provider]
  B --> C[Plugin codec]
  C --> D[Lazy validated client]
  D --> E[Guarded HTTP]
  E --> F[Jev or Kev server]
  F --> D
  D --> C
  C --> B
Loading

Technical review

Best possible solution:

Keep the codec private and preserve the existing provider and client owners throughout the staged refactor.

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

This is a behavior-preserving refactor with no reported product defect to reproduce; no target code was executed during this read-only review.

Is this the best way to solve the issue?

The extraction gives two existing callers one private conversion module, removes the replaced inline code, and preserves the V1 contract until the separate V2 cutover.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Decision question and result mappings keeps the original intent (feat(typesafe): bundle TypeSafe AI decision models #152298: Keep vendor translation and validation inside the TypeSafe adapter; later owner refactors retained these mappings.)
  • Tagged image conversion keeps the original intent (09b55d3: Support hosted PNG/JPEG evidence while retaining prepared routes, guarded transport, text behavior, and image-only opt-in.)
  • Local wire rendering and legend restoration keeps the original intent (feat(typesafe): support local System One decision models #154059: Support local System One servers without forwarding hosted credentials; later transport-owner consolidation retained explicit rubric rendering and original legends.)
  • Lazy transport and validator loading keeps the original intent (4f1a901: Defer startup work until evaluation; the extracted module imports schema definitions and image assets only as types.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit b54005a adds extensions/typesafe/src/decisions.ts:118 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: b54005ac3aa9; files: extensions/typesafe/src/decisions.ts)

PR surface

Source +25. Total +25 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 148 123 +25
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 148 123 +25

Labels

Label changes:

  • add P3: Internal refactoring with no intended user-visible behavior, configuration, or public API change.
  • 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:

  • P3: Internal refactoring with no intended user-visible behavior, configuration, or public API change.
  • 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.

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 30, 2026, 6:46 AM ET / 10:46 UTC.

@vincentkoc
vincentkoc force-pushed the refactor/decision-14-typesafe-protocol branch from 8130530 to ed26e87 Compare October 30, 2026 13:37
@vincentkoc
vincentkoc force-pushed the refactor/decision-13-clawrouter-provider branch from 242df74 to cbc12ff Compare October 30, 2026 13:38
@vincentkoc
vincentkoc force-pushed the refactor/decision-14-typesafe-protocol branch from ed26e87 to d34dfbe Compare October 30, 2026 13:58
@vincentkoc
vincentkoc force-pushed the refactor/decision-13-clawrouter-provider branch 2 times, most recently from 5ca9472 to 6aa1a01 Compare October 30, 2026 14:28
@vincentkoc
vincentkoc changed the base branch from refactor/decision-13-clawrouter-provider to main October 31, 2026 03:04
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation extensions: openai extensions: openrouter extensions: clawrouter Extension: clawrouter extensions: baseten Extension: baseten extensions: liquid-ai Plugin: liquid-ai and removed size: M labels Oct 31, 2026
@vincentkoc
vincentkoc force-pushed the refactor/decision-14-typesafe-protocol branch from 5227038 to f144f88 Compare October 31, 2026 03:07
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation extensions: openai labels Oct 31, 2026
@vincentkoc
vincentkoc merged commit c993c8f into main Oct 31, 2026
115 of 116 checks passed
@vincentkoc
vincentkoc deleted the refactor/decision-14-typesafe-protocol branch October 31, 2026 03:50
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 31, 2026
…law#188248)

* refactor(liquid-ai): separate Decision preparation and execution

* refactor(openrouter): isolate native Decision request policy

* refactor(openrouter): prepare Decision routing before execution

* refactor(baseten): separate Decision protocol and execution

* refactor(clawrouter): prepare caller-bound Decision catalog grants

* refactor(typesafe): isolate Decision and local protocol codecs

* fix(typesafe): preserve readonly Decision encoder inference
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: baseten Extension: baseten extensions: clawrouter Extension: clawrouter extensions: liquid-ai Plugin: liquid-ai extensions: openrouter P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: typesafe rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant