Skip to content

fix(hopper): recover from a Spotlight not-found launch - #2795

Merged
morluto merged 3 commits into
morluto:mainfrom
bruno-candia:fix/hopper-spotlight-not-found
Oct 13, 2026
Merged

morluto merged 3 commits into
morluto:mainfrom
bruno-candia:fix/hopper-spotlight-not-found

Conversation

@bruno-candia

@bruno-candia bruno-candia commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Hopper's native launcher locates the application through a Spotlight query before sending any Apple event. When Spotlight indexing is disabled for the volume, the launcher exits 3 with Hopper has not been found…. REA treated that external document as unconfirmed, kept the runtime, and every later open_binary failed until the MCP server restarted. Refs #1808: same family (a failed launch leaves the session unusable), but #1808 covers a different exit, so this does not close it. This follows the recovery pattern of #1817 and completes #1105, which made the Spotlight error visible but still retained the runtime.

Problem and expected behavior

  • Trigger: open_binary with Spotlight indexing off (mdutil -s / reports disabled).
  • Violated invariant: a launch that fails before handoff must leave the session reusable.
  • New behavior: REA recognizes the complete not-found report as a pre-handoff failure, confirms that no document exists, and returns a message asking the caller to enable Spotlight indexing (mdutil -i on). A later open_binary in the same session works once Hopper can be found.

Change and scope

  • nativeHopperApplicationWasNotFound in src/hopper/HopperProcessDiagnostic.ts.
  • New branch in HopperClient.#launcherStartupFailure that marks shutdown as confirmed.
  • Not included: locating Hopper without Spotlight.

Ordinary fix within existing boundaries; maintainer scope decision: not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: Hopper launcher diagnostics (src/hopper).

  • Contribution scope fit and linked maintainer decision: bug fix; not applicable.

  • CLI and MCP/tool-catalog contract: no schema change; new error message text for this case.

  • Provider, bridge, target-format, or platform compatibility: macOS Hopper launcher only.

  • Evidence, artifact, provenance, or reconstruction contract: none.

  • Target selection, authority, upstream behavior, and cleanup details: cleanup now completes for this failure, so the runtime is not retained.

  • Generated metadata, package, or installation impact: none.

  • Launch or attach to a process.

Evidence and regression coverage

  • Tests added or updated: unit cases in src/hopper/HopperProcessDiagnostic.test.ts; acceptance test recovers a Spotlight not-found Hopper launch without restarting the MCP session in tests/acceptance/providers/hopperStartupRecovery.test.ts, using a new not-found mode in tests/fixtures/hopperLaunchAdmission.mjs.

  • Base reproduction: with HopperClient.ts and HopperProcessDiagnostic.ts checked out from main, the new acceptance test fails; with the change it passes.

  • Observed on a real machine: with indexing disabled, every open_binary failed until the server restarted; after enabling indexing, Hopper was found.

  • Remaining proof gaps: retains a denial-shaped failure when caller arguments can alter the helper's AppleScript in the same acceptance file fails locally on main as well (ENOENT on loader-target during teardown). It is unrelated to this change, but I could not confirm whether it is specific to my environment.

  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- src/hopper/HopperProcessDiagnostic.test.ts tests/acceptance/providers/hopperStartupRecovery.test.ts — 18 passed, 1 failed (the pre-existing test above)
  • Same command with the source files from main — the new acceptance test fails as well
  • npm run check:fast — typecheck and lint passed
  • npm run verify:hopper (macOS, Hopper Disassembler 6.6.0-demo) — launch and conformance fixtures verified ("verified":7), then the run stops at AssertionError: fixture omitted its real long literal in scripts/lib/real-hopper-search.mjs:127. The same assertion fails on main (d853744) on this host, so it is pre-existing and appears tied to string recognition in the demo build, not to the launcher path changed here.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: macOS with Hopper Disassembler; launcher behavior reproduced with Spotlight off and on.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new process interaction; the change only classifies an existing launcher exit.

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.

🤖 Generated with Claude Code

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-13T18:44:37.062689Z 03f907d 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b8772ae106

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hopper/HopperProcessDiagnostic.ts Resolved
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The current changes appear safe to merge; no new actionable defect was established.

Summary

Adds a complete Spotlight not-found report matcher and a setup message for Hopper launcher failures.

  • Spotlight failures tell Hopper callers how to retry.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Launcher exits] --> B{Complete not-found report?}
  B -->|Yes| C[Return Spotlight setup guidance]
  B -->|No| D[Return other launcher error]
  C --> E[Attempt cleanup]
  E --> F{Document closure confirmed?}
  F -->|No| G[Keep runtime and lease]
  F -->|Yes| H[Remove runtime and release lease]
Loading

Reviews (5) · Last reviewed commit: "fix(hopper): retain ownership after unve..." · Reviewed by Greptile

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f596d0862f

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/hopper/HopperClient.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

The exact stderr signature was accepted without proving stdout was empty, so extra wrapper output could incorrectly establish pre-handoff shutdown. Both native not-found and authorization-denial predicates now share the complete-output condition: output closed, diagnostics untruncated, and stdout text plus observed/retained byte counts all empty. The launcher continues to leave shutdown unconfirmed for other reports. Extended both diagnostic matrices with visible stdout and observed-but-not-retained stdout cases.

Current source: f596d08. Validation: source inspection only; authored regressions were not executed. Tests, checks, builds and provider execution were skipped at the user's explicit request. No passing runtime or real-provider result is claimed. Directly related representation and consumer cleanup is included.

@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: cli CLI adapter and one-shot commands P2: medium Medium priority issue labels Oct 13, 2026
Comment thread src/hopper/HopperClient.ts Resolved
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

The root cause was treating a complete launcher report as proof of native pre-handoff control flow. Launcher diagnostic observation no longer sets shutdownConfirmed. Renamed predicate to report semantics and removed obsolete native-control-flow claim. Complete stderr is actionable Spotlight guidance only. Acceptance coverage now exercises both ordinary unknown handoff and identical not-found report with a late bridge, retaining runtime/lease until matching identity cleanup.

Public source: aa3628c. Validation: source/diff inspection of the producer and affected consumers. Tests and all executable checks were skipped at the user's explicit request. Directly related superseded interpretation was removed; no remaining cleanup for this code finding. No real-provider verification is claimed.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Source fixes and publication evidence for the review findings below. Tests and executable checks were skipped at the maintainer's request. Findings that still require a decision or execution evidence remain open.

review thread

Generic launcher diagnostics were treated as proof that native recovery had not crossed handoff, which could authorize unsafe spotlight recovery. The producer now grants that recovery only from native pre-handoff evidence. Public at aa3628c; no tests/checks ran.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d67ec1847

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +772 to +773
if (hopperLauncherReportedApplicationNotFound(launcherFailure)) {
return new HopperStartError({

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Recover only provenance-verified Spotlight exits

When the configured executable is the real unmodified macOS Hopper helper and its Spotlight lookup fails—the case this change is meant to recover—this branch returns a better error but never sets shutdownConfirmed. The fresh final branch removed confirmation altogether rather than adding the provenance gate requested earlier, so cleanupHopperSession retains the external-application runtime and target lease, subsequent open_binary calls remain blocked, and the updated not-found acceptance row now explicitly expects cleanup_incomplete. Carry verified native-helper provenance from BridgeLauncher and confirm only that variant while continuing to leave custom wrappers unknown.

AGENTS.md reference: AGENTS.md:L19-L21

Useful? React with 👍 / 👎.

bruno-candia and others added 3 commits October 14, 2026 02:40
Hopper's native launcher locates the application through a fixed Spotlight
query before any Apple event. With indexing disabled it exits 3 with a
not-found report, but REA treated the external document as unconfirmed,
retained the runtime and failed every later open_binary until the server
restarted. Recognize the complete report as a pre-handoff failure, confirm
no document exists, and tell the caller to enable Spotlight indexing.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@morluto
morluto force-pushed the fix/hopper-spotlight-not-found branch from 5d67ec1 to 03f907d Compare October 13, 2026 18:40
@morluto
morluto merged commit 4d98123 into morluto:main Oct 13, 2026
3 checks passed
@morluto morluto added the provider: hopper Analysis provider / engine: hopper label Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior bug Something isn't working P2: medium Medium priority issue provider: hopper Analysis provider / engine: hopper

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants