Skip to content

Retain shared machines while new workspaces prepare - #3569

Merged
ymichael merged 1 commit into
mainfrom
bb/fixer-retain-shared-machines-while-new-workspace-thr_5gp3967adn
Sep 12, 2026
Merged

Retain shared machines while new workspaces prepare#3569
ymichael merged 1 commit into
mainfrom
bb/fixer-retain-shared-machines-while-new-workspace-thr_5gp3967adn

Conversation

@ymichael

@ymichael ymichael commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Automatic shared-machine cleanup counted live thread executions but missed pending and starting threads whose workspace was still being prepared or whose scheduled start had not dispatched. Archiving the previous last owner could therefore remove an ephemeral machine underneath new work already assigned to it. The gap came from b3c5434 (#3274).

What changed

  • Include persisted pending/starting environment intents and preparing workspace ownership in the automatic-removal guard.
  • Use targeted SQLite queries so retention survives database reopening without adding a manager, timer, or schema migration.
  • Recheck that a machine is still available before saving a startup placement and before reserving a provider workspace, so removal winning the race fails cleanly.
  • Preserve cleanup for failed, cancelled, archived, deleted, and orphaned work, as well as existing explicit machine-removal behavior.

No UI, host-daemon wire contract, CLI, public SDK, generated file, or lockfile changes.

How you verified

  • Five new regressions failed before the fix and passed afterward: archive/project deletion during workspace preparation or a scheduled start, plus removal winning admission.
  • 105 relevant tests passed: 99 server tests covering environment providers, machine cleanup, and startup recovery; 6 database tests covering persistence, terminal owners, orphan rows, and reuse.
  • Post-rebase pnpm exec turbo run test build typecheck --filter=@bb/server --filter=@bb/db --force passed all 13 Turbo tasks: 2,606 server tests and the full database suite passed, with one intentional server skip.
  • Isolated HTTP + migrated SQLite verification covered preparation and scheduled-start cleanup through archive and project deletion.
  • Real Modal verification retained a machine through preparing and scheduled work, executed both surviving threads on that same machine, and removed it after the final owner was archived.
  • git diff --check origin/main...HEAD passed, and Git reports a conflict-free merge with current main.

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/fixer-retain-shared-machines-while-new-workspace-thr_5gp3967adn branch from 9010298 to 3868096 Compare September 12, 2026 04:25
@ymichael
ymichael merged commit f0e353d into main Sep 12, 2026
25 of 26 checks passed
@ymichael
ymichael deleted the bb/fixer-retain-shared-machines-while-new-workspace-thr_5gp3967adn branch September 12, 2026 04:45
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