Repository navigation
fix(setup): detect existing Hopper install on Linux before reinstalling (#2270) - #2995
hussnainahmedd wants to merge 10 commits into
Conversation
Codex Review SummaryThis 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. |
…ng (#2270) Honor HOPPER_LAUNCHER_PATH: when the user explicitly configures a Hopper launcher, setup treats it as the chosen provider and no longer proposes a repair reinstall just because the pinned demo-build digest or the demo runtime probe fails. Repair installs are still proposed for the REA-managed system install at /opt/hopper/bin/Hopper when nothing is configured. Also probe two more standard Linux launcher locations during doctor discovery (/opt/hopper-v4/bin/hopper, /usr/bin/hopper) so existing installs there count as detected instead of triggering an install prompt.
42c4f63 to
d6e3d3e
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fcf53522fa
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| forceHopperInstall: options.installHopper, | ||
| proposeHopper: | ||
| options.proposeHopper ?? (confirm !== undefined && !options.structured), | ||
| hopperLauncherConfigured: initialState.hopperLauncherConfigured, |
There was a problem hiding this comment.
Honor the configured-launcher flag in discovery
When an executable explicitly selected through HOPPER_LAUNCHER_PATH fails the demo-runtime check (or the version check at /opt/hopper/bin/Hopper), this newly forwarded value has no effect: discoverSetupState still does not declare/read it, and linuxHopperRepairNeeded in SetupPlan.ts remains based only on those failed diagnostics. The interactive plan therefore still includes install_hopper, and accepting it reinstalls over the caller-selected Hopper build; add the flag to the discovery input and use it to suppress only the automatic repair path.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
|
|
Noting that #2270 was just closed by the reporter (a fresh terminal session picked up the exported This PR's changes still stand on their own as hardening: a configured, working launcher is treated as satisfied instead of proposing a reinstall, and the doctor probes a couple of extra standard install paths. Happy to keep it open if that's useful, or close it if you'd rather not take the extra behavior — just say the word. |
|
Thanks for the reviews — addressed in a4b25eb: Honor the configured-launcher flag in discovery (Codex) — this one was already covered in the PR head: Setup still replaces existing launchers (greptile) — fixed: the automatic repair reinstall is now restricted to the REA-managed install ( Runtime ignores newly discovered launchers (greptile) — fixed: the ordered Linux launcher candidate list is now shared between doctor discovery and runtime configuration via the new Validation: Also updated the branch — now current with |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45d475dd64
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const system = systemLinuxHopperLauncherCandidates.find((candidate) => | ||
| executable(candidate), | ||
| ); | ||
| if (system !== undefined) return system; |
There was a problem hiding this comment.
Validate new system launchers before preferring them
On Linux hosts where a newly added system path such as /opt/hopper-v4/bin/hopper passes X_OK but is a directory or has unresolved shared libraries, while ~/.local/share/rea/hopper/bin/Hopper is usable, this find selects the bad path and never reaches the user-local fallback. Doctor.ts's executableAvailable instead requires a regular file and a successful ldd, so rea doctor can select the usable fallback while normal runtime configuration feeds Hopper a different, unusable launcher; reuse the same readiness decision for both resolutions rather than treating execute access as readiness.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
Mirror doctor discovery's readiness decision in the default launcher probe: execute access alone is not readiness. Require a regular file and, on Linux, resolvable shared libraries under ldd, so runtime config and rea doctor select the same launcher.
|
Addressed the Codex P2 finding in The default probe now mirrors doctor discovery's readiness decision: |
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 887100a0b4
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| ...systemLinuxHopperLauncherCandidates, | ||
| linuxHopperLauncherPath(host.homeDirectory), |
There was a problem hiding this comment.
Continue discovery past unsupported Hopper builds
When a new system candidate is executable/linkable but has a digest outside the pinned supported set, while the legacy user-local launcher is supported, this ordering makes firstExecutable stop at the unusable system binary before checking the working fallback. Fresh evidence beyond the earlier launcher-validation review is that the final ldd fix still leaves the digest probe in optionalHopperVersionCheck after selection, while scripts/hopper-demo-x11.py rejects unsupported digests and the runtime mirrors this candidate order; make the owning discovery result include full build readiness and continue on failure.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| const linked = execFileSync("ldd", [path], { | ||
| encoding: "utf8", | ||
| stdio: ["ignore", "pipe", "ignore"], | ||
| }); |
There was a problem hiding this comment.
Run linker probes under the selected environment
When createCli, createDirectAnalysis, or MCP run is constructed with a caller-selected environment that differs from ambient process.env, this ldd child inherits the ambient PATH and LD_LIBRARY_PATH because no env is passed. A Hopper candidate can therefore be rejected even though its libraries resolve in the selected environment, or accepted and then fail when Hopper is launched with that selected environment; thread the parsed environment into this probe instead of inheriting ambient state.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| writeFileSync(brokenScript, "#!/bin/sh\nexit 0\n", { mode: 0o755 }); | ||
|
|
||
| const healthyBinary = join(fixtureRoot, "hopper-ok"); | ||
| copyFileSync("/bin/true", healthyBinary); |
There was a problem hiding this comment.
Create Linux fixtures only after the suite is selected
On a Windows test run where /bin/true is absent, Vitest still invokes the factory of a describe.runIf(false) suite during collection so that it can register the skipped tests, and this unconditional copy throws before the suite can be skipped. Guard fixture creation itself or move it into a Linux-only lifecycle hook/test so cross-platform collection and cleanup remain reliable.
AGENTS.md reference: AGENTS.md:L77-L77
Useful? React with 👍 / 👎.
…ler environment Order the Linux Hopper launcher candidates once — REA-managed install, legacy user-local install, then the newly discovered system-wide installs — and use that order in both doctor discovery and runtime configuration, so a working user-local demo is no longer skipped in favor of an arbitrary system build the adapter may reject as an unsupported digest. Thread the caller-selected environment into the ldd readiness probe so discovery and execution agree on linker resolution instead of probing under the ambient process environment. Move the Linux-only probe fixtures into beforeAll: Vitest runs the describe factory during collection even for skipped suites, so the unconditional /bin/true copy threw on platforms without it. Add a regression test proving the linker probe inherits the caller-selected environment.
|
Thanks for the reviews — verified each finding with probe tests:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45927ffc82
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const linked = execFileSync("ldd", [path], { | ||
| encoding: "utf8", | ||
| stdio: ["ignore", "pipe", "ignore"], | ||
| env: environment, | ||
| }); |
There was a problem hiding this comment.
Bound the synchronous linker probe
When a Linux candidate is executable and the ldd selected from the caller's PATH stalls, this execFileSync has no timeout or abort path, so parseConfig blocks the process indefinitely; that path runs during MCP startup and before each direct-analysis command, making those entry points hang. Run the probe with the repository's process supervision and a hard deadline instead of an unbounded synchronous child.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
|
Thanks — fixed in a464677. The I kept the probe synchronous deliberately: Added a regression test with a never-answering fake |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a464677d8a
ℹ️ About Codex in GitHub
Codex has been enabled to automatically 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| if (options.signal?.aborted) | ||
| throw new BrowserObservationError(OPERATION, "cancelled"); | ||
| const launchOptions: Parameters<typeof electron.launch>[0] = { | ||
| application = await this.launch({ |
There was a problem hiding this comment.
Contain rejections from failed Electron launches
When executable_path is runnable but exits before Playwright sees an inspector endpoint (for example /bin/true), this direct launch restores the Playwright behavior in which its internal wait promises reject after the awaited launch has failed. Those orphaned rejections are unhandled and Node terminates the CLI or long-lived MCP server instead of returning the provider error, so keep the scoped rejection containment around this.launch.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| readonly basis: ConcreteMatchBasis; | ||
| readonly key: (item: Keyed<Item>) => string | null; | ||
| }[] = [ | ||
| { basis: exactBasis, key: ({ exactKey }) => exactKey }, |
There was a problem hiding this comment.
Pair managed members by declared identity before remapping
When two declared types contain methods with identical signatures and CIL, this name-free exact round runs before the later signature key that contains type/name. In a self-comparison both sides form a multi-item group and are consumed as ambiguous, while an asymmetric inventory can pair the wrong types, so restore declared-identity rounds before using name-free keys as remaps.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| }), | ||
| options: overviewOptions.extend({ | ||
| integrityPolicy: laneIntegrityPolicy, | ||
| integrityPolicy: javascriptApplicationOptions.shape.integrityPolicy, |
There was a problem hiding this comment.
Reject integrity policies on the binary lane
When rea analyze is given a binary plus an explicit --integrity-policy, this schema accepts/defaults the option but the binary branch forwards {}, so the policy is silently ignored. The documented contract limits the flag to the two JavaScript routes (docs/mcp-contracts.md:611-615); preserve whether it was supplied and reject it on the binary lane rather than reporting analysis without the requested constraint.
AGENTS.md reference: AGENTS.md:L13-L13
Useful? React with 👍 / 👎.
| } | ||
| return installationCheck({ | ||
| name: "native_decompiler", | ||
| passed: path !== null && compatibility?.status !== "incompatible", |
There was a problem hiding this comment.
Validate the decompiler directory selected by the JVM
When host and JDK architectures differ (for example arm64 macOS with an x86_64 JDK under Rosetta), this predicate validates only the decompiler for the host architecture after the JVM os.arch/os.name probe and mismatch checks are removed. Doctor can report healthy although Ghidra selects os/mac_x86_64 and every analysis fails; keep the JVM properties in inspection and fail closed on a mismatch or unknown value.
AGENTS.md reference: AGENTS.md:L21-L21
Useful? React with 👍 / 👎.
The ldd readiness probe in executableAvailable used an unbounded execFileSync, so a stalled PATH-selected ldd could hang parseConfig — which runs during MCP startup and before each direct-analysis command. Give the child a 10s deadline (LDD_PROBE_TIMEOUT_MS) and SIGKILL on expiry: execFileSync throws, and the candidate fails closed like any other probe error. The repository's async process supervision cannot serve the synchronous composition root, so the bound lives on the child itself. Add a regression test with a never-answering fake ldd.
a464677 to
45a68dd
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Synced the branch with upstream What was kept from both sides:
One cleanup note: the previous sync commit had accidentally dropped a large number of unrelated files (CI scripts, docs, tests); I repaired the branch history so the branch now contains exactly this PR's changes on top of current |
Keep layered environment choices, current byte-exact recovery snapshots, and package-manager failure details. Report pinned package drift without claiming runner resolution. Retain failed Linux installer cleanup for host-owned retry while preserving the install outcome. Reviewed fixes include #2632, #2769, #2783, #2959, #2979, #2983, #2995, #3009, and #2559. Validation: 98 focused setup/registration tests passed; 45 Linux installer tests passed. Real Linux package installation remains unverified.
|
Superseded by the delivered change on main: ec56c1da0. Configured Linux Hopper launchers prevent false repair/reinstallation, and standard launcher paths are detected. Closing this earlier proposal. Current main qualification passed: https://github.com/morluto/rea/actions/runs/38690953281. |
|
@hussnainahmedd, thanks for identifying an existing Linux Hopper launcher being treated as a missing installation. Main reuses the discovered launcher. |
Fixes #2270.
Problem
rea setupon Linux proposed (and with--yes --install-hopper, performed) a Hopper reinstall even when the user already had a working Hopper and had explicitly pointed REA at it viaHOPPER_LAUNCHER_PATH.Root cause: in
discoverSetupState(src/application/SetupPlan.ts),linuxHopperRepairNeededwas true whenever thehopper-demo-runtimecheck failed or thehopper-versioncheck failed at/opt/hopper/bin/Hopper. Both checks fail for legitimate existing installs that REA did not install itself:hopper-versiononly accepts the pinned 6.4.2 demo-build SHA-256 digests, so a licensed build or a newer build (e.g. 6.5.0) fails the probe;hopper-demo-runtimefails when the Xvfb private-display dependencies are absent, which is also true for licensed (non-demo) builds.So a functioning, explicitly configured launcher still triggered the
install_hopperplan.Fix (setup/detection code only)
SetupInitialStategainshopperLauncherConfigured, set fromHOPPER_LAUNCHER_PATHinsystemSetupHost.initialSetupState(plumbed throughrunSetupWorkflowintodiscoverSetupState).discoverSetupStateno longer treats a failing version/demo-runtime probe as repair-needed when the launcher was explicitly configured: a configured, functioning launcher is the user's chosen provider and is treated as satisfied.rea doctorstill reports the failing checks with their remediations./opt/hopper/bin/Hopper) when no launcher is configured./opt/hopper-v4/bin/hopperand/usr/bin/hopper, so installs there count as detected instead of prompting an install.No sudo escalation behavior was added (REA deliberately avoids ambient
sudo); the install plan still requires the existing user approval before any mutation.Verification
src/application/Setup.configuration.test.ts(Hopper launcher detection (#2270)): configured launcher + failing demo-runtime check → noinstall_hopperaction, 0 installs; configured launcher + failing version probe → noinstall_hopperaction, 0 installs; unconfigured + failing version probe at/opt/hopper/bin/Hopper→ repairinstall_hopperstill proposed (regression guard).src/application/Doctor.test.ts:/opt/hopper-v4/bin/hopperand/usr/bin/hopperare detected as the Hopper launcher.tsc, executed under plain node with a minimal vitest-compatible harness because this sandbox's rolldown native binding crashes on load, sovitestitself cannot run here):Setup.configuration.test21 passed,Doctor.test30 passed,Setup.planning.test15 passed,Setup.recovery.test12 passed,Setup.initialSnapshot.test1 passed,config.test41 passed,HopperProviderDiscovery.test3 passed,SetupInstallFailure.test2 passed,cliLogging.test6 passed,setupEnvironment.test5 passed — 136 passed, 0 failed.tsc --noEmiton the repo tsconfig: 0 errors in any touched file (38 pre-existing errors elsewhere, all insrc/browser/*playwright typings and one darwin boundary test, present on base and unrelated to this change; they stem from running the older pure-JS TS 5.9 here instead of the repo's pinned native TS 7.0.2).npm run verify:module-boundaries: passed (1758 source files checked).npm run verify:test-discovery: could not execute in this sandbox (it shells out tovitest, which SIGBUS-crashes on the broken rolldown native binding); no new test files were added — tests were added to two existing discovered files, so discovery output is unchanged.oxlinton the 8 touched files: 0 errors, only the 4 warnings that already exist on base.