Skip to content

Verify is broken on desktop: threads.setVerifyCommand/runVerify are missing from preload (web and dev have them) #622

Closed

Description

@currentbits

coder.threads.setVerifyCommand and coder.threads.runVerify are undefined in the packaged desktop app. The main-process handlers exist, the renderer calls them, the web client has them — the desktop bridge does not.

Proof

Loading the real electron/preload.js against a stubbed electron and inspecting the bridged object:

threads.setVerifyCommand = undefined
threads.runVerify        = undefined
threads.list             = function
threads.rename           = function
total threads methods in preload: 39

electron/preload.js contains no occurrence of the string "verify" at all.

Why it reaches the user

Every other layer has it, so nothing else fails:

layer file present
main handler electron/ipc.js:649,654 yes
web client src/wireClient.ts:442-443 yes
browser-dev fixture src/devCoder.ts:3216,3225 yes
renderer call src/useCoder.ts:2496,2509 yes
UI wiring src/App.tsx:195-196 → AgentsPanel.tsx:1966,2979 yes
desktop bridge electron/preload.js no

resolveCoderApi (src/coderApi.ts) is whole-object, not per-method:

const w = window as unknown as { coder?: CoderApi };
if (w.coder) return w.coder;

In a packaged build window.coder exists, so it is returned and api.threads.setVerifyCommand({...}) throws TypeError: ... is not a function inside the useCallback at useCoder.ts:2494. Setting a verify command or pressing Verify now from the Agents panel fails on desktop.

It works in npm run dev:browser (devCoder), works in web mode (wireClient), and is broken only in the actual product — which is why it has survived since the feature merged in ea1aadd (2026-08-17). Both ipc.js and wireClient.ts were updated in that commit; preload.js was missed.

The test that should have caught it guards one direction only

electron/test/ipc-seam.test.js:2 states its contract:

every channel the preload invokes must have a handler registered

That is preload → handler. It cannot catch a method that is absent from preload, because absent methods invoke nothing. The reverse assertion — every CoderApi method the renderer can call is present on the desktop bridge — does not exist.

The file also hard-codes spot checks ("preload must expose sourceControl.discover", an explicit list of createPr/prStatus/prChecks), which is the same instinct applied one name at a time. Each is added after someone notices a gap; the class stays open.

Fix

  1. Add setVerifyCommand / runVerify to preload.js's threads namespace.
  2. Add the missing direction to ipc-seam.test.js: enumerate the namespace/method pairs implemented in wireClient.ts and assert each exists as a function on the bridged window.coder. The two clients implement the same CoderApi; a method in one and not the other is always a bug. That single assertion replaces every hand-maintained spot-check list in the file.

I ran that comparison as a one-off sweep across the whole surface: these two are the only drift today (every other wireClient method has a desktop binding), so the assertion goes green immediately after step 1 and holds the line afterwards.

Refactor note

The underlying cost is that one channel must be declared in six places — ipc.ts type, ipc.js handler, preload.js, wireClient.ts, devCoder.ts, test/support/fakeCoder.ts. 139 handlers, 137 preload bindings, a 894-line CoderApi interface. A generated bridge (one channel table, preload and wireClient derived from it) would remove this defect class outright rather than testing for it. That is a bigger change than this bug needs — the test in step 2 is the cheap version — but it is the real answer if this recurs.

Tests

  • The seam test's new direction, as above.
  • A renderer test that calls setVerifyCommand through the resolved desktop API and gets a promise rather than a TypeError.

Related

#418 (architecture umbrella — the generated-bridge idea belongs there), #535/#620 (suite hygiene: this is a bug a green suite failed to see).

Activity

  1. currentbits commented on Aug 20, 2026

    @currentbits
    OwnerAuthor

    Fixed by #623. threads.setVerifyCommand / runVerify are in src/shared/ipcChannels.ts, so both thin clients (preload bind and wireClient) expose them. The reverse seam assertion is now table-driven: ipc-seam iterates every table row onto window.coder and every IPC_HANDLERS key back onto the table. A missing preload binding fails that test instead of shipping as TypeError: is not a function.

  2. added
    plan:done
    and removed
    plan:todo
    on Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    plan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions