Skip to content

Keep hard /^cdp/ fallback + content last-resort covered by regression tests #124

Description

@Trace824

Summary

Hard CDP fallback (/^cdp[A-Z]/ → executeCDPToolDirect) in the bridge and the content-script Unknown-tool forwarder are production safety nets for insert_text. They are easy to regress without automated coverage.

Repro

  • Context: Unpacked extension with current bridge + messaging patches; MCP calling CDP verbs by wire name.
  • Steps:
    1. Force resolve to return null (or simulate missing getToolByNameOrVerb).
    2. Dispatch tool name cdpInsertText (or MCP insert_text that wires that verb).
    3. Confirm path hits executeCDPToolDirect / method: cdp_direct rather than Unknown tool.
  • Observed without fallback: hard fail. With fallback (local branch): success.

Code pointers (verified against /workspace/FSB)

  • extension/ws/mcp-bridge-client.js — /^cdp[A-Z]/ fallback (~L1908–1924).
  • extension/content/messaging.js — last-resort CDP forward (~L1062–1088).
  • extension/background.js — executeCDPToolDirect (~L19786+), cdpInsertText (~L20055+).
  • tests/ — add focused unit tests under existing patterns (no dedicated CDP-fallback test found yet; likely area: new test beside bridge/dispatcher tests).

Proposed fix

Add regression tests that (1) bridge routes unresolved cdpInsertText to executeCDPToolDirect, and (2) content messaging forwards /^cdp/ instead of returning Unknown tool. Keep the fallbacks; do not remove them as “dead code.”

Acceptance / regression

  • CI fails if either fallback is deleted or gated behind a broken resolve-only path.
  • Manual: insert_text on x.com compose reports success via CDP path after SW stress.

Owner

extension


Priority: P1 · Owner: extension

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions