Repository navigation
fix(gateway): isolate cold placement results from later reads - #177489
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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs changes before merge. What this changesThis PR copies cold placement results before returning them so caller mutations cannot change retained placement facts. Example: A caller reads placement caller-owned-placement after reopening the database, then changes agentId to caller-mutated-agent and turnClaim.claimId to caller-mutated-claim.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: this PR fixes a current-main object-aliasing bug with a focused change and a meaningful regression test; no introduced correctness or security defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe placement reader loads session placement records through the database worker, publishes them to the Gateway's retained replica, and returns records to placement-store callers. flowchart LR
A[Placement caller] --> B[Placement read store]
B --> C[Database worker]
C --> D[Placement records]
D --> E[Retained replica]
D --> F[Caller result copy]
F --> A
Technical reviewBest possible solution: Retain the boundary copy and regression test while preserving the existing replica, publication, and authority owners. Do we have a high-confidence way to reproduce the issue? Current-main source directly exposes the aliasing path, and the PR reports a matching real-store negative control; this read-only review ran no target code. Is this the best way to solve the issue? The one-line cold-result copy is the smallest complete fix for getManyAsync and its getAsync consumer, matching existing warm-read behavior without copying internal inventories. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 0d955281f9f3. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource 0, Tests +42. Total +42 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 19, 2026, 12:56 PM ET / 16:56 UTC. |
|
Exact-head landing evidence for
The inspected checkout is Local proof: refined cold negative control failed at the intended top-level/nested alias assertion; the fix passes 16 tests across both complete owner suites, targeted native types, scoped lint and formatting. Independent P0–P2 review is scoped-clean. The separate local suppression audit remains honestly recorded as 13 passes / one unchanged |
What Problem This Solves
Fixes later placement reads reporting caller-mutated metadata after a plugin modifies its first, cold placement result.
User Impact
SDK placement results remain independently mutable whether the reader is cold or warm. Modifying a returned agent ID or nested turn claim no longer changes the Gateway's retained placement facts. No migration or user action is required.
Why This Change Was Made
Cold reads published their worker records to the canonical replica and returned those same records to callers. Warm reads already detached their results. Apply that existing caller-owned result contract at the cold result adapter too, without copying internal inventories or changing publication, authority checks, persisted data, or public types.
Best-effort tradeoffs accepted
None: no guard is removed. The boundary copy preserves the existing mutable SDK contract; internal retained facts keep their current ownership and authority checks.
Net production LOC removed: 0 (one-line replacement). Tests: 42 net lines added, one regression in the existing reader suite. This is a real bug fix, not deletion-quota credit.
Evidence
Negative control on unchanged production: the real native store was persisted, closed, and reopened; the cold-cache precondition and initial record passed, then the post-mutation read failed with both caller-mutated fields. Case 2.005s; isolated wrapper 87.10s.
Independent complete-diff P0–P2 review: scoped-clean. No new API, schema, config, dependency, suppression, timeout, retry, skip, or protected memory-backend change.
Both complete focused reader/projection suites: 16 passed. The new regression passed in 2.920s; Vitest 183.90s / isolated wrapper 202.51s, including cached-worker preparation and verification.
Three-root native typecheck passed (8.51s); two-file type-aware lint passed (48.04s); formatting passed (25ms).
Required suppression audit: 13 passed / 1 unchanged baseline failure (20.83s wrapper): the allowlist expects 97 entries but finds 98, adding
src/gateway/session-row-scope.ts | unicorn/no-new-array | 1. Both that file and the audit are byte-identical to this branch's fresh main base. The coordinator records this exact open scheduled-main signature in run 39270035500. No suppression or baseline is changed here; this local failure is not claimed fixed by later CI.Exact-head hosted CI is the broad acceptance gate; no live operator Gateway or real user state is exercised locally.
Exact-head inherited CI exception
Run 39287247724 attempt 1 completed on this exact head: all selected executable suites and independent security passed. The sole executable failure is
checks-fast-baseline-ratchets/ 118178606331: an unrelated closed mock atsrc/infra/openclaw-process-census.missing-command.test.ts:12. The actual scanner reproduces the exact unallowlisted factory fingerprint on the unchanged CI baseline, tested merge and fresh main. Neither authored path is named. Aggregate 118188435164 depends only on that leaf. The complete 82-job/223-check census and failure table are retained in the landing evidence comment; CI is not called green.The native exact-head workflow failed twice before merge dispatch: moving-main observation, then GitHub core API quota. The coordinator-authorized direct exact-SHA fallback applies after quota reset, with the same reviewed head, attributed failures and independent security clearance. No CI rerun, repair push, rebase or gate waiver is used.