Skip to content

fix(extension): reach the Ketch app from hand-installed copies, and upload releases to the Chrome Web Store - #536

Merged
linroid merged 5 commits into
mainfrom
fix/extension-dialog-reachability
Oct 13, 2026
Merged

linroid merged 5 commits into
mainfrom
fix/extension-dialog-reachability

Conversation

@linroid

@linroid linroid commented Oct 13, 2026

Copy link
Copy Markdown
Owner

What

Hand-installed Chrome copies can reach the Ketch app

The GitHub release's Chrome zip was the Chrome Web Store upload, which has no manifest key. Installed by hand with Load unpacked (for example while the store reviews a new version), Chrome gives it an ID derived from its folder. The Ketch app's native messaging host only allows the store ID and the development ID, so Chrome refused the connection, and the extension could never reach the app, however Ketch was running.

  • The Chromium packages are now chrome-store (the store upload, no key) and chrome-unpacked (for Load unpacked).
  • chrome-unpacked carries the store item's public key (STORE_KEY in build.mjs, read from the CRX the store serves), so a hand-installed copy gets the store's ID, flnjeochbgpaipiofdjmoijaeooemhka. Chrome and the app treat it as the store extension itself. src/ keeps the development key, so a development copy can still run next to the store one.

The download dialog says why a device can't be reached

Before After
  • When the selected device can't be reached, a box under the devices gives the reason and what to do, with the hints the popup already uses. A failed send shows its hint too.
  • A browser refusing the native host for this extension ID now reports "Ketch doesn't accept this copy of the extension" (FailureKind.APP_NOT_ALLOWED), pointing to the store and the chrome-unpacked package, instead of the generic "Couldn't reach the Ketch app".

Releases upload to the Chrome Web Store

  • The Extension Release workflow uploads chrome-store.zip with the Chrome Web Store API v2 and submits it for review (store-upload.mjs, no dependencies). It waits while the store processes the upload, and only submits an upload the store accepted with the version the run built.
  • It runs before the GitHub release is created, so a refused upload releases nothing. The next run's number gives the next attempt a newer version, as the store requires.
  • Without the CWS_* secrets the step is skipped with a warning. The store package is always kept as the run's chrome-store artifact for a manual upload.
  • The GitHub release now only attaches what people install by hand: chrome-unpacked, firefox and safari.

Setup needed

Add these repository secrets; the README's Chrome Web Store upload section walks through them:

  • CWS_PUBLISHER_ID
  • CWS_CLIENT_ID
  • CWS_CLIENT_SECRET
  • CWS_REFRESH_TOKEN (OAuth 2.0 Playground, scope chromewebstore)

Until they are set, releases behave as before, except that the store zip is a run artifact rather than a release asset.

Notes for reviewers

  • The store upload is tested against a fake API only. The first real run is its real test: worth running once the secrets are in.
  • The upload request posts the zip as the body of the v2 media.upload endpoint, as the API guide's example does.
  • chrome-unpacked and a store install share an ID, so the README tells people to remove the store version before loading it, and to reinstall from the store afterwards to get updates.

Testing

  • npm test in app/browser-extension: 176 pass. New tests cover the store ID of chrome-unpacked, the refused-ID error, and the upload flow (in-progress polling, refused upload, version mismatch, API and token errors, no credentials in errors).
  • node build.mjs builds the four packages. I checked that the chrome-unpacked manifest's key hashes to flnjeochbgpaipiofdjmoijaeooemhka.

The dialog showed a bare "Not reachable" for a device it couldn't reach, and only the
error message when a send failed. It now shows the reason and what to do, as the popup
does, under the devices and with a failed send. A browser refusing the Ketch app's native
messaging host for this extension ID, as for an unpacked build without the manifest key,
gets its own error instead of "Couldn't reach the Ketch app".
The release's Chrome zip is the Web Store upload, without the manifest key, so a copy
installed by hand with Load unpacked got an id from its folder that the Ketch app's native
messaging host refuses, and could never reach the app. Releases now also carry
`chrome-unpacked`, the same package with the key, which gets the id the app accepts. The
release notes and README say which one to load, and the refused-copy hint points to it.
…unpacked

The store upload was just "chrome", beside chrome-unpacked for Load unpacked; naming it
chrome-store says which one goes to the Chrome Web Store.
…re id

chrome-unpacked carried the development key, so a copy installed by hand was a second
extension beside the store one. It now carries the store item's public key, read from the
CRX the store serves, so Chrome and the Ketch app see it as the store extension itself
(flnjeochbgpaipiofdjmoijaeooemhka). src/ keeps the development key, so a development copy
can still run next to the store one.
…lease

The Extension Release workflow now uploads the chrome-store package with the Chrome Web
Store API v2 and submits it for review (store-upload.mjs, with an OAuth refresh token from
the CWS_* secrets), before creating the GitHub release, so a refused upload releases
nothing. Without the secrets it warns and keeps the package as a run artifact for a manual
upload. The GitHub release now only carries the packages people install by hand:
chrome-unpacked, firefox and safari.
@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-13T11:40:04.169698Z a8a05d4 PR opened
ℹ️ 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.

@claude

claude Bot commented Oct 13, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@linroid
linroid merged commit 4906d98 into main Oct 13, 2026
12 checks passed
@linroid
linroid deleted the fix/extension-dialog-reachability branch October 13, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant