Skip to content

chore(host-tool): cleanup dead WS path + cross-client drain-path tests#30163

Merged
noanflaherty merged 2 commits into
mainfrom
credence/host-tool-tech-debt-cleanup
May 10, 2026
Merged

chore(host-tool): cleanup dead WS path + cross-client drain-path tests#30163
noanflaherty merged 2 commits into
mainfrom
credence/host-tool-tech-debt-cleanup

Conversation

@credence-the-bot
Copy link
Copy Markdown
Contributor

@credence-the-bot credence-the-bot Bot commented May 10, 2026

What

Two small tech-debt cleanups bundled:

1. Remove dead daemon-side WS resolveResult path

The chrome extension migrated to HTTP POST in PR #29829. Preflight findings:

  • grep -rn "resolveResult" assistant/src/ confirms the only production caller is host-browser-routes.ts:163 (HTTP route). Tests call it directly for simulation.
  • There is no /v1/browser-relay WebSocket endpoint in the current http-server.ts. The WS handler described in the stale NOTE comment does not exist.
  • The mock-chrome-extension fixture has a resultTransport: "ws" option, but since the endpoint doesn't exist, the default "http" transport is used by all tests.

Decision: delete. HostBrowserProxy.resolveResult was public, making it callable from a hypothetical future WS handler without the kind-check + same-actor guard that resolveHostBrowserResultByRequestId enforces. The HTTP route now inlines the pendingInteractions.resolve() + rpcResolve() call directly, and the stale NOTE comment + HostBrowserProxy import are removed from the route file.

2. Cross-client drain-path tests for app-control + computer-use

PR #30154 enabled web/iOS turns to drive host_app_control and host_cu on a connected macOS client. Existing drain-path tests cover macOS-native, chrome-extension, and slack cases. This adds the missing cross-client cases:

  • web source + listClientsByCapability returns 1 macOS client → both app-control and computer-use skills re-added
  • web source + listClientsByCapability returns [] → neither re-added

Uses a per-test mockCapabilityClients variable with afterEach cleanup to prevent state bleed.

Why

(1) Removes the unguarded public API surface — no live WS caller exists, eliminating the foot-gun before someone adds one. (2) Closes the test-coverage gap noted in PR #30154's design doc as deferred.

Out of scope

  • Behavior changes
  • Chrome extension code
  • Other deferred items (target_client_id on skill tools, HOST_BROWSER_INTERFACE_PREFERENCE retirement)

Validation

bun test (56 tests across 3 files, 0 fail) + bun typecheck clean.


Open in Devin Review

credence-the-bot[bot] and others added 2 commits May 10, 2026 01:55
The chrome extension migrated to HTTP POST in PR #29829. There is no
/v1/browser-relay WebSocket endpoint in the current runtime — no WS
handler calls HostBrowserProxy.resolveResult. Removing the public method
eliminates the foot-gun of a future WS handler bypassing the kind-check
and same-actor guard that the HTTP route enforces.

The route now inlines pendingInteractions.resolve() + rpcResolve directly.
Tests are updated to use a local resolveResult helper that mirrors the
same call sequence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
PR #30154 enabled web/iOS turns to drive host_app_control and host_cu on
a connected macOS client (cross-client routing). The existing drain-path
tests cover macOS-native + chrome-extension + slack; this adds the missing
cross-client cases:

- web source + listClientsByCapability returns 1 macOS client → both
  app-control and computer-use skills re-added
- web source + listClientsByCapability returns [] → neither re-added

Introduces a per-test mockCapabilityClients variable (with afterEach reset)
so hub state doesn't bleed across tests.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 4 additional findings.

Open in Devin Review

@credence-the-bot
Copy link
Copy Markdown
Contributor Author

@codex please review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

@credence-the-bot
Copy link
Copy Markdown
Contributor Author

wrap

Both bots gave clean reviews:

  • Devin: ✅ No Issues Found
  • Codex: ✅ Didn't find any major issues. Bravo.

No findings to address. All CI checks green (Lint, Type Check, Test, OpenAPI Spec Check all pass).

Summary of changes:

  • host-browser-proxy.ts: Removed dead resolveResult public method (WS result path that was never wired up post-migration to HTTP POST)
  • host-browser-routes.ts: Removed stale HostBrowserProxy import and WS-path NOTE comment; inlined the pendingInteractions.resolve() call directly
  • host-browser-proxy.test.ts: Replaced proxy.resolveResult() calls with a local resolveResult() helper that calls pendingInteractions directly
  • host-browser-routes.test.ts: Removed the HostBrowserProxy mock block; tests now register interactions with rpcResolve callbacks and assert on pendingInteractions state
  • conversation-process-app-control-preactivation.test.ts: Added 4 cross-client drain-path tests covering web source + macOS client connected/disconnected for both app-control and computer-use re-preactivation

This PR is merge-ready.

@noanflaherty noanflaherty merged commit e0861e9 into main May 10, 2026
13 checks passed
@noanflaherty noanflaherty deleted the credence/host-tool-tech-debt-cleanup branch May 10, 2026 02:40
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