Skip to content

Plugin file openers built before experimental_hostId fail with "rpc input validation failed" when opening a file from a draft thread #2519

Open

Description

@andrewkchan

Human comments

This is showing up as an RPC error when you try to open a file from a draft thread in an inactive project using the monaco file editor:

Image

Summary

Opening a workspace file from the new-thread (draft) composer in a project that has no active environment routes the file by project + host instead of by environment, and bb stamps an extra experimental_hostId key onto the PluginFileOpenerSource it hands the plugin file opener. Any opener plugin built before that field existed — including ones that copied bb's own "re-validate RPC input at the boundary" pattern with a .strict() Zod object — rejects the call, and the file tab renders a bare red rpc input validation failed banner. The same file opens fine from a normal thread, where the source carries an environmentId and no experimental_hostId.

Two things to decide here: (1) whether bb should send a source shape that older openers cannot accept, and (2) whether the frontend should surface something better than the raw boundary message when an opener's contract rejects bb's payload. This is also direct evidence against audit item 7 for this API ("Confirm PluginFileOpenerSource.experimental_hostId can become a stable required hostId field without breaking older opener implementations" — docs/api_to_audit.md#L681-L682): it already breaks them as an optional field.

Versions and environment

  • bb 0.40.1-nightly.32958738584.1 (desktop app), server on 127.0.0.1:38886, data dir ~/.bb.
  • Source checked out at e4c873521abbcab1ea3e1aa127b73bb28e7905bb (main).
  • macOS 14.3, Apple Silicon.
  • Local host host_x83k8uhh5d (persistent, connected). Project proj_ymedncn5jy (bb-marketplace, local-path source, no environment started).
  • Two file-opener plugins installed: the built-in monaco-editor (current SDK, schema has experimental_hostId) and an external monaco plugin installed from git, whose sourceSchema predates the field.

Steps to reproduce

  1. Install any file-opener plugin whose RPC input schema validates the source strictly and predates experimental_hostId — i.e. the shape bb's own plugin ships as the "boundary re-validation" pattern:

    const sourceSchema = z
      .object({
        kind: z.enum(["workspace", "host", "thread-storage"]),
        threadId: z.string().nullable(),
        environmentId: z.string().nullable(),
        projectId: z.string().nullable(),
      })
      .strict();
  2. Pick a project whose environment is not running, and open the new-thread composer for it (a draft thread — no thr_ id yet).

  3. Open any workspace file into the side panel so the plugin opener handles it (e.g. package.json).

  4. The tab renders rpc input validation failed. DevTools shows POST /api/v1/plugins/<id>/rpc/read → 400.

The same open from an existing thread with a live environment works, because the source then carries environmentId and no experimental_hostId.

Equivalent repro without the UI, against a running bb server — same payload, two openers:

$ # current-SDK opener: accepts the field, reads the file
$ curl -s -X POST http://127.0.0.1:38886/api/v1/plugins/monaco-editor/rpc/read \
    -H 'Content-Type: application/json' \
    -d '{"path":"package.json","source":{"kind":"workspace","threadId":null,"environmentId":null,"projectId":"proj_ymedncn5jy","experimental_hostId":"host_x83k8uhh5d"}}'
{"ok":true,"result":{"kind":"text","content":"{\n  \"name\": \"bb-marketplace-registry\", ...

$ # pre-field opener, identical payload: 400
$ curl -s -X POST http://127.0.0.1:38886/api/v1/plugins/monaco/rpc/read \
    -H 'Content-Type: application/json' \
    -d '{"path":"package.json","source":{"kind":"workspace","threadId":null,"environmentId":null,"projectId":"proj_ymedncn5jy","experimental_hostId":"host_x83k8uhh5d"}}'
{"ok":false,"error":{"code":"invalid_input","message":"rpc input validation failed","issues":[{"message":"Unrecognized key: \"experimental_hostId\"","path":["source"]}]}}

Expected vs actual

Actual. 400 invalid_input from the plugin RPC dispatcher, rendered in the file tab as:

rpc input validation failed

and in the console:

Failed to load resource: the server responded with a status of 400 (Bad Request)
:38886/api/v1/plugins/monaco/rpc/read

Expected. Either the file opens (bb sends a source shape the installed opener's contract accepts, or negotiates the field by declared SDK version), or the user sees an actionable message naming the plugin and the incompatibility instead of the raw boundary string.

Evidence

  • bb stamps the field only on the env-less, project-routed workspace source — exactly the draft-thread-in-an-unstarted-project case: file-opener-tabs.ts#L186-L198.
  • The field is optional in the public contract: app-contract.ts#L169-L181.
  • The built-in opener's schema was widened for it, and its comment recommends the strict boundary re-validation that older third-party openers copied: plugins/monaco-editor/server.ts#L41-L55.
  • The 400 comes from the plugin's own contract via the dispatcher, not from a missing plugin process: routes/plugins.ts#L638-L697 (invalid_input → 400) and plugin-service.ts#L585-L593 (rpc input validation failed).
  • Secondary compat point: even if an older opener ignored the unknown key, it still cannot serve this route — dropping the field from the payload above yields {"code":"handler_error","message":"This file has no environment to resolve it against"}, since project+host resolution did not exist when it was written.

What you ruled out

  • Not "the plugin server isn't running." That path returns 503 with a distinct notRunningError payload (routes/plugins.ts#L665-L671). Here the plugin was running and its own schema produced the rejection; the same process answers assets/tree normally. This was the originally reported hypothesis and it is wrong.
  • Not the built-in monaco-editor opener. It accepts the field and reads the file successfully on the identical payload (above). The failing request in the report is plugin id monaco, a separately installed opener.
  • Not a path/permission problem. Same path, same project, same host id succeeds for the current-SDK opener in the same server process.
  • Not a duplicate: the only "rpc input validation failed" hit is bb connect: "Add a machine" always fails — createMachineCode rejects the UI's input (rpc input validation failed) #833 (bb Connect createMachineCode), a different call site and cause.

Suggested priority and effort

Low-to-medium priority, small effort. Hits anyone running a third-party file opener published before the field landed, and only on the draft-thread/unstarted-project route; the workaround is to update the plugin. Nothing is lost. The wider question — whether adding an optional field to PluginFileOpenerSource is a breaking change in practice — is worth resolving before experimental_hostId is stabilized.

AGENT GENERATED

Activity

  1. added
    plugins
    on Aug 27, 2026
  2. added theissue type on Aug 27, 2026
  3. SawyerHood commented on Aug 27, 2026

    @SawyerHood
    Collaborator

    Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2519.html

    • Verdict: REPRODUCED · root-cause confidence: high
    • Root cause (short): BB adds experimental_hostId to every environment-free project source, and old strict opener contracts reject that unknown RPC field.
    • Proposed fix: Add an explicit capability for environment-free project sources. Default it to false, and use the native preview for old openers.
    • Caveats: The exact external plugin source was unavailable. The live app and server test used the strict pre-field schema stated in the issue. The host inode pool blocked a fresh dependency tree, so the revision reused the completed initial-checkout dependencies.

    The report has copy-paste repro steps, screenshots where the bug is visual, code permalinks at the base commit, and repro artifacts. It was independently re-run by a second agent (see its Verification section).

    AGENT GENERATED: by GPT-5.6-Sol

  4. added
    confirmed-repro
    on Aug 27, 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

    confirmed-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions