Skip to content

fix(setup): report the failed Hopper request URL and HTTP status - #8526

Merged
kaoru0822-kitauji merged 2 commits into
mainfrom
fix/8503-hopper-download-http-facts
Nov 1, 2026
Merged

kaoru0822-kitauji merged 2 commits into
mainfrom
fix/8503-hopper-download-http-facts

Conversation

@kaoru0822-kitauji

@kaoru0822-kitauji kaoru0822-kitauji commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What broke: Every Hopper download caller (macOS feed and DMG, Linux publisher feed, public key, and launch-time package download) threw away the HTTP status and URL the transport had already observed. HTTP 404 and 503 produced the same generic setup advice.
Fix: The shared downloader now returns a typed failure (url plus http_status/timeout/network/response_too_large/url_refused). Each caller tags it with its request (release_feed, package, public_key), and setup turns it into a structured download field and a remediation that names the URL, outcome and next step.
Risk: Low to moderate. downloadHopperPackage changes from {ok, bytes, httpStatus?} to Result (internal to the application layer). REA's own timeout is now returned as data, while caller cancellation still rejects. Setup codes are unchanged.

Summary

Fixes #8503.

Hopper setup could not tell a missing release apart from a temporary vendor outage, and it never named the request that failed. This PR keeps the transport's observed facts in one failure shape. That shape flows from HopperDownload.ts through both installers and the Linux publisher into the setup result, doctor and Linux launch messages.

Problem and expected behavior

  • Smallest trigger: systemSetupHost(darwinDoctor).installHopper(false) with the feed returning 200 and the DMG returning 404 or 503 → {code: "download_failed", remediation: "REA could not download or unpack the official Hopper package. Check network and filesystem access, then retry setup."} for both statuses. The macOS feed, Linux feed (The official Hopper release feed is unavailable.), public key (The official Hopper public key is unavailable.) and launch-time package download (LinuxHopperPublisher.ts:535) dropped the status in the same way.
  • Violated invariant: transport facts must keep the failed stage, the requested URL and the observed status, and timeouts and network failures must stay distinct when known. This follows docs/tool-design.md "prerequisite failures" and docs/testing.md "Can download failures be diagnosed?".
  • New behavior (macOS DMG 503):
    {
      "status": "failed",
      "code": "download_failed",
      "remediation": "The official Hopper package request to https://www.hopperapp.com:443/downloader/public/Hopper-6.6.1-demo.dmg returned HTTP 503. The vendor service reported a temporary failure; wait, then retry.",
      "download": { "request": "package", "url": "https://www.hopperapp.com:443/downloader/public/Hopper-6.6.1-demo.dmg", "kind": "http_status", "httpStatus": 503 }
    }
    For 404/410 the next step says the file is missing and an immediate retry is unlikely to help.

Change and scope

  • HopperDownload.ts owns the facts. It returns Result<Uint8Array, HopperDownloadFailure>. The failure kinds are http_status (with httpStatus, left out when the response status is not a valid 300–599 integer, which keeps the existing rule), timeout (REA's own deadline), network (Fetch TypeError, with the underlying cause message), response_too_large, and url_refused (invalid_url, non_https, credentials, redirect_without_location, redirect_limit). Caller cancellation still rejects with the caller's reason, so installer and publisher cancellation handling is unchanged. The same module owns the single description and the recovery text.
  • Credentials: request and redirect URLs that carry userinfo are refused before any request (url_refused: credentials). Native Fetch would reject them anyway, and its error message echoes the whole URL. url is the caller's requested URL with userinfo removed by the existing shared sanitizeBrowserUrl, and redirect targets are never reported.
  • Bodies REA won't admit (failed status, size limit, redirects) are released best-effort. A truncated or errored body therefore can't replace a known http_status or response_too_large with network.
  • HopperReleaseError.fromDownload makes the publisher's feed, key and launch-time package errors carry download, with the owned description as their message. That message is what doctor details.message and Linux launch userMessage already show.
  • The macOS and Linux install results carry download. setupInstallFailure(reason, {packageFailure, platform, download}) is the one projection: it replaces the stage's generic advice and adds download. runSetup keeps download on SetupResult, including when a later client or skill failure takes over code.
  • Removed the Linux-only special case operationFailure: "Package download returned HTTP n.", which this PR supersedes.
  • Not included: setup failure codes stay as they are (a key failure still maps to publisher_verification_failed). Doctor details gains no new structured field; its message carries the facts. The Hopper macOS minimum-version planning ([Bug] Hopper macOS setup accepts hosts below the signed app minimum version #8502) is untouched. It will probably edit MacHopper.ts and HopperReleaseFeed.ts as well, but in different functions.

Contribution scope: ordinary fix within existing setup boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/application/HopperDownload.ts (transport). Consumers: MacHopper.ts, LinuxHopper.ts, LinuxHopperPublisher.ts, HopperReleaseFeed.ts (HopperReleaseError), SetupInstallFailure.ts, SetupHost.ts, Setup.ts/SetupTypes.ts. The superseded Linux HTTP-status text path is removed.
  • Contribution scope fit and linked maintainer decision: not applicable (fix within existing setup diagnostics).
  • CLI and MCP/tool-catalog contract: rea setup --format json results gain an optional download field. Remediation text is more specific. No MCP tool or catalog change. Doctor and launch messages for publisher download failures now name the URL and status.
  • Provider, bridge, target-format, or platform compatibility: macOS and Linux Hopper setup only. No change to engine protocols.
  • Evidence, artifact, provenance, or reconstruction contract: not applicable.
  • Target selection, authority, upstream behavior, and cleanup details: no new requests or effects. Response bodies are still cancelled on failure. Cleanup ordering is unchanged.
  • Generated metadata, package, or installation impact: docs/installation.md documents the download field. No generated files.

Expected effects:

  • 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. (Existing Hopper vendor requests only; this PR changes only how their failures are reported.)
  • 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:
    • tests/process-global/hopperDownloadHttpFailure.test.ts: public systemSetupHost(...).installHopper(false) with injected fetch for HTTP 404 and 503 on the macOS feed, macOS DMG, Linux publisher feed, Linux public key (checked before any package manager runs; request order asserted), and Linux package. Also covers a macOS network TypeError, the launch-time LinuxHopperPublisher.inspectLauncher package download, invalid failed-response statuses (status left out rather than misreported), and an unchanged success. Remediation is compared with the owning formatters, while the request, URL, status and recovery class are asserted separately.
    • Review follow-up: a credentialed 302 on the macOS DMG and the Linux feed is handed to native Fetch if requested. The tests assert url_refused: credentials and check that JSON.stringify(result) contains no fixture credentials. Also: a credentialed caller URL is refused without fetch and reported without userinfo, HTTP 503 with an errored body keeps http_status, and a failing cancel at the size limit keeps response_too_large. These five cases fail on the previous PR head, where the secret appeared in detail and remediation.
    • tests/process-global/hopperDownloadRedirect.test.ts: HTTPS-downgrade, redirect-limit and initial non-HTTPS refusals now report url_refused with their reason.
    • tests/boundary/setup/linuxHopperPublisherVerification.test.ts: REA's deadline returns timeout while caller cancellation still rejects with the caller's reason. An oversized chunked body returns response_too_large.
    • MacHopper.test.ts / LinuxHopper.test.ts: feed and package failures are tied to their stage before any mount, package-manager run or cleanup.
    • Setup.configuration.test.ts: runSetup keeps download on the final result and after a later skill failure, and leaves it out when no request facts exist.
  • Base reproduction: with this PR's source changes stashed and the new tests kept, hopperDownloadHttpFailure.test.ts fails 22/22 on base. For example, the macOS DMG 503 case returns the generic download_failed remediation with no download.
  • User-visible CLI/MCP output: see the JSON above (setup structured result). Interactive setup prints the new remediation.
  • Remaining proof gaps: no live vendor outage reproduced, and setup-level timeouts were not exercised end to end (the 10 s/120 s deadlines were checked only at the downloader with a 10 ms budget). The Linux-only signed-package boundary tests (dpkg-deb) were skipped on this macOS host; CI Linux runs them.

Boundary regressions covered: transport-to-result projection for each caller (feed, package, key, launch verification), malformed status input, cancellation versus deadline, and body release on failure. Lifecycle: no lifecycle stage changed. Failures still happen before temporary directory creation, mount or package-manager steps, and existing cleanup suites pass.

  • 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

Local host: macOS arm64, Node 26 (CI uses the pinned Node 24.22.1).

  • npx vitest run on hopperDownloadHttpFailure, hopperDownloadRedirect, MacHopper, LinuxHopper, LinuxHopper.cleanup, HopperReleaseFeed, SetupInstallFailure, Setup.configuration, Setup.recovery, linuxHopperPublisherVerification and Doctor (after the review follow-up): 325 passed, 20 skipped (Linux-only).
  • Broader related run (LinuxHopper.cleanup, LinuxHopperPackageRuntime, HopperReleaseFeed, Setup.recovery/planning/initialSnapshot, Doctor): passed. Three other suites in that run (src/setupEnvironment.test.ts, tests/boundary/filesystem/setupLinuxCleanupOwnership.test.ts, tests/boundary/cli/doctorHopperDiscovery.test.ts) failed, but they need a compiled dist/ runtime. Two of them were re-run on unmodified base and fail the same way there; doctorHopperDiscovery reported "REA's compiled runtime is missing" and was not re-run on base. CI covers all three.
  • npm run check:fast: passed.
  • npm run format:check: passed.
  • tests/conformance/readmeConsistency.test.ts: passed. documentationFacts.test.ts needs the generated docs/public/product-catalog.json, which cannot be generated under local Node 26, so it and npm run docs:check were left to CI.

Compatibility, safety, and release

  • Breaking changes or migration steps: none for CLI or MCP callers. The new download field is optional and setup codes are unchanged. Internally, downloadHopperPackage and the MacHopperInstallHost.download / LinuxHopperInstallHost.download ports now return Result, and setupInstallFailure takes a context object. All in-repo implementations and tests are updated.
  • Real Hopper/Ghidra, browser, or OS coverage: no real Hopper download, install or vendor outage was run. Every failure came from injected fetch responses on macOS; no Linux package manager or Hopper app ran.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: request and redirect URLs that carry credentials are refused before any request. The reported URL is the caller's request with userinfo removed by sanitizeBrowserUrl. Redirect locations are never reported, and no credentials reach detail, remediation or messages (regression-tested).

Author readiness

Human owner: @kaoru0822-kitauji

  • 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.

🤖 Generated with Claude Code

Hopper download callers collapsed every transport failure into a bare
`ok: false`, so HTTP 404 and 503 from the macOS feed and DMG, the Linux
publisher feed, the public key and the launch-time package download produced
identical generic advice without the failed URL.

The shared downloader now returns a typed failure (url plus http_status,
timeout, network, response_too_large or url_refused) and keeps caller
cancellation as a rejection. Installers attribute it to the request
(release_feed, package or public_key); HopperReleaseError carries it, and
setup projects it once into `download` and a remediation naming the URL,
outcome and next step. Replaces the Linux-only "Package download returned
HTTP" special case.

Fixes #8503

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji kaoru0822-kitauji added bug Something isn't working track:bugs Small-bug loop track PRs labels Nov 1, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 1, 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-11-01T14:40:14.184780Z 056a251 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: 67314ba5f1

ℹ️ 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/application/HopperDownload.ts Resolved
@greptile-apps

greptile-apps Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; all previous findings are addressed and no new actionable issue was found.

Summary

Hopper download failures now keep the failed request, URL, and observed outcome through setup and publisher checks.

  • Hopper setup reports which vendor request failed and what happened.
  • Linux publisher errors name the Hopper request that failed.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Hopper request] --> B[Shared downloader]
  B --> C[Typed failure]
  C --> D[Installer or publisher]
  D --> E[Setup download field and advice]
  D --> F[Doctor or launch message]
Loading

Reviews (2) · Last reviewed commit: "fix(setup): refuse credentialed Hopper U..." · Reviewed by Greptile

Comment thread src/application/HopperDownload.ts Resolved
Comment thread src/application/HopperDownload.ts Resolved
Native Fetch rejects a URL with userinfo using a TypeError that echoes the
whole URL, so a credentialed redirect reached `download.detail`, setup
remediation and publisher messages as a network failure. The downloader now
refuses request and redirect URLs carrying credentials as
`url_refused: credentials` before requesting them, and reports the caller URL
through the shared userinfo-removing `sanitizeBrowserUrl`.

Releasing an unadmitted body no longer replaces the outcome it was released
for: an errored (truncated) body after HTTP 503, or a failed cancel at the
size limit, keeps `http_status` or `response_too_large`.

Tests compare delivered remediation with the owning formatters and assert
request, URL, status and recovery class independently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kaoru0822-kitauji
kaoru0822-kitauji merged commit 4b840aa into main Nov 1, 2026
52 of 53 checks passed
@kaoru0822-kitauji
kaoru0822-kitauji deleted the fix/8503-hopper-download-http-facts branch November 1, 2026 16:56
coyoteXujie pushed a commit to coyoteXujie/rea that referenced this pull request Nov 2, 2026
…luto#8526)

* fix(setup): report the failed Hopper request URL and HTTP status

Hopper download callers collapsed every transport failure into a bare
`ok: false`, so HTTP 404 and 503 from the macOS feed and DMG, the Linux
publisher feed, the public key and the launch-time package download produced
identical generic advice without the failed URL.

The shared downloader now returns a typed failure (url plus http_status,
timeout, network, response_too_large or url_refused) and keeps caller
cancellation as a rejection. Installers attribute it to the request
(release_feed, package or public_key); HopperReleaseError carries it, and
setup projects it once into `download` and a remediation naming the URL,
outcome and next step. Replaces the Linux-only "Package download returned
HTTP" special case.

Fixes morluto#8503

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(setup): refuse credentialed Hopper URLs and keep known HTTP outcomes

Native Fetch rejects a URL with userinfo using a TypeError that echoes the
whole URL, so a credentialed redirect reached `download.detail`, setup
remediation and publisher messages as a network failure. The downloader now
refuses request and redirect URLs carrying credentials as
`url_refused: credentials` before requesting them, and reports the caller URL
through the shared userinfo-removing `sanitizeBrowserUrl`.

Releasing an unadmitted body no longer replaces the outcome it was released
for: an errored (truncated) body after HTTP 503, or a failed cancel at the
size limit, keeps `http_status` or `response_too_large`.

Tests compare delivered remediation with the owning formatters and assert
request, URL, status and recovery class independently.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@morluto morluto added area: setup Setup, packaging, upgrade, install, Doctor, and client registration provider: hopper Analysis provider / engine: hopper labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: setup Setup, packaging, upgrade, install, Doctor, and client registration bug Something isn't working provider: hopper Analysis provider / engine: hopper track:bugs Small-bug loop track PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Hopper metadata and macOS download paths discard HTTP status and URL

2 participants