Repository navigation
fix(infra): unify Windows process identity reads [AI-assisted] - #124293
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
d9ac23d to
56b9923
Compare
|
Codex review: needs real behavior proof before merge. Reviewed August 31, 2026, 2:29 AM ET / 06:29 UTC. ClawSweeper reviewWhat this changesThis PR centralizes Windows process-start identity probing, bounds its PowerShell-to-WMIC fallback, caches a successful self-process identity, and adds Windows routing and Gateway-cron coverage. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readiness⛔ Blocked until stronger real behavior proof is added - 6 items remain Keep open: the Windows cron/lock repair is useful, but the newly introduced reader bypasses OpenClaw’s trusted Windows executable resolver and can select a poisoned process environment path for PowerShell or WMIC. Priority: P1 Review scores
Verification
How this fits togetherCron receipts, gateway locks, and node workers use a process start time to distinguish a live process from a reused PID. The shared identity helper feeds those lifecycle checks, which either admit work safely or fail closed. flowchart LR
A[Windows cron or lock request] --> B[Shared process identity helper]
B --> C[Windows process-start reader]
C --> D[PowerShell then WMIC fallback]
D --> E[PID-reuse-safe start identity]
E --> F[Cron receipt and lock decisions]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The introduced system-executable path construction bypasses the repository’s established trusted Windows root resolution. PR surfaceSource +45, Tests +196, Config 0, Other +8. Total +249 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep one Windows process-tool path resolver: use the existing registry-aware helpers for both probes, retain the single fallback deadline, and attach an exact-head Windows trace after the repair. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the affected Windows path: a poisoned SystemRoot/WINDIR makes the introduced reader select a different executable root than the existing resolver’s registry-preferred contract; it was not executed in this read-only review. Is this the best way to solve the issue? No. Sharing the stronger reader is the right direction, but duplicating executable-root resolution discards an existing security and availability contract; importing the canonical helpers is the narrower repair. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f6d7fe44070a. LabelsLabel justifications:
EvidenceSecurity concerns:
Acceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (22 earlier review cycles; latest 8 shown)
|
|
Thanks — working the 1. Add real behavior proof — done, and it post-dates the review. The review ran at 21:57 UTC against Two things in that same log show the win32 branch actually executed rather than short-circuiting: the file takes 152ms on macOS vs 5684ms here (real 2. Merge risk — node-worker probe tightened 5s → 1s. Fair, and I'd rather prove it than argue it. const identity = requireNodeWorkerProcessIdentity(process.pid);
expect(identity).toEqual({ pid: process.pid, startTime: getFileLockProcessStartTime(process.pid) });
expect(inspectNodeWorkerProcessIdentity(identity)).toBe("live");
expect(inspectNodeWorkerProcessIdentity({ pid: process.pid, startTime: 1 })).toBe("reused");That case is green on real Windows above ( 3. The report lists
My guess is the detector matched substrings inside the test filenames those strings enumerate — One honest note carried over from the PR body: I don't have a physical Windows host, so the "after" side is the repo's own @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Finding accepted and fixed — and it turned out to be load-bearing in a way neither of us had argued. Three commits since the review: 1. The finding — acceptedI had called the 5s → 1s change on the node-worker path a deliberate tradeoff and documented it. Documenting a regression doesn't stop it being one: worker startup could fail closed on a slow Windows host where it previously succeeded, and nothing in this issue required that. 2. 1s was wrong for every caller, not just node-workerThe exact-head Windows lane on Only the first probe failed; later ones passed in ~700ms. That is PowerShell module load — the This is a correctness bug, not a tuning nit: a timeout yields 3. Paying that budget once instead of per tickCron re-reads our own identity every ~2s tick, and our own start time cannot change while the process lives, so
The per-tick spawn is gone, which bounds the hot path better than the short timeout did — a more direct answer to 4. Then the Linux lane caught my memo
5. Where the diff ended upExecutable production is +13 ( 6. Coverage and verificationNew/updated tests: node-host pins the forwarded 5s from both entry points (verified it fails when the argument is dropped); Local on Exact-head CI on @clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks @Chinmayrawat15! Proof: On exact head
|
|
Thanks for finishing this off, and for the cold-PowerShell run. That proof answers the thing I got wrong. I capped the whole probe at the 5s default, so a PowerShell call that used its full budget left WMIC nothing, and the fallback was dead in exactly the case it exists for. Capping PowerShell at 5s inside a 10s deadline is the right shape, and your run shows the old 1s path in Same story on the consumer branches. I left them in because they routed to |
What Problem This Solves
Windows had two process-start identity paths. The shared file-lock path started PowerShell with a one-second timeout and no fallback, while node-worker checks used the stronger
Get-CimInstanceplus WMIC reader.Cold PowerShell startup can exceed one second. The shared path then returned no identity, so a scheduled cron run could not acquire its PID-reuse-safe durable fence.
Why This Change Was Made
The shared process-identity owner now uses one dependency-light Windows reader. The duplicate node-worker platform branch and the older copy inside port diagnostics are removed.
The default Windows deadline is 10 seconds. PowerShell may use at most five seconds, and WMIC receives the remaining time. Gateway lock checks that explicitly request one second remain bounded to one second.
A successful self-process identity is cached for the process lifetime, so cron does not spawn PowerShell on every tick. Foreign process identities remain uncached so PID reuse stays observable.
User Impact
Windows cron runs can acquire and complete durable receipts even when cold PowerShell startup is slow. Node-worker checks use the same identity owner. Missing identity still fails closed, and foreign PID reuse remains protected.
Evidence
a4c8c09ba615df6ad4483696a00cd88a47c37391: run https://github.com/openclaw/openclaw/actions/runs/33353090614 suspended cold PowerShell past five seconds. WMIC did not start, and worker identity failed closed after 5.365 seconds.d8a39cfaeb05a4be512cb0bc57e5aa12c36335f3: run https://github.com/openclaw/openclaw/actions/runs/33363932920 observed WMIC after the delayed PowerShell probe and launched the worker in 6.162 seconds through the shared owner.status: ok. Exact-head PR CI passed its Windows lane.fbe4b1bb8bf2f6e1168c5acb65f47956d2ef378d: run https://github.com/openclaw/openclaw/actions/runs/33324560142 passed 12 natural cold probes and a real Gateway cron receipt. This control does not claim the delayed-start failure.git diff --checkpassed. Exact-head Autoreview v2 with Codex Sol/high reported no P0 findings.Production delta: runtime
+151/-106, including the reader moved out of port diagnostics; changed-path tooling+8/-0; tests+257/-61; test-runner configuration+1/-1. Runtime growth records the dependency-light canonical owner and self-identity cache while deleting two duplicate platform paths.Refs #124125