Repository navigation
fix(process): run ps from fixed system locations, not REA's PATH - #10755
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
[Medium impact] The PR appears safe to merge; the previous diagnostic-loss finding is fixed and no new blocking issue was found. SummaryThis PR makes process inspection prefer fixed system locations for
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Ownership checks, sampling, doctor"] --> B["resolveSystemPs"]
B --> C{"Host"}
C -->|macOS|D["/bin/ps"]
C -->|Linux|E["First executable fixed location"]
E -->|None executable|F["ps from PATH"]
C -->|Other|F
Reviews (4) · Last reviewed commit: "fix(application): keep which ps ran in p..." · Reviewed by Greptile |
Owned process cleanup and process sampling ran "ps" through REA's PATH, so an unusable PATH turned a confirmable cleanup into an incomplete one (spawn ps ENOENT). macOS ships ps at /bin/ps on the sealed system volume. Linux keeps the documented procps-on-REA's-PATH contract.
Linux process ownership now runs the first executable of /bin/ps, /usr/bin/ps and /run/current-system/sw/bin/ps, searching REA's PATH only when none exists. Admission refusals name the ps that ran in their reason and ps_command/ps_source diagnostics; cleanup failure reasons keep the executed command. Doctor and remediation text follow the same selection. The macOS cleanup test now releases its fixture group even when the descendant wait fails.
144a217 to
28193b3
Compare
|
@greptileai review — the head (28193b3) now registers fixture release with onTestFinished before the wait and adds the Linux fixed-location ps selection. |
ownedProcessPrerequisiteAvailability copied only the admission and system codes from a Linux ps refusal, so Ghidra, JADX and Apktool status lost ps_command and ps_source. Copy the refusal's prerequisite facts from one key list.
… of reading it ambiently #10755 added two process.platform reads (ps selection in process sampling and the desktop build doctor's ps fact) after the host-platform ratchet was measured. The desktop fact already receives the host platform from doctor; process sampling now receives it from the capture harness, removing all five ambient reads there.
…ent process.platform reads (#10911) * refactor(platform): give the host platform one owner and ratchet ambient process.platform reads * refactor(process): pass the host platform to process sampling instead of reading it ambiently #10755 added two process.platform reads (ps selection in process sampling and the desktop build doctor's ps fact) after the host-platform ratchet was measured. The desktop fact already receives the host platform from doctor; process sampling now receives it from the capture harness, removing all five ambient reads there.
Main changed three English README passages after the Hindi edition was written: morluto#10693 retired the full input schema profile, morluto#10632 made output schemas omitted from tools/list by default with an opt-in compact profile, and morluto#10755 runs a system ps instead of one on REA's PATH. The Hindi text still recommended REA_MCP_INPUT_SCHEMA_PROFILE=full, which the server now refuses, and said complete output schemas were the default. The two schema paragraphs and the Linux ps requirement now say what the English README says.
Summary
Owned process cleanup and process sampling ran
psthrough REA's own PATH. When that PATH could not findps(or found a different one first), a cleanup REA could otherwise confirm was reported as incomplete (process table could not be inspected: spawn ps ENOENT) and the owned group was left running. macOS now always runs/bin/ps. Linux runs the first executable of/bin/ps,/usr/bin/psand/run/current-system/sw/bin/ps(NixOS) and searches REA's PATH only when none exists (coordinator decision).Problem and expected behavior
Smallest trigger (macOS): launch an owned process group whose cleanup must inspect the process table (
spawnOwnedProviderProcesspluscleanupOwnedProcessGroup), with REA'sPATHset to a directory withoutps.supervisor.stop()returnedstatus: "incomplete"and the group stayed alive. The same thing happened in #10739's IDA environment test, which stubs REA'sPATH. That test had to keep a realPATHas a workaround.Expected: REA's process inspection does not depend on its PATH for a system tool the OS always ships at a fixed path. macOS ships
psat/bin/pson the sealed system volume.src/hopper/BridgeLauncher.tsalready runs/bin/psthis way.Change and scope
src/process/systemPs.tsowns whichpsREA runs (resolveSystemPs):/bin/pson darwin; on Linux the fixed system locations above, then REA's PATH; other platforms keep PATH. It returns the command and its source (systemorpath).ProcessOwnershipObservationuses it for the process list and the non-Linux, non-darwin environment read.capture/ProcessSamplinguses it for its process rows.DesktopBuildDoctorFactsprobes the same selectedps.psran: Linux admission refusals (LinuxOwnedProcessPrerequisiteError, and the provider availability built from them) append(ran ps at /usr/bin/ps)or(ran ps from REA's PATH (none of ... is executable))to the reason and carryps_command/ps_sourcediagnostics; non-Linuxbaseline_unavailableadmission errors carry the same diagnostics. Cleanup failure reasons keep the original execution error, whose text names the executed command (spawn /usr/bin/ps ENOENT, or barepsfor the PATH fallback); the original error object is preserved, not wrapped.LINUX_PROCESS_OWNERSHIP_REMEDIATION, the macOSbaseline_unavailablerecovery and the desktop-build doctor remedy name the fixed locations instead of "put a ps on REA's PATH". English docs (README, installation, Ghidra, Android, firmware, testing lanes) follow; translated READMEs are not changed.createSystemProcessOwnershipHosttakeslinuxPsLocationsso a test can model a Linux host without any fixedps.systemPs.test.ts) now registers fixture-group release withonTestFinishedbefore waiting for the descendant (review thread).BridgeLauncher's macOS-only/bin/psliteral. refactor(ida): launch stdio registrations through the owned MCP transport #10739's IDA test workaround is reverted separately once this lands on main.Contribution scope: an ordinary fix within existing boundaries; not applicable.
Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.
Contract and boundary impact
src/process/systemPs.tsdecides whichpsruns. Its consumers areProcessOwnershipObservation(ownership inspection used by admission and cleanup),ProcessSampling(capture sampling) and the desktop-build doctor. No superseded path remains./bin/ps. Linux: fixed system locations, then PATH. Other POSIX platforms: unchanged.psarguments and environment as before.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): none.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
src/process/systemPs.test.tscovers the selection order (first fixed location wins, NixOS path, PATH fallback, darwin/bin/ps, freebsd PATH) and, on macOS, launches an owned Node group with a descendant while REA'sPATHis/nonexistent-rea-pathand requires confirmed cleanup.ownedProcessAvailability.test.tsasserts the refusal's reason andps_command/ps_sourcediagnostics.webSourceLocationMcp.test.tsmodels a missing LinuxpswithlinuxPsLocations: []plus an empty PATH, since PATH alone can no longer hide the systemps.sessionMcp.test.tscompares against the remediation constant.processObservationCommandFinalization.test.tsusesfreebsdfor its PATH fixtureps.ProcessOwnershipObservationreverted to"ps", the macOS test fails withexpected 'incomplete' not to be 'incomplete'. The selection tests fail on the base revision because no resolver exists.linuxhost on macOS; the real Linux CI run is the first Linux execution. No real-provider runs.For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.
For evidence-bearing changes:
Validation performed
npm run test:local -- src/process/systemPs.test.ts src/process/ProcessOwnership.listCancellation.test.ts src/process/ProcessOwnership.movedProbe.test.ts src/desktop/DesktopBuildDoctorFacts.test.ts src/application/DesktopBuildDoctor.test.ts src/application/ownedProcessAvailability.test.ts src/apktool/ApktoolProvider.test.ts src/javascript/sourceMaps/SourceMapCommand.test.ts src/application/CapabilityInventory.test.ts src/application/binary/AnalysisProviderRegistry.test.ts src/process/ProviderProcess.launcherExit.test.ts— 11 files, 253 passed.npm run test:focused -- tests/boundary/mcp/sessionMcp.test.ts tests/composition/reverseProviderLaunchErrors.test.ts tests/boundary/providers/posixProcessObservation.test.ts tests/boundary/mcp/webSourceLocationMcp.test.ts tests/boundary/cli/ghidraJavaDoctor.test.ts tests/process-global/processObservationCommandFinalization.test.ts— passed after thewebSourceLocationMcpupdate (it failed before that update, as expected).npm run check:fast— passed.npm run docs:check— passed.npx oxfmt --checkon changed files — passed. Pre-push hook passed.ps_command/ps_sourceinto provider availability:npm run test:local -- src/application/ownedProcessAvailability.test.ts src/apktool/ApktoolProvider.test.ts src/application/CapabilityInventory.test.ts— 136 passed;npm run test:focused -- tests/boundary/mcp/sessionMcp.test.ts— 12 passed;npm run check:fast— passed.Compatibility, safety, and release
psearlier on REA's PATH now gets the systemps(macOS/bin/ps; Linux the first fixed location). A Linux host whose onlypsat a fixed location is busybox now gets a procps refusal instead of using a procpspsfrom PATH; the remedy is installing procps.pscomes first on REA's PATH when a systempsexists. There are no new process, network or file effects.Author readiness
Human owner:
Before merge
type(scope): outcome.