Skip to content

feat: allow project creation from non-loopback origins - #81

Merged
SawyerHood merged 4 commits into
mainfrom
remote-project-creation
Jun 10, 2026
Merged

SawyerHood merged 4 commits into
mainfrom
remote-project-creation

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Problem

There is no way to add a new project (or add/update a project source) when the app is opened from anything other than localhost — e.g. via a Tailscale name or from another device. The "Add project" entry point disappears entirely.

Root cause

All path-entry flows gated on the loopback host-daemon probe, which by design only runs on loopback origins (the daemon binds 127.0.0.1 and only sends CORS headers for loopback origins — see 5380f81). That probe supplied both the hostId and the native folder picker. But the daemon is only genuinely required for the native macOS folder picker:

  • the hostId is available from any device via the server's GET /api/v1/hosts (usePrimaryHost)
  • the manual path dialog already exists as the non-macOS fallback
  • POST /api/v1/projects only enforces assertPrimaryHostId — it never needed the browser on localhost

Fix (client-only)

Resolve the picker's host as daemon host → fallback to the connected primary host. When the daemon is unreachable, pickFolder is already null, so the flow naturally falls through to the manual path dialog. Requires status === "connected" so we never create sources against a stale host.

Since remote users are typing a path on a different machine's filesystem, the dialog now names the host: "Enter an absolute path on to the project folder."

  • useLocalPathPicker: host fallback + hostName; extracted usePathPickerHost for the non-picker gating in ProjectActionsMenu
  • ProjectPathDialog: host name in description copy
  • ProjectSettingsView / ProjectActionsMenu: gate add/edit source on the resolved host; path-existence warnings stay daemon-gated (skipped remotely)

Loopback behavior is unchanged: native picker on macOS, manual dialog elsewhere.

Testing

  • New hook tests: daemon-unreachable + connected primary host → available, submits with primary host id; disconnected-only host → unavailable
  • New dialog test for host-named copy
  • turbo run typecheck --filter=@bb/app ✓, turbo run test --filter=@bb/app ✓ (145 files, 1043 tests)

Plan: plans/remote-project-creation.md (also on glyphdown)

🤖 Generated with Claude Code

SawyerHood and others added 4 commits June 10, 2026 11:55
Project creation (and add/update source) was gated on the loopback
host-daemon probe, which only answers on the machine running bb. The
daemon is only genuinely required for the native macOS folder picker;
the hostId is available from any device via the server's /api/v1/hosts.

Fall back to the connected primary host when the daemon is unreachable,
so remote devices get the manual path dialog instead of no entry point
at all. The dialog now names the host the path resolves on, since
remote users are typing a path on a different machine's filesystem.

- useLocalPathPicker: resolve hostId as daemon host ?? connected
  primary host; expose hostName. Extracted usePathPickerHost for the
  non-picker gating in ProjectActionsMenu.
- ProjectPathDialog: name the host in the description copy.
- ProjectSettingsView: gate add/edit source on the resolved host;
  path-existence warnings stay daemon-gated (skipped remotely).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
f183840 changed projectWithThreadsResponseSchema (part of the sdk
app-runtime bundle graph) without regenerating the committed bundle,
breaking the @bb/sdk codegen sync check on CI.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
# Conflicts:
#	packages/sdk/src/app-runtime-browser-bundle.generated.ts
@SawyerHood
SawyerHood merged commit 17d6c10 into main Jun 10, 2026
6 checks passed
@SawyerHood
SawyerHood deleted the remote-project-creation branch June 10, 2026 19:46
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