Repository navigation
Description
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:
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 on127.0.0.1:38886, data dir~/.bb. - Source checked out at
e4c873521abbcab1ea3e1aa127b73bb28e7905bb(main). - macOS 14.3, Apple Silicon.
- Local host
host_x83k8uhh5d(persistent, connected). Projectproj_ymedncn5jy(bb-marketplace, local-path source, no environment started). - Two file-opener plugins installed: the built-in
monaco-editor(current SDK, schema hasexperimental_hostId) and an externalmonacoplugin installed from git, whosesourceSchemapredates the field.
Steps to reproduce
-
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();
-
Pick a project whose environment is not running, and open the new-thread composer for it (a draft thread — no
thr_id yet). -
Open any workspace file into the side panel so the plugin opener handles it (e.g.
package.json). -
The tab renders
rpc input validation failed. DevTools showsPOST /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) andplugin-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
503with a distinctnotRunningErrorpayload (routes/plugins.ts#L665-L671). Here the plugin was running and its own schema produced the rejection; the same process answersassets/treenormally. This was the originally reported hypothesis and it is wrong. - Not the built-in
monaco-editoropener. It accepts the field and reads the file successfully on the identical payload (above). The failing request in the report is plugin idmonaco, 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
SawyerHood commentedon Aug 27, 2026
Reproduction & root-cause report: https://get-bb.github.io/reports/issues/2519.html
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).