Repository navigation
Let a project choose the environment its new threads start in - #6055
Closed
alexandre-vl wants to merge 11 commits into
Closed
alexandre-vl wants to merge 11 commits into
alexandre-vl wants to merge 11 commits into
Conversation
…ry host has no source A project-default thread always resolved on the primary host, so a project whose only source lives on another machine failed with 404 "Project has no local-path source for host". When the primary host has no source of the project, use the persistent machine that holds its default source, or its oldest source on a persistent machine. Projects with a source on the primary host keep today's placement; an offline project machine fails with 502 instead of moving the thread. Fixes get-bb#4446
A project had no default environment. The root composer remembered the last environment per browser, while threads created without one (automations, tasks presets, `bb thread spawn` with no environment flag) always got a worktree on the primary host, so "Project default" matched neither. Store a per-project default environment, set from Project settings, the CLI (`bb project default-environment`) or the API. The composer starts in it; a pick made in the composer lasts for that tab's draft. Threads created without an environment start in it too, a Project checkout default giving each its own worktree on that machine. An unusable default refuses thread creation with 409 and is reported on the project, instead of silently falling back.
The SDK's bundled declarations include the project schemas, which now carry defaultEnvironment and defaultEnvironmentProblem. 0.6.65 is already on npm, so the npm version guard refused to republish it with different types.
alexandre-vl
added a commit
to alexandre-vl/bb
that referenced
this pull request
Oct 21, 2026
alexandre-vl
added a commit
to alexandre-vl/bb
that referenced
this pull request
Oct 21, 2026
get-bb#6055 now ships 0.6.66 with the project default environment types, so the composer props this branch adds need the next version, and the automations plugin that uses them requires it.
Main moved the SDK to 0.6.67 (get-bb#6048, get-bb#6051), so this branch's own type changes need the next version.
alexandre-vl
added a commit
to alexandre-vl/bb
that referenced
this pull request
Oct 21, 2026
get-bb#6055 now carries main and ships 0.6.68, so the composer props this branch adds need 0.6.69, and the automations plugin that uses them requires it.
alexandre-vl
added a commit
to alexandre-vl/bb
that referenced
this pull request
Oct 21, 2026
Tests (plugins) failed in plugins/connect-next/src/frp-e2e.test.ts:394, which this branch does not touch: frpc reported "read: connection reset by peer" where the test only accepts connection refused, EOF or dial. The same code passed on main and on get-bb#6055, and three local runs pass.
Main already carries "Start project-default threads on the project's machine when the primary host has no source" (get-bb#6054) and "Show why an automation failed" (get-bb#6005); the merge keeps their code and adds this branch's project default environment on top. The project default environment entry in docs/api_to_audit.md follows main's new entries.
Main's failed-run story (get-bb#6005) renders AutomationDetailView, which now requires projectDefaultEnvironment.
alexandre-vl
added a commit
to alexandre-vl/bb
that referenced
this pull request
Oct 23, 2026
…nment-composer Pick up get-bb#6055 and get-bb#6056 merged with main, with the plugin SDK at 0.6.75.
# Conflicts: # apps/server/test/public/public-threads.project-default.test.ts # packages/templates/src/templates/bb-guide-threads.md
# Conflicts: # packages/templates/src/templates/bb-guide-threads.md
Contributor
|
This is an automated message. We have closed this pull request because it has been open for more than two weeks. |
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.
Human comments
What was wrong
A project had no default environment that a user could see or set. Three places each decided on their own:
bb.promptbox.environmentin localStorage. Two browsers could disagree.thread-default-policy.ts), whatever the composer showed. That covers automations, Tasks presets andbb thread spawnwith no environment flag.So nobody could send a project's background threads to a laptop or to a sandbox provider such as berth.
Builds on #6054, which starts Automatic threads on the project's machine and is now merged. This branch still contains that commit, so review only
44e31b5.e72c271and the merges ofmain,86a35a4and5c1ae3a, bring inmainand move the SDK version.a22c9f3passesprojectDefaultEnvironmentto the failed-run storymainadded in #6005.What changed
project_default_environmentstable (migration 0147,project-default-environments.ts).CREATE TABLE IF NOT EXISTS, as 0146 does, because the migration tests rewind the ledger and run it again.PATCH /projects/:idacceptsdefaultEnvironment: a provider environment, ornullfor Automatic. Project responses adddefaultEnvironmentanddefaultEnvironmentProblem({reason, message}).project-defaultthread starts in the stored default.project_default_environment_unavailable. The message says how to change or reset the default. There is never a silent fallback. Project responses run the same check, so Settings, the CLI and Automations all show the problem.ProjectDefaultEnvironmentSetting.tsx). It uses the composer'sEnvironmentPickerUI, adds Reset to Automatic, and shows the server's problem.bb project default-environment [show]|set|reset;Default environmentline inbb project show;--base-branchand spawn help.Project default · <environment>or the unavailable state, and routes its model picker to the default's machine. Tasks explains what a project-default preset does.bb guide projects,threads,jsonandenvironments;docs/api_to_audit.md.@get-bb/plugin-sdk0.6.68. The SDK's bundled declarations include the project schemas, which gaindefaultEnvironmentanddefaultEnvironmentProblem.@get-bb/[email protected] is already published, but the package this checkout would publish differs from it.mainhas since moved to 0.6.67 (connect-next 2/5: server tunnel ingress that verifies gate assertions #6048, connect-next 5/5: machine port shares on the next address (host daemon protocol 247) #6051), so this branch mergesmainand takes the next version.HOST_DAEMON_PROTOCOL_VERSIONbump.How you verified
public-projects.default-environment.test.ts, 20 tests on the real server and SQLite. They cover:useThreadCreationOptions,root-compose-environment-selection,PluginNewThreadComposerandProjectDetailSettingsView. The last one covers:project-default-environment.test.ts(17 tests) and 2 inthread-spawn.test.tsfor the CLI. The Automations summary, detail and overview, and the Tasks dialog hint, for the plugins.pnpm exec turbo run typecheck lint test --continueover@bb/server @bb/db @bb/server-contract @bb/sdk @bb/app @bb/cli @bb/templates @bb/demo-server bb-plugin-automations bb-plugin-tasks:@bb/app6254,@bb/cli900,@bb/db632,bb-plugin-tasks409,@bb/sdk124,@bb/server-contract78,@bb/templates46,@bb/demo-server15;@bb/serverpassed 3647 andbb-plugin-automations150, with 5 and 1 failures that were timeouts and timing checks in unrelated suites under full-run load (install script, plugin loading and install jobs, timeline windows, the automations detail recipe). Rerun alone, they passed: 117 and 17.pnpm exec turbo run build --filter=@get-bb/plugin-sdk, I rannode packages/plugin-sdk/scripts/check-npm-version-guard.mjs.44e31b5it failed as CI did:bundled-types/bb-plugin-sdk-app.d.tsandbb-plugin-sdk.d.tsdiffer from the published 0.6.65. Diffing them againstnpm pack @get-bb/[email protected]shows only the newdefaultEnvironmentanddefaultEnvironmentProblemfields.main, at 0.6.74, it printednpm version guard: PASS — @get-bb/[email protected] is not on npm yet. The publish job will ship this version.a22c9f3:pnpm exec turbo run typecheck lintover the 13 packages this PR touches passed (23 tasks);@bb/app6338,@bb/server3694,@bb/cli898,@bb/db633,bb-plugin-tasks410,@get-bb/plugin-sdk398,@bb/domain259,bb-plugin-automations158,@bb/sdk123,@bb/server-contract78,@bb/templates46,@bb/demo-server15,bb-plugin-bb-guide7;@bb/servertest failed on my machine:bb-official-generator.test.tsexpectsgit log --format=%cIto print2026-01-02T03:04:05Z, and git 2.43 prints2026-01-02T03:04:05+00:00. This PR does not touch that test or its script.44e31b5: a freshpnpm devwith one machine (david), project "Shop", headless Chrome.david · Worktreewith Reset, and kept it after a reload.bb project default-environment showandbb project showboth printedDefault environment: Worktree on david.Worktree · Branch from: main. Onmain, it opened onProject checkout.Project default · Worktree on david. Onmain, it readProject default.environment_provider_rejected, as Automatic does today.Before / after
Before:
mainatb143a2286· After:44e31b5. Each side ran on a freshpnpm devwith the same project "Shop" (one machine,david), in headless Chrome at 1280×860, cropped.david, after a reload