Repository navigation
feat: add native process command inspection - #3
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: needs maintainer review before merge. What this changesAdds Darwin and Windows process-command inspection, selected environment reads, and a bounded Windows process census. Example: Inspect a Windows child with arguments ["spaces stay together", "", "é🦞"] and PROC_SAFE_VISIBLE=chosen.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR adds a useful capability absent from current main; source review found no concrete introduced defect. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherThe lazy TypeScript inspection subpath passes validated requests to native OS observers and returns frozen process facts or typed errors. flowchart TD
Caller --> InspectAPI
InspectAPI --> LazyBinding
LazyBinding --> DarwinArguments
LazyBinding --> WindowsHandle
DarwinArguments --> FrozenObservations
WindowsHandle --> FrozenObservations
Technical reviewBest possible solution: Retain the focused native capability with bounded observations, explicit uncertainty, and lazy loading. Do we have a high-confidence way to reproduce the issue? This is an additive feature; current-main source confirms that the requested APIs are absent. Is this the best way to solve the issue? The implementation fits the package contract by reporting native observations without adding application admission policy or shell fallbacks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 909a21190b5e. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
LabelsLabel changes: No label 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 HistoryReview history (8 earlier review cycles)
Reviewed October 10, 2026, 6:04 AM ET / 10:04 UTC (Revision 9). |
b243948 to
b5c4466
Compare
Retain unknown per-process facts, compare owner SIDs, and enforce a relative timeout with bounded enumeration. Preserve caller casing for Windows environment selection and reject filled Darwin argument buffers.
b5c4466 to
2289160
Compare
Adds the lazy
@openclaw/proc-safe/inspectsubpath withreadProcessCommand()for Darwin and Windows andlistProcesses()for Windows. It returns exact argument boundaries, Windows raw command line and cwd, and only requested environment keys. Windows matches environment names case-insensitively and returns the caller's spelling; Darwin matches exactly. Invalid encoding throws rather than replacing bytes.The Windows census returns every enumerated PID with an optional identity, an explicit
same/different/unknownowner, and an optional command. PIDs remain as observation rows when their details are inaccessible or they exit during observation. Each row's facts use one retained process handle, and owner comparison uses validated token SIDs. A relative monotonic timeout and a 65,536-PID cap reject the entire call on timeout or incomplete enumeration. The census never returns environment values.Darwin parsing follows XNU's executable-path alignment rather than skipping every NUL, preserving an empty
argv[0]without consuming environment data. Ambiguous boundaries between envp and Apple startup metadata fail closed. Rust refuses Rosetta inspection before argument reads. Windows validates native and WOW64 layouts and bounds all foreign-memory reads. Results and nested observations are frozen; imports never load native code.Proof includes real main-thread and Worker inspection of native and 32-bit Windows children; owner comparison; protected process rows retaining unknown facts; forced-short timeout rejection; case-insensitive environment selection; empty, quoted, and Unicode arguments; post-exit behavior; all eight suspended Darwin environment alignments; permission denial; and real Rosetta refusal. Native runtime CI also preserves Linux and FreeBSD import/unsupported behavior. No shell fallback, owner filtering, or application admission policy is added.
Validation: all 24 required checks passed on
b5c4466912f22621b7fa5a3a7b07ab52e597f471in this CI run. Independent review is clean. Local Node and Bun checks passed 78 tests with six platform-specific skips; all 15 inspection tests passed. Host and Windows x64/arm64 Clippy, isolated npm/pnpm package installs, and real Darwin denial checks passed. Cold import medians: Node 3.26 ms, Bun 2.81 ms (10 fresh processes each).The protected-process fixture waits for startup readiness before denying access. The caller-token fixture initializes both runtime contexts before denying token access, preserving the existing total 30-second budget. These proofs retain every denial and timeout assertion. No merge or release has been performed.