Repository navigation
fix(worker): reject malformed protocol records - #133123
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 3:09 AM ET / 07:09 UTC. ClawSweeper reviewWhat this changesThe PR centralizes strict own-property validation for worker protocol records and adds regressions for fields inherited through object prototypes. Merge readinessKeep 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 Review scores
Verification
How this fits togetherWorker 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]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -13, Tests +169. Total +156 across 13 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
648c063 to
f10bdc4
Compare
|
Rebased onto current main and addressed the post-review behavior added there:
Final head:
|
|
Maintainer disposition for the latest ClawSweeper review:
Approved to land through the native PR workflow. |
|
Merged via squash.
|
* 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
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.tsResult: 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.