Repository navigation
feat: add process census evidence for retained artifacts - #160292
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: blocked before merge. Reviewed September 29, 2026, 7:59 PM ET / 23:59 UTC (Revision 13). ClawSweeper reviewWhat this changesAdds a host process census that identifies processes referencing retained update artifacts, including native Windows inspection and Linux ownership handling. Merge readiness⛔ Blocked before merge - 4 items remain Current main lacks the handoff census needed by the open update-repair work, so this PR remains useful. A previously reported path-matching defect remains at the current head and blocks merge. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw inspects running processes before deciding whether retained update artifacts may be reclaimed. The new census takes a run ID and artifact paths and returns matching or unverified process IDs for the stacked repair flow. flowchart LR
A[Run ID and artifact paths] --> C[Process census]
B[Host process details] --> C
C --> D[Reference matching]
D --> E[Matching process IDs]
D --> F[Unverified process IDs]
E --> G[Update repair decision]
F --> G
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +316, Tests +627, Config 0, Other +6. Total +949 across 10 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Make raw-path and file-URL matching use the same normalized directory, then confirm the native Windows census before the stacked repair consumes its result. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection gives a focused case: provide a trailing-slash artifact directory containing a space and a live process whose only reference is a percent-encoded descendant file URL; this review did not execute it. Is this the best way to solve the issue? No. The shared census is the appropriate owner, but its two patterns must normalize the directory consistently before the result can safely guide 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 7cf9ad48b8b4. LabelsLabel changes: No label changes. Label justifications:
EvidenceAcceptance 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 (12 earlier review cycles; latest 8 shown)
|
f30c47f to
9586e1f
Compare
Pull request was closed
9586e1f to
10a8d83
Compare
Use observed whole-file Windows timings and preserve tenth-second precision during shard accumulation. Normalize the POSIX census fixture filesystem paths when the suite runs on Windows.
Read protected Windows process SIDs through the native process snapshot and keep unknown owners conservative with same-account Administrator guidance. Consider all Linux credential UIDs before declaring unreadable work foreign. Allow the next whole-second Windows shard prediction for the approved 0.4-second census inventory overage; keep estimates, coverage, and job count unchanged.
b379b35 to
eada642
Compare
|
Classification of the three reported reds on head The CI checkout was merge
Linux Blacksmith Testbox
The cron replay used Production/test LOC change: 0/0. No CI reruns, branch refreshes, or auto-merge changes were made. |
|
Landed under the pre-existing-red rule at head 3d01ea7. The remaining CI failures were current main reds in the merge window: |
…0292) Process-census capability needed to distinguish a dead managed-service handoff owner from a surviving descendant: a Windows process census (PID, start identity, command line, cwd, owner SID with the foreign-owner rule from the Unix contract), verified Unix UID provenance for incomplete observations, and retained-artifact reference matching that reports matching versus unverified PIDs. Existing callers keep their classification when the new evidence is absent. Refs openclaw#159897 (the reclaim itself follows in openclaw#160488). Landed under the pre-existing-red rule: the remaining CI failures were current main reds in the merge window (fast-lane config expectation fixed by 63129bf; cron service tests fixed by d6351b5; update-candidate-canary from 9b07ea0).
Refs #159897
What Problem This Solves
Update recovery needs evidence that an abandoned updater has no remaining work using its retained artifacts. A dead executor/helper alone cannot establish that.
User Impact
This capability PR supplies the evidence consumed by the stacked lease-owner repair. Existing Doctor and process-group callers retain their decisions; this PR does not clear leases or close the issue.
Windows uses the native Terminal Services PID/SID snapshot to identify protected foreign processes even when
OpenProcessis denied. Unreadable same-account processes and unknown owners remain unverified. Windows foreign-account inspection can require Administrator privileges: the census names unresolved PIDs and supplies a same-account Administrator retry instruction for repair. Profile/state overrides must be preserved. Readable artifact references still count regardless of ownership.Why This Change Was Made
The existing census now matches run IDs and retained paths in argv/cwd, including file URLs, and reports matching and unverified PIDs separately. Native Windows reads provide creation identity, command line, and cwd; the SID snapshot remains allocated until comparisons complete. Kernel-enumerated PIDs absent from the owner snapshot remain unknown. Linux ownership considers real, effective, saved, and filesystem UIDs: any credential matching the updater retains same-account custody, while all-foreign tuples remain foreign.
The rebase preserves main's reclamation changes (#161181), repository-workspace SQL fixes (#161124), current Windows CI lists, and process-group admission check. Main's richer artifact-custody classifier and batched cwd reader remain canonical; the handoff overload consumes that evidence without restoring the retired singular reader. Existing default custody regressions remain alongside the handoff regressions.
Evidence
Prior capability proof at
eada642b05e1db67e85bf29dd6727cd32e5db6ae, rebased once ontoece1294b3179e64faabbd901b318cfae821ddbce.Blacksmith Testbox
tbx_01m3q2jag0s225cxcyfqnr1f48verified the staged tree and source hashes: proof run.origin/mainwasf7741c38ce7c2de9e6cddbbd56efd3875964e36b.git merge-tree --write-tree origin/main HEADexited 0, producing treedc8633c8bbc7305ccf2f2a80e5d592950c8b85b7.Windows predictions are 423 / 422 / 422 / 423 / 422 seconds, within main's existing
<425assertion. The planner retains main's timing accumulator and all other files' estimates. Native Windows confirmation remains assigned to this PR's own Windows CI lane. No CI dispatches or reruns were requested; auto-merge remains enabled.Production/tooling: +358 / −37 = +321 net LOC. Tests: +630 / −9 = +621 net LOC. Package-script edits: +2 / −2. No schema, dependency, config, CLI, environment option, suppression, or baseline changes.
Named follow-up, waived by the lead: pre-existing slow
test/scripts/package-acceptance-workflow.test.ts(191.095 seconds) andtest/scripts/ci-changed-node-test-plan.test.ts(193.976 seconds; one 33.011-second case). These are unchanged and were not part of this scoped rebase proof.Closure repair follow-up
Closure repair head:
60e36443040a6ea3760f2e98ee8820f51253c008.The two closure reds on
7a9a601544bc3eaa250254fd09216c5ea8d4eae2were PR-caused: the shared census statically importswindows-process-census.ts, but the trusted PR wrapper extraction inventory omitted it. Registering that source at the extraction owner fixes both the missing-closure and extracted-module-resolution failures. This is a one-line manifest correction, with no changed test expectation or closure baseline. The 176-line (7.3 KiB) module preserves the synchronous census API, has only a built-in runtime import, and already loads Koffi and Windows DLLs lazily on the Windows census call. A new asynchronous adapter would unnecessarily change that contract.On Blacksmith Testbox
tbx_01m3qnq58n32eq2qz57xtrgf30(proof run), each tooling file ran separately with frozen dependencies:af4f5f884fbcfe0f5024eda5436bb75046bd1d65Commands:
node scripts/run-vitest.mjs test/scripts/eager-import-closure.test.ts,node scripts/run-vitest.mjs test/scripts/pr-wrapper-source-closure.test.ts, andnode scripts/check-changed.mjs -- scripts/pr-lib/wrapper-components.txt. Changed checks passed, including scripts typed lint (0 warnings/errors). The repaired manifest SHA-256 wascbbf4f96818fc81d4bee4e08fdd73e414c86b43330d7057ec5ecfbe2207dc119. Fresh isolated Codex direct-route P1 review: scoped-clean. The Testbox lease was stopped.Both files were also attempted separately on A and pristine main on the Mac. Those attempts were blocked by stale installed TypeScript (
20260917versus required20260920, causingapi.createSnapshot is not a function) and tsx (4.23.13versus4.23.15); the classification above uses the clean Testbox comparison.The separate compact-large-13 failure was
test/vitest/vitest.process.config.ts exited by signal SIGKILL, followed by exit 137, incore-runtime-infra-process-hosted-2at 22:32:37 UTC. There was no failed assertion. The job log does not identify the signal sender or prove OOM; its cause remains unclassified.This follow-up adds +1 tooling LOC and zero production or test LOC; A totals +322 net production/tooling LOC. No CI reruns or dispatches. Auto-merge remains enabled.
Windows census fixture repair
Current head:
3d01ea743e141370fa361ff72839be78309d1b50.The 23 census failures in Windows shard 3 came from inconsistent synthetic filesystem paths. These cases mock Linux process evidence, but
node:pathretains native Windows semantics. Exact POSIX-onlyrealpath,stat, and package-read overrides therefore manufactured missing scripts or missed intended inspection errors when given drive/backslash paths. The reporter's hard-codedfile:///app/reporter.jswas also invalid on Windows.The fixture owner now normalizes paths once at the filesystem mock boundary, before every per-case override, and constructs a native reporter file URL. Production classification and all assertions remain unchanged: readable foreign evidence is a non-holder, retained-artifact aliases are holders, and genuinely unreadable/deleted evidence remains unresolved. The existing classifier catches inspection errors into its closed result union; it does not throw them to its caller.
Blacksmith Testbox
tbx_01m3qrttc8df8jkjhxq0reweev(proof run) replayed the exact baseline and corrected file using Windows path/URL semantics on Linux. Temporary emulation was removed and the final source hash verified before final-tree gates:node scripts/check-changed.mjs -- src/infra/openclaw-process-census.test.ts: passed, including infra test types (40.2 s), dead-export scans, and typed lint (zero warnings/errors).The test commands were
node scripts/run-vitest.mjs src/infra/openclaw-process-census.test.tsandnode scripts/run-vitest.mjs test/scripts/ci-windows-test-plan.test.ts. Final census source SHA-256:34eded43af44c9e834fee98fd9a5019be53920f7e6a3d90e6a538f1ccc49fdba. The Mac single-file attempt was blocked before tests by its stale TypeScript install (api.createSnapshot is not a function). The first Testbox lease,tbx_01m3qrdzy828ef712kg96156a5, stalled fetching baseline history before tests; it was stopped, and the successful comparison used exact baseline bytes from the local Git object instead. Both leases are stopped.This follow-up changes tests only: +17 / −11, +6 net LOC, with no added test cases or process launches. A remains +322 net production/tooling LOC. Native Windows confirmation remains this PR's own Windows CI lane. No PR CI reruns or dispatches; auto-merge stays enabled.