Skip to content

fix(worker): reject malformed protocol records - #133123

Merged
vincentkoc merged 4 commits into
mainfrom
fix/worker-protocol-own-keys
Aug 30, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
fix/worker-protocol-own-keys

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Aug 30, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes an issue where malformed worker protocol objects could satisfy closed-record validation with required or optional fields inherited from their prototype. Some parsers then normalized those objects as valid, materialized inherited transport settings, or returned assignments whose authority no longer matched their own fields.

Why This Change Was Made

Worker-owned protocol parsers now share one exact-own-key validator. It requires every mandatory field to be an own string key, rejects inherited optional fields, and rejects unknown own fields, replacing prototype-inclusive and count-only checks across the worker protocol boundary.

This does not change valid protocol payloads, the public protocol schema, configuration, or protocol versions.

User Impact

Workers reject malformed in-memory protocol records consistently instead of accepting inherited authority, identity, endpoint, transport, or lifecycle fields.

Production LOC: +63/-76 (net -13) | Tests: +171/-2

Evidence

  • Pre-fix regressions failed for inherited launch versions, assignment computer descriptors, nested computer node IDs, endpoint kinds and TLS fingerprints, process request/result discriminators, admission-deadline results, and IPC start messages.

  • Post-fix focused and sibling tests:

    node scripts/run-vitest.mjs src/worker/launch-descriptor.test.ts src/worker/worker-connection-endpoint.test.ts src/worker/node-workspace-protocol.test.ts src/worker/worker-process-protocol.test.ts src/worker/worker-command.runtime.test.ts src/worker/worker.runtime.test.ts

    Result: 6 files, 173 tests passed.

  • pnpm check:assertion-safety --base origin/main: passed.

  • pnpm check:max-lines-ratchet --base origin/main: passed.

  • pnpm tsgo:core: passed.

  • Scoped oxlint, formatting, import-cycle, and diff checks: passed.

  • CLI bootstrap tests: 9 passed.

  • Mandatory structured autoreview: no actionable findings, correctness 0.99.

  • Independent exact-head review of f10bdc4944ee8d74560dc703994c6984f1ae1b02: no findings; best-fix verdict.

The aggregate local build reached the sparse worktree's absent ui/config/* inputs after worker/core bundle phases completed. Exact-head CI runs from a full checkout.

@clawsweeper

clawsweeper Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@vincentkoc vincentkoc self-assigned this Aug 30, 2026
@openclaw-barnacle openclaw-barnacle Bot added size: M maintainer Maintainer-authored PR labels Aug 30, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review August 30, 2026 06:42
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 30, 2026
@clawsweeper

clawsweeper Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:09 AM ET / 07:09 UTC.

ClawSweeper review

What this changes

The PR centralizes strict own-property validation for worker protocol records and adds regressions for fields inherited through object prototypes.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep open. This maintainer-owned protected PR is a coherent worker-boundary hardening change, has no identified introduced defect, and is not present or superseded on fetched main.

Priority: P2
Reviewed head: f10bdc4944ee8d74560dc703994c6984f1ae1b02

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent net-negative hardening patch with focused boundary coverage and no identified correctness finding.
Proof confidence 🌊 off-meta tidepool Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its supplied focused regressions directly cover the changed worker parser boundary.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its supplied focused regressions directly cover the changed worker parser boundary.
Evidence reviewed 5 items Canonical validation fix: The new helper requires own required fields, rejects inherited declared optional fields, and rejects unknown own fields.
Pre-fix malformed process record accepted: The prior process-message parser accepted an inherited discriminator when the object had the expected count of own enumerable keys.
Production entrypoint: Managed worker JSONL input is decoded and passed through the worker process parser before descriptor execution.
Findings None None.
Security None None.

How this fits together

Worker launch, IPC, endpoint, supervisor, and workspace parsers turn protocol records into descriptors used to start and control workers. Invalid records should be rejected before they reach runtime, transport, or lifecycle actions.

flowchart LR
  A[Worker protocol record] --> B[Boundary parser]
  B --> C{Declared fields are own properties}
  C -->|No| D[Reject record]
  C -->|Yes| E[Typed worker descriptor]
  E --> F[Worker runtime]
  F --> G[Connection or process action]
Loading

Before merge

  • Complete next step (P2) - The MEMBER-authored PR carries the protected maintainer label and needs ordinary maintainer review plus exact-head CI rather than automated repair.
Agent review details

Security

None.

PR surface

Source -13, Tests +169. Total +156 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 9 63 76 -13
Tests 4 171 2 +169
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 234 78 +156

Review metrics

Metric Value Why it matters
Production vs test LOC production +63/-76 (net -13); tests +171/-2 The hardening removes repeated production validators while adding focused boundary regressions.

Stored data model

Persistent data-model change detected: durable storage schema: src/worker/launch-descriptor.ts, durable storage schema: src/worker/node-desktop-protocol.ts, durable storage schema: src/worker/node-supervisor-protocol.ts, durable storage schema: src/worker/node-workspace-protocol.ts, durable storage schema: src/worker/protocol-record.ts, durable storage schema: src/worker/worker-connection-endpoint.ts, and 6 more. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Retain the single worker-owned closed-record validator and land it once the protected maintainer review and exact-head CI gates are satisfied.

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

Yes at the source boundary: the pre-fix count-based and prototype-inclusive checks accept the inherited-field shapes covered by the added parser tests, although this review did not execute them.

Is this the best way to solve the issue?

Yes. A shared validator removes several weaker duplicated checks at the owner boundary, while the retained workspace protocol uses its separate strict schema path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 87b71210c8d1.

Labels

Label justifications:

  • P2: This is bounded worker protocol hardening with no evidence of an active user-facing outage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This MEMBER-authored PR is exempt from the external-contributor proof gate; its supplied focused regressions directly cover the changed worker parser boundary.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-30T06:48:23.517Z sha 648c0637500eb0f6f8b22966342583bf003fed0f :: needs maintainer review before merge. :: none

@vincentkoc
vincentkoc force-pushed the fix/worker-protocol-own-keys branch from 648c063 to f10bdc4 Compare August 30, 2026 07:02
@vincentkoc

Copy link
Copy Markdown
Member Author

Rebased onto current main and addressed the post-review behavior added there:

  • the new computer descriptor path now uses the shared exact-own-key validator;
  • inherited optional fields are rejected at the helper boundary;
  • regressions cover inherited assignment computer descriptors and TLS fingerprints;
  • the assertion-safety and scoped oxlint failures are fixed.

Final head: f10bdc4944ee8d74560dc703994c6984f1ae1b02

@clawsweeper re-review

@vincentkoc

Copy link
Copy Markdown
Member Author

Maintainer disposition for the latest ClawSweeper review:

  • no actionable findings;
  • no Rank-up moves were listed;
  • the shared worker-owned validator is the accepted owner-boundary fix;
  • exact-head CI is green on f10bdc4944ee8d74560dc703994c6984f1ae1b02 with 193 successful checks and no failures;
  • the stored-data-model classification is not applicable: this PR changes transient worker protocol record validation only, with no SQLite, persistent store, schema version, migration, config, or protocol version change.

Approved to land through the native PR workflow.

@vincentkoc
vincentkoc merged commit 41dccab into main Aug 30, 2026
240 checks passed
@vincentkoc
vincentkoc deleted the fix/worker-protocol-own-keys branch August 30, 2026 07:15
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 31, 2026
* fix(worker): require own protocol record keys

* fix(worker): avoid unnecessary protocol assertion

* fix(worker): reject inherited optional protocol fields

* test(worker): avoid shadowed computer binding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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