Repository navigation
Omit a null hostId from thread tabs responses so older mobile builds still sync - #2144
Merged
SawyerHood merged 1 commit intoAug 21, 2026
Merged
Conversation
…still sync Installed mobile builds parse the tabs routes with a strict copy of the contract that predates hostId. The server now emits hostId: null, so those builds reject every response and show "Couldn't sync tabs" when a host-file link opens a panel tab. Omit the field when it is null; current clients default it back. Co-Authored-By: Claude <[email protected]>
SawyerHood
deleted the
bb/fix-inaccessible-mobile-images-thr_fs3nw3qdvi
branch
August 21, 2026 04:32
ymichael
added a commit
that referenced
this pull request
Oct 26, 2026
## Human comments ## What was wrong Plugins could only preview a workspace file's working copy: `ExperimentalLiveFileTarget` had no way to name a Git revision. Core already showed deleted changed files at HEAD or the merge base, but through a bespoke path (`head`/`merge-base` sources plus a `"deleted"` status label built in `resolveWorkspaceChangedFileOpenTarget`) that plugins could not use. ## What changed - **Plugin SDK:** the workspace variant of `ExperimentalLiveFileTarget` gains optional `experimental_ref` (`"HEAD"` or a 4–40 character commit SHA, the forms `GET /environments/:id/revisions/:ref/files/*` accepts; anything else makes the target invalid, so links stay inert and navigate calls return `false`). SDK bumped 0.6.85 → 0.6.86. - **Behaviour:** `experimental_openFilePreview` and `experimental_FileLink` with a ref open a read-only preview of the file at that revision, labelled with the ref (e.g. `kept.ts (5cf801c)`). The link menu hides "Open with", because plugin file openers only read the working copy. `experimental_openFileExternally` ignores the ref and opens the working copy. A `Markdown` `experimental_document` target with a ref keeps it on relative links and loads relative images at that revision. - **Core uses the same path:** deleted rows in the Info tab and composer changed-files lists now call `usePanelFiles.openFilePreview` with ref `HEAD` (uncommitted) or the merge-base SHA (committed). The bespoke source/status-label path is deleted. Tab and header labels come from the source ref, so deleted files read `(HEAD)` / `(<sha>)` instead of `(deleted)`. - **No wire, server or daemon changes.** Panel tabs persist a ref in the existing `head`/`merge-base` sources, because shipped mobile builds parse the synced tab schema strictly (see #2144). `statusLabel` stays on the wire and new tabs write `null`. - **Docs:** `docs/api_to_audit.md` entry (Workspace file revisions), Plugin Guide symbol in `plugins/plugin-api-docs/src/surfaces.ts`, and a note in the plugin-authoring `frontend-components.md`. Production code: +111 / −75 (net +36). ## How you verified - `pnpm exec turbo run typecheck lint test --filter=@bb/app --filter=@get-bb/plugin-sdk --filter=@bb/client-core --filter=bb-plugin-plugin-api-docs --filter=bb-plugin-bb-guide`: 20/20 tasks, 0 lint errors. - `@bb/app` 6403 passed, 1 skipped; `@get-bb/plugin-sdk` 402; `@bb/client-core` 287; `plugin-api-docs` 75; `bb-guide` 7. - New tests: - ref validation, accepted (`HEAD`, a SHA) and rejected (`HEAD~1`, `origin/main`, empty, `null`, ref on thread storage); - a ref opens the read-only revision tab on the thread, New thread and plugin-page surfaces; - a ref target still resolves to the working-copy path for external opens; - updated expectations for deleted changed files. - Real run (`pnpm start:worktree`, fixture repo with a deleted `gone.md` and an edited `kept.ts`, clicked in a browser): - Clicking the deleted `gone.md` row in the composer changed-files list opens `gone.md (HEAD)` with the HEAD content. - A local test plugin built against the packed 0.6.86 SDK: - its `experimental_FileLink` with ref `5cf801c` opens `kept.ts (5cf801c)` with that commit's content; - the working-copy link opens the current edit; - `experimental_openFilePreview` with `HEAD` returns `true` and opens `gone.md (HEAD)`; - `experimental_openFileExternally` returns `true`. - Not exercised live: hiding "Open with" (no `.ts` file opener installed), external opening (no local editor targets in headless Chrome), and the Info-tab rows (they share the composer rows' click handler). > AGENT GENERATED Co-authored-by: Michael Yong <review@local> Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Image links in the mobile app failed with a "Couldn't sync tabs" toast. The links and the image routes were fine. A tap opens a
host-file-previewpanel tab, and the app then syncs the tab strip withGET/PUT /threads/:id/tabs. #2005 addedhostIdtohost-file-previewtabs with.default(null), so the server now emitshostId: nullin every tabs response. Installed mobile builds bundle a.strict()copy ofthreadTabsResponseSchemathat predates the field, so their SDK rejects the whole response (Unrecognized key: hostId), the mutation errors, and the tab never settles. Phones cannot update in step with the server, so the server must stay readable by the shipped schema.What changed
apps/server/src/routes/threads/tabs.ts: the GET and PUT responses omithostIdwhen it isnull, onhost-file-previewtabs and onhost-file-previewfile-opener owners of plugin-panel tabs. A non-nullhostIdstill travels. Current clients parse the omission back tonullthrough the schema default.packages/server-contract: addedThreadTabsWireResponse(z.inputof the response schema) and typed both tabs routes with it.No daemon wire change, so no
HOST_DAEMON_PROTOCOL_VERSIONbump.How you verified
apps/server/test/public/public-thread-tabs.test.tsthat fails before the route change (expected … to not have property "hostId") and passes after it.pnpm exec turbo run test --filter=@bb/server -- test/public/public-thread-tabs.test.ts: 3/3 pass.@bb/server-contracttests: 58/58 pass.pnpm exec turbo run typecheckfor@bb/server,@bb/sdk,@bb/app,@bb/mobile,@bb/demo-server: pass.bee.getbb.appserver on a current Metro bundle; storage and host-file image links open the panel tab and the lightbox.Fixes #