Skip to content

fix(process): run ps from fixed system locations, not REA's PATH - #10755

Merged
morluto merged 4 commits into
mainfrom
fix/system-ps-path
Nov 15, 2026
Merged

morluto merged 4 commits into
mainfrom
fix/system-ps-path

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

Owned process cleanup and process sampling ran ps through REA's own PATH. When that PATH could not find ps (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/ps and /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 (spawnOwnedProviderProcess plus cleanupOwnedProcessGroup), with REA's PATH set to a directory without ps. supervisor.stop() returned status: "incomplete" and the group stayed alive. The same thing happened in #10739's IDA environment test, which stubs REA's PATH. That test had to keep a real PATH as 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 ps at /bin/ps on the sealed system volume. src/hopper/BridgeLauncher.ts already runs /bin/ps this way.

Change and scope

  • src/process/systemPs.ts owns which ps REA runs (resolveSystemPs): /bin/ps on darwin; on Linux the fixed system locations above, then REA's PATH; other platforms keep PATH. It returns the command and its source (system or path).
  • ProcessOwnershipObservation uses it for the process list and the non-Linux, non-darwin environment read. capture/ProcessSampling uses it for its process rows. DesktopBuildDoctorFacts probes the same selected ps.
  • Recording which ps ran: 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 carry ps_command/ps_source diagnostics; non-Linux baseline_unavailable admission 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 bare ps for the PATH fallback); the original error object is preserved, not wrapped.
  • Remediation and doctor text: LINUX_PROCESS_OWNERSHIP_REMEDIATION, the macOS baseline_unavailable recovery 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.
  • createSystemProcessOwnershipHost takes linuxPsLocations so a test can model a Linux host without any fixed ps.
  • The macOS cleanup test (systemPs.test.ts) now registers fixture-group release with onTestFinished before waiting for the descendant (review thread).
  • Not changed: BridgeLauncher's macOS-only /bin/ps literal. 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

  • Semantic owner and earliest changed stage: src/process/systemPs.ts decides which ps runs. Its consumers are ProcessOwnershipObservation (ownership inspection used by admission and cleanup), ProcessSampling (capture sampling) and the desktop-build doctor. No superseded path remains.
  • Contribution scope fit and linked maintainer decision: not applicable (bug fix within existing boundaries).
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: macOS: /bin/ps. Linux: fixed system locations, then PATH. Other POSIX platforms: unchanged.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): Cleanup can now be confirmed on macOS regardless of REA's PATH. Same ps arguments and environment as before.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; 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.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: src/process/systemPs.test.ts covers 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's PATH is /nonexistent-rea-path and requires confirmed cleanup. ownedProcessAvailability.test.ts asserts the refusal's reason and ps_command/ps_source diagnostics. webSourceLocationMcp.test.ts models a missing Linux ps with linuxPsLocations: [] plus an empty PATH, since PATH alone can no longer hide the system ps. sessionMcp.test.ts compares against the remediation constant. processObservationCommandFinalization.test.ts uses freebsd for its PATH fixture ps.
  • Base reproduction or other evidence: With ProcessOwnershipObservation reverted to "ps", the macOS test fails with expected 'incomplete' not to be 'incomplete'. The selection tests fail on the base revision because no resolver exists.
  • User-visible CLI/MCP output (if applicable): Linux refusal text and remediation change as described above.
  • Remaining proof gaps: Linux selection was exercised only through the resolver with an injected executability check and through the forced-linux host 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:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

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 the webSourceLocationMcp update (it failed before that update, as expected).
  • npm run check:fast — passed. npm run docs:check — passed. npx oxfmt --check on changed files — passed. Pre-push hook passed.
  • After the review fix that forwards ps_command/ps_source into 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.
  • macOS arm64 only.

Compatibility, safety, and release

  • Breaking changes or migration steps: none. A user who relied on a different ps earlier on REA's PATH now gets the system ps (macOS /bin/ps; Linux the first fixed location). A Linux host whose only ps at a fixed location is busybox now gets a procps refusal instead of using a procps ps from PATH; the remedy is installing procps.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS arm64 locally; Linux only in CI.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: Process inspection no longer runs whatever ps comes first on REA's PATH when a system ps exists. There are no new process, network or file effects.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T06:39:32.359203Z a9fc897 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge; the previous diagnostic-loss finding is fixed and no new blocking issue was found.

Summary

This PR makes process inspection prefer fixed system locations for ps, shared by ownership checks, process sampling, and the desktop-build doctor.

  • Owned-process checks and capture sampling use fixed ps paths first.
  • Process ownership refusals name the ps they tried.

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
Loading

Reviews (4) · Last reviewed commit: "fix(application): keep which ps ran in p..." · Reviewed by Greptile

Comment thread src/process/systemPs.test.ts Resolved
Comment thread src/process/systemPs.test.ts Resolved
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.
@morluto morluto changed the title fix(process): run macOS ps from /bin/ps, not REA's PATH fix(process): run ps from fixed system locations, not REA's PATH Nov 15, 2026
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@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.
@morluto
morluto merged commit 17a5f14 into main Nov 15, 2026
52 of 54 checks passed
@morluto
morluto deleted the fix/system-ps-path branch November 15, 2026 08:28
morluto added a commit that referenced this pull request Nov 15, 2026
… 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.
morluto added a commit that referenced this pull request Nov 15, 2026
…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.
Davmunrey added a commit to Davmunrey/rea that referenced this pull request Nov 16, 2026
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.
@morluto morluto added area: runtime Process capture and runtime observation bug Something isn't working labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: runtime Process capture and runtime observation bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant