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

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

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 <noreply@anthropic.com>

* fix(hopper): require empty stdout for native launch signatures

* fix(hopper): retain ownership after unverified Spotlight reports

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
Bruno Costa Candia
2026-10-14 06:08:31 +08:00
committed by GitHub
co-authored by Claude Opus 5.5 morluto
parent 6510d0d57f
commit 4d98123279
5 changed files with 104 additions and 9 deletions
@@ -201,13 +201,13 @@ test("recovers a denied Hopper launch through the same stdio MCP session and CLI
).toBe(false);
});
test(
"preserves a timed-out handoff and closes only a late bridge with matching run identity",
test.each(["handoff", "not-found"] as const)(
"preserves an unconfirmed %s handoff and closes only a late bridge with matching run identity",
{ timeout: 60_000 },
async ({ workspace }) => {
async (launchMode, { workspace }) => {
const target = workspace.path("target");
await copyFile("/usr/bin/true", target);
const mode = await workspace.write("mode", "handoff");
const mode = await workspace.write("mode", launchMode);
const receipt = workspace.path("bootstrap-path");
const transport = new StdioClientTransport({
command: process.execPath,
@@ -257,12 +257,24 @@ test(
details: {
diagnostics: {
primary_error: {
code: "provider_timeout",
details: { timeout_ms: 2000, launcher: { exit_code: 0 } },
code:
launchMode === "handoff"
? "provider_timeout"
: "provider_unavailable",
details:
launchMode === "handoff"
? { timeout_ms: 2000, launcher: { exit_code: 0 } }
: { stage: "launch", launcher: { exit_code: 3 } },
},
},
},
});
if (launchMode === "not-found")
expect(initial.error.details).toMatchObject({
diagnostics: {
primary_error: { message: expect.stringContaining("Spotlight") },
},
});
expect(parseMcpToolError(await call("list_procedures"))).toEqual(initial);
const status = z.object({
result: z.object({
+6
View File
@@ -19,6 +19,12 @@ if (mode === "denied" || mode === "denied-after-handoff") {
process.exit(2);
},
);
} else if (mode === "not-found") {
// The native helper's Spotlight lookup fails before any Apple event.
process.stderr.write(
"Hopper has not been found.\nPlease make sure that Spotlight is active in order for this tool to find Hopper's executable.\n",
() => process.exit(3),
);
} else if (mode === "handoff") {
process.exit(0);
} else if (mode === "bridge") {