Repository navigation
Give every persisted retry schedule one owner, an attempt cap and a needs-recovery state - #7725
Merged
ymichael merged 2 commits intoNov 18, 2026
Conversation
ymichael
added a commit
that referenced
this pull request
Nov 17, 2026
…he CLI hint out of the message Review decisions on #7725: an orphaned cloud machine keeps billing, so machine teardown retries once an hour after its five-attempt budget while still showing Needs recovery. The guard declares this one slow-retry case; every other schedule must stop. The machine message drops the bb machine retry-cleanup hint, which the app already offers as a button; Host.lifecycle.teardown.needsRecovery drives the hint in bb machine list instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/class-fix-one-persisted-retry-owner-with-recover-thr_eauehh5fnr
branch
from
November 17, 2026 20:08
63ab879 to
4082272
Compare
ymichael
added a commit
that referenced
this pull request
Nov 17, 2026
…he CLI hint out of the message Review decisions on #7725: an orphaned cloud machine keeps billing, so machine teardown retries once an hour after its five-attempt budget while still showing Needs recovery. The guard declares this one slow-retry case; every other schedule must stop. The machine message drops the bb machine retry-cleanup hint, which the app already offers as a button; Host.lifecycle.teardown.needsRecovery drives the hint in bb machine list instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
added a commit
that referenced
this pull request
Nov 17, 2026
…he CLI hint out of the message Review decisions on #7725: an orphaned cloud machine keeps billing, so machine teardown retries once an hour after its five-attempt budget while still showing Needs recovery. The guard declares this one slow-retry case; every other schedule must stop. The machine message drops the bb machine retry-cleanup hint, which the app already offers as a button; Host.lifecycle.teardown.needsRecovery drives the hint in bb machine list instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/class-fix-one-persisted-retry-owner-with-recover-thr_eauehh5fnr
branch
from
November 17, 2026 20:32
4082272 to
0da727c
Compare
ymichael
added a commit
that referenced
this pull request
Nov 18, 2026
…he CLI hint out of the message Review decisions on #7725: an orphaned cloud machine keeps billing, so machine teardown retries once an hour after its five-attempt budget while still showing Needs recovery. The guard declares this one slow-retry case; every other schedule must stop. The machine message drops the bb machine retry-cleanup hint, which the app already offers as a button; Host.lifecycle.teardown.needsRecovery drives the hint in bb machine list instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/class-fix-one-persisted-retry-owner-with-recover-thr_eauehh5fnr
branch
from
November 18, 2026 00:07
0da727c to
2f4f570
Compare
ymichael
force-pushed
the
bb/class-fix-one-persisted-retry-owner-with-recover-thr_eauehh5fnr
branch
from
November 18, 2026 05:34
2f4f570 to
6354d21
Compare
ymichael
added a commit
that referenced
this pull request
Nov 18, 2026
…he CLI hint out of the message Review decisions on #7725: an orphaned cloud machine keeps billing, so machine teardown retries once an hour after its five-attempt budget while still showing Needs recovery. The guard declares this one slow-retry case; every other schedule must stop. The machine message drops the bb machine retry-cleanup hint, which the app already offers as a button; Host.lifecycle.teardown.needsRecovery drives the hint in bb machine list instead. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…eeds-recovery state Rebased onto origin/main as one commit. The drop of hosts.suspend_retry_at is regenerated as migration 0159, the plugin SDK moves to 0.6.162, and the retry-cleanup guard test expects the 502 machine_teardown_failed answer that #7748 added. The bb-app launcher restart budget (#3340) is left out of this PR. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ironment needsRecovery on machines and environments no longer reads the "Needs recovery:" message prefix. It is true when teardown failed and the attempt count has run past the teardown delays, for both. A machine waiting on an environment whose cleanup needs recovery now records that environment in hosts.teardown_blocked_by_environment_id, exposed as lifecycle.teardown.blockedByEnvironmentId. Such a machine needs recovery too, and bb machine list points at bb environment cleanup <id> --recover instead of bb machine retry-cleanup. Every machine teardown attempt, failure and retry-cleanup clears it. The environment sweep stops re-wrapping an already failed message when retry-cleanup re-arms a stuck environment, which produced "Needs recovery: Needs recovery: ...". Cleanup of a stuck environment rejects with environment_needs_recovery instead of invalid_request, and storage-retention reads that code and the needsRecovery field instead of the message text. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ymichael
force-pushed
the
bb/class-fix-one-persisted-retry-owner-with-recover-thr_eauehh5fnr
branch
from
November 18, 2026 23:20
6354d21 to
929c3a7
Compare
ymichael
deleted the
bb/class-fix-one-persisted-retry-owner-with-recover-thr_eauehh5fnr
branch
November 18, 2026 23:45
ymichael
added a commit
that referenced
this pull request
Nov 30, 2026
…7854) ## Human comments ## What was wrong `bb environment cleanup <id> --recover`, and the storage plugin's automatic recovery, refuse while any same-user process cannot be inspected ([environment-engine.ts#L1145-L1150](https://github.com/get-bb/bb/blob/e6f3032d1898b1404f1facf4baaf75da69e28da3/apps/server/src/services/environments/environment-engine.ts#L1145-L1150)). The Linux scan treats a process as same-user when any of its four UIDs matches. It also counts every `cwd` or `maps` read error as unreadable ([workspace-processes.ts#L53-L98](https://github.com/get-bb/bb/blob/e6f3032d1898b1404f1facf4baaf75da69e28da3/apps/host-daemon/src/workspace-processes.ts#L53-L98)). Every Linux login session has such processes. `systemd --user`, `(sd-pam)`, `sshd-session` and `gpg-agent` are non-dumpable, so their `cwd` cannot be read without privileges. Setuid helpers such as `fusermount3` match through their real UID. On this machine (Fedora, one SSH session) recovery is refused for 6 such processes with nothing in the workspace, so it can never pass (#7435). A second gap in the same scan: a process in another mount namespace, such as a rootless container, reports its `cwd` and mapped files as paths inside that namespace. The scan compared them with the host workspace path, so a container that bind-mounts the workspace was not found. ## What changed `apps/host-daemon/src/workspace-processes.ts`, Linux only: - **Another effective UID:** an unreadable process running under another effective UID counts as another user's process, as on macOS since #7520 (`fusermount3`, a `sudo` process). - **Own mount namespace:** an unreadable process in the daemon's own mount namespace is not a blocker. A process shares the namespace when the ID of its root mount equals the daemon's. Its `mountinfo` is readable even when its `cwd` is not. - **Another mount namespace:** the process is checked through its own `mountinfo`. - Paths are resolved to a filesystem device and a path within that filesystem, then compared with the workspace's location. - A readable process blocks when its `cwd` or a mapped file resolves into the workspace. - An unreadable process blocks when one of its mounts exposes the workspace, a directory inside it, or a parent directory. - **Fallback:** if the daemon's own namespace link or `mountinfo` cannot be read or parsed, the previous rules apply. - `bb-guide-environments.md` describes the Linux rules and the gap below. No wire change: the result shape and its meaning ("processes that may be using the workspace" and "processes that could not be ruled out") are unchanged, so `HOST_DAEMON_PROTOCOL_VERSION` is not bumped. The server is unchanged. **Decision for review: the same-namespace exception.** A non-dumpable program running inside the workspace in the daemon's own mount namespace is not detected. One example is `ssh-agent -D` started from a shell there; the shell that started it is still detected. This is the Linux counterpart of the `sudo` gap accepted for macOS in #7520. Without the exception, recovery cannot pass on any Linux machine with a login session. Not changed: the issue's nested "Needs recovery: Needs recovery: ..." message. On current main I found no path that re-wraps a stored "Needs recovery" message. Every write that moves an exhausted environment out of `failed` needs states that do not occur together, or resets the retry budget first, as `--recover` does. The issue was seen on 0.48.1, before #7725 reworked the teardown retry schedule. Its 46,759-attempt count is also bounded since #7725. ## How you verified - New real-process tests in `apps/host-daemon/src/workspace-processes-linux.test.ts`: - "does not refuse for a non-dumpable process in the daemon's own mount namespace" (`prctl(PR_SET_DUMPABLE, 0)` through python3). **On main:** the PID is in `unreadablePids`. - "finds a process in another mount namespace that works in the workspace through a bind mount" (`unshare -Urm`, `mount --bind`, `cd` into the bind target). **On main:** not found. - "ignores a process in another mount namespace that does not work in the workspace": passes on main and here. - The `unshare` cases skip where unprivileged user namespaces are blocked, which may include GitHub's Ubuntu runners. - New mocked cases in `workspace-processes.test.ts`, both failing on main: - unreadable processes with realistic `mountinfo`: same namespace, a container bind-mounting the workspace, one bind-mounting a parent, one that does not reach it, and an unreadable `mountinfo`; - an unreadable process under another effective UID. - The existing Linux tests are unchanged and pass. `pnpm exec turbo run test --filter=@bb/host-daemon` passes (890 tests). `typecheck lint lint:type-aware` pass for `@bb/host-daemon`, and `@bb/templates` tests pass. - Live on this machine (Fedora 44, xfs, SELinux enforcing, one SSH session), calling the real `inspectWorkspaceProcesses` on a real bb worktree: | Situation | main | This branch | |---|---|---| | Nothing in the workspace | `unreadablePids` with 6 PIDs: systemd, sd-pam, sshd-session, gpg-agent and 2 rootful container processes | `{ pids: [], unreadablePids: [] }` | | A process with its cwd in the workspace | found | found | | Rootless podman container with `-v <workspace>:/app -w /app` | `pids: []` (missed) | container PID in `pids` | | Container without that mount | ignored | ignored | - Not run: the full `tests/qa/scripts/environment-recovery.py` flow, which needs the host-care plugin. Fixes #7435 Fixes #8328 > AGENT GENERATED --------- Co-authored-by: Michael Yong <[email protected]>
scowalt
pushed a commit
to scowalt/bb
that referenced
this pull request
Dec 1, 2026
…et-bb#7854) ## Human comments ## What was wrong `bb environment cleanup <id> --recover`, and the storage plugin's automatic recovery, refuse while any same-user process cannot be inspected ([environment-engine.ts#L1145-L1150](https://github.com/get-bb/bb/blob/c113593252d5bdd55b39718a1cadaa6fa09aaac3/apps/server/src/services/environments/environment-engine.ts#L1145-L1150)). The Linux scan treats a process as same-user when any of its four UIDs matches. It also counts every `cwd` or `maps` read error as unreadable ([workspace-processes.ts#L53-L98](https://github.com/get-bb/bb/blob/c113593252d5bdd55b39718a1cadaa6fa09aaac3/apps/host-daemon/src/workspace-processes.ts#L53-L98)). Every Linux login session has such processes. `systemd --user`, `(sd-pam)`, `sshd-session` and `gpg-agent` are non-dumpable, so their `cwd` cannot be read without privileges. Setuid helpers such as `fusermount3` match through their real UID. On this machine (Fedora, one SSH session) recovery is refused for 6 such processes with nothing in the workspace, so it can never pass (get-bb#7435). A second gap in the same scan: a process in another mount namespace, such as a rootless container, reports its `cwd` and mapped files as paths inside that namespace. The scan compared them with the host workspace path, so a container that bind-mounts the workspace was not found. ## What changed `apps/host-daemon/src/workspace-processes.ts`, Linux only: - **Another effective UID:** an unreadable process running under another effective UID counts as another user's process, as on macOS since get-bb#7520 (`fusermount3`, a `sudo` process). - **Own mount namespace:** an unreadable process in the daemon's own mount namespace is not a blocker. A process shares the namespace when the ID of its root mount equals the daemon's. Its `mountinfo` is readable even when its `cwd` is not. - **Another mount namespace:** the process is checked through its own `mountinfo`. - Paths are resolved to a filesystem device and a path within that filesystem, then compared with the workspace's location. - A readable process blocks when its `cwd` or a mapped file resolves into the workspace. - An unreadable process blocks when one of its mounts exposes the workspace, a directory inside it, or a parent directory. - **Fallback:** if the daemon's own namespace link or `mountinfo` cannot be read or parsed, the previous rules apply. - `bb-guide-environments.md` describes the Linux rules and the gap below. No wire change: the result shape and its meaning ("processes that may be using the workspace" and "processes that could not be ruled out") are unchanged, so `HOST_DAEMON_PROTOCOL_VERSION` is not bumped. The server is unchanged. **Decision for review: the same-namespace exception.** A non-dumpable program running inside the workspace in the daemon's own mount namespace is not detected. One example is `ssh-agent -D` started from a shell there; the shell that started it is still detected. This is the Linux counterpart of the `sudo` gap accepted for macOS in get-bb#7520. Without the exception, recovery cannot pass on any Linux machine with a login session. Not changed: the issue's nested "Needs recovery: Needs recovery: ..." message. On current main I found no path that re-wraps a stored "Needs recovery" message. Every write that moves an exhausted environment out of `failed` needs states that do not occur together, or resets the retry budget first, as `--recover` does. The issue was seen on 0.48.1, before get-bb#7725 reworked the teardown retry schedule. Its 46,759-attempt count is also bounded since get-bb#7725. ## How you verified - New real-process tests in `apps/host-daemon/src/workspace-processes-linux.test.ts`: - "does not refuse for a non-dumpable process in the daemon's own mount namespace" (`prctl(PR_SET_DUMPABLE, 0)` through python3). **On main:** the PID is in `unreadablePids`. - "finds a process in another mount namespace that works in the workspace through a bind mount" (`unshare -Urm`, `mount --bind`, `cd` into the bind target). **On main:** not found. - "ignores a process in another mount namespace that does not work in the workspace": passes on main and here. - The `unshare` cases skip where unprivileged user namespaces are blocked, which may include GitHub's Ubuntu runners. - New mocked cases in `workspace-processes.test.ts`, both failing on main: - unreadable processes with realistic `mountinfo`: same namespace, a container bind-mounting the workspace, one bind-mounting a parent, one that does not reach it, and an unreadable `mountinfo`; - an unreadable process under another effective UID. - The existing Linux tests are unchanged and pass. `pnpm exec turbo run test --filter=@bb/host-daemon` passes (890 tests). `typecheck lint lint:type-aware` pass for `@bb/host-daemon`, and `@bb/templates` tests pass. - Live on this machine (Fedora 44, xfs, SELinux enforcing, one SSH session), calling the real `inspectWorkspaceProcesses` on a real bb worktree: | Situation | main | This branch | |---|---|---| | Nothing in the workspace | `unreadablePids` with 6 PIDs: systemd, sd-pam, sshd-session, gpg-agent and 2 rootful container processes | `{ pids: [], unreadablePids: [] }` | | A process with its cwd in the workspace | found | found | | Rootless podman container with `-v <workspace>:/app -w /app` | `pids: []` (missed) | container PID in `pids` | | Container without that mount | ignored | ignored | - Not run: the full `tests/qa/scripts/environment-recovery.py` flow, which needs the host-care plugin. Fixes get-bb#7435 Fixes get-bb#8328 > AGENT GENERATED --------- Co-authored-by: Michael Yong <[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.
Human comments
What was wrong
Each server-persisted retry schedule wrote its own backoff, and only some of them had an end. Environment teardown got a cap and a "Needs recovery" state in #5961. Machine teardown did not.
removeMachineincrementshosts.teardown_attemptbut never compares it to anything, and every failure re-armsremove_retry_atat +60 s. A machine whose provider removal keeps failing therefore retries every minute forever. This had no issue; I reproduced it live onorigin/main1fa400d (below). The item sweep runner (#7190) persisted a 1 min → 1 h backoff insweep_item_failuresbut had no needs-recovery state: after 5 failures it only logged.hosts.suspend_retry_atwas named like a schedule, but nothing ever retried on it. It only blocked manual suspends for 10 s. Separately,bb-app startrestarted a server that would not start every 1 s with no limit (#3340).What changed
One owner.
nextPersistedRetryAt(delays, attempts, now)in@bb/db(packages/db/src/persisted-retry.ts) books every persisted retry. It returnsnullonceattemptsruns past the delay list; that is the needs-recovery state. Environments and queued messages stop there. Machine teardown and item sweeps declare a slow hourly retry instead (nextSlowPersistedRetryAt), so they stay in needs recovery but a later success is still observed. The delay lists, theNeeds recovery:message and its parser live inapps/server/src/services/lib/persisted-retry.ts. The four schedules use it:environments.retire_at(teardown)teardown_attemptNeeds recovery: …teardown messagebb environment cleanup <id> --recover(unchanged)hosts.remove_retry_at(teardown)teardown_attemptNeeds recovery: <error>.lifecycle message andlifecycle.teardown.needsRecovery: true;bb machine listadds the retry-cleanup hintbb machine retry-cleanup, which now resets the 5-attempt budgetsweep_item_failures.retry_atattemptsneedsRecovery: trueinbb server sweepsand an error log linebb server sweeps retry(new) resets the budget nowqueued_thread_messages.next_attempt_atfailure_countfailed_exhaustedGuard (
apps/server/test/system/persisted-retry-schedules.test.ts):*retry_at/*retire_at/*next_attempt_atcolumn to be registered together with its attempt column.stops: the schedule becomes NULL and nothing runs again 30 days later (environments, queue);slow-retryevery hour (machine teardown, item sweeps): exactly one attempt per interval, never earlier, and still in needs recovery.Copies deleted:
environment-engine.ts:MAX_REMOVE_ATTEMPTS/REMOVE_RETRY_MSand its2 ** (attempt - 1)formula (Bound environment teardown retries and add guarded recovery #5961).item-sweep.ts:sweepRetryDelayMs/REPEATED_FAILURE_ATTEMPTS(Run every periodic sweep job through one item sweep runner #7190).retryDelaysMs[failureCount - 1].Date.now() + 60_000re-arms inprovider-orchestration.ts.hosts.suspend_retry_atand its five writes plus the 10 s gate inlifecycle.ts(migration0158_drop_suspend_retry_atdrops the column).launcher.ts: the fixedMANAGED_PROCESS_RESTART_RETRY_DELAY_MS(three sites) andsuperviseHostDaemonProcess's private backoff. Both now use one restart budget, whose delay comes from the sharedcalculateExponentialBackoffDelayin@bb/domain, the helper plugin services, daemon self-update and the host watchers already use.Machine sweep. Errors that escape
sweepProviderMachinewhile the machine is removing now count one teardown attempt through the owner. In any other phase they go to the item sweep runner. Previously they bumpedteardown_attemptand marked teardownfailedon active or suspended machines too. A machine waiting on an environment that needs recovery now re-checks hourly instead of every 60 s.Launcher (#3340). Server and daemon restarts back off 1 s → 30 s, and 60 s of uptime resets the count. This is the policy
bb-host-daemonalready used. After 8 consecutive server failures,bb-app startstops bb and exits 75, so systemdRestartPreventExitStatus=75can stop restarting it. Host daemon restarts never give up. This deliberately does not include #3339's diagnostic-file retention part of #3340.New surface.
GET /server/sweep-failuresandPOST /server/sweep-failures/retry.experimental_server.sweepFailures()andexperimental_server.retrySweepFailures()(entry indocs/api_to_audit.md).bb server sweeps [--json]andbb server sweeps retry [--json].Host.lifecycle.teardown.needsRecovery(boolean).bb machine listuses it to print<name> (<id>): Needs recovery: <error>. Inspect the machine, then run bb machine retry-cleanup <id>.@get-bb/plugin-sdk0.6.157.Hostfield adds 0.3 KB brotli to the boot payload (418.4 → 418.7 KB on the same build), which fits under main's 419.1 KB limit after Fix main's Checks after #7615: bump the plugin SDK and the boot budget #7730.Review decisions (resolved)
Needs recovery:message, and "Retry cleanup" grants a fresh 5-attempt budget. Environments, sweeps and queued messages still stop at needs recovery.Needs recovery: <error>.The CLI hint appears only inbb machine listoutput, driven by the newneedsRecoveryfield.bb server sweeps, the SDK and an error log line, after 8 attempts (about 2 h). They now keep retrying hourly; see the next section.hosts.suspend_retry_atand its 10 s refusal are dropped.bb-app startexits 75 after 8 consecutive server failures, while daemon restarts back off and never stop.storage-retention'sarchive_cleanup.next_attempt_atretries hourly forever, andworkflows'notification_next_attempt_atretries until delivered or abandoned. The guard only scansbb.db.Second review (follow-ups)
1. Regression: parked sweep items never came back. Reproduced and fixed. On the previous head, an item sweep's eighth failure set
retry_atNULL. Every later pass excluded that item, nothing ever forgot the row, and a success on another path never cleared it, because the runner clears a record only when the runner itself runs the item. So a machine whose resume failed for about 2 h had itsmachine-provider-lifecycleitem parked for good, and a later removal never got its retries. The same applied to every item sweep, for examplequeued-message-auto-send(thread:<id>) andturn-start-deadline. The new testtears a machine down after its lifecycle sweep needed recovery outside removalfailed on that head (removalswas 0).The class-level fix is in the runner. A permanently parked item can never be seen to succeed, so a needs-recovery item now keeps retrying hourly, the same way machines do. It still shows
needsRecovery: true, and the first success deletes the record. This keeps main's old 1 h ceiling and adds the visible state.retry_atis NOT NULL again, so migration 0158 only dropshosts.suspend_retry_at. This revises decision 1 for sweeps. Sweeps no longer stop at needs recovery, because stopping makes recovery unobservable for any item whose cause clears up. I preferred this to clearing parked rows from removal or retry-cleanup, which would fix machines only.2. Other long-lived retries, and why each stays where it is:
bb-applauncher. My restart budget's own2 **formula is gone. It now usescalculateExponentialBackoffDelay, so there is one backoff formula across the launcher, plugin services, daemon self-update and the host watchers.apps/host-daemon/src/protocol-self-update.ts:303-341). Left uncapped on purpose. A daemon whose protocol the server rejects has no other way back, so this belongs with the reconnects you asked me not to cap. It already uses the shared backoff helper, capped at 5 min. The server already shows the state (lastRejectedProtocolVersion, update status in Settings → Updates andbb updates), andbb machine retry-updateis the manual retry. The daemon can't import the server-side owner.apps/server/src/services/threads/restart-resume.ts:34, 186). Not a schedule. It runs once per server restart, and its count is the turn's retry chain (MAX_RESTART_RESUME_ATTEMPT = 4). When it gives up, the interrupted turn stays failed in the timeline, so the user already sees the end state and can send again. Its 5 s delay is boot settling, not backoff.apps/server/src/services/plugins/plugin-runtime.ts:722). Left uncapped on purpose. It supervises in memory like the daemon restarts: 1 s → 60 s, with a reset after 5 min healthy. Many plugin services are themselves connections (tunnels, schedulers), and the plugin already reports a crash during activation as an error. It already uses the shared backoff helper.bb.db), where a missing cap had leaked: Environment teardown retries forever after an interrupted hook, with no recovery path #5960, Run every periodic sweep job through one item sweep runner #7190 and machine teardown. Daemon-side and in-memory loops aren't persisted. They are processes or connections meant to retry for good, and the repo now shares one backoff formula for them. A source-pattern guard (for example on2 **) would check code shapes rather than behavior, so I didn't add one. A new persisted retry column still fails the scan.Issues this root cause produced
environments.retire_at, and #5961's copy is now the shared ownersweep_item_failures.retry_atbb-appstartup failures retried every 1 s foreverbb-appsupervisor retried forever after another server took its portHow you verified
origin/main1fa400d, isolated dev instance, plugin machine provider whoseremovealways fails):teardown_attemptwent 1 → 9 over 8 min. Each timeremove_retry_atwas re-armed about 60 s ahead, with no "Needs recovery" and no server log line. Notes:$BB_THREAD_STORAGE/live-repro-machine-teardown.md.hosts.suspend_retry_at.hosts.remove_retry_atis still re-armed after 40 rounds (expected 3460000 to be null).sweep_item_failures.retry_atis still re-armed (expected 130780000 to be null). Environments and queued messages pass.retry-cleanupresets the budget;bb server sweepslists and retries a parked item), the sweep escalation, and the launcher giving up with exit 75.pnpm exec turbo run test --filter=@bb/server -- test/services/machines test/services/environments/provider-orchestration.test.ts test/environments/environment-lifecycle-orderings.test.ts test/threads/queue-drain-failure.test.ts test/system test/threads/environment-providers.test.ts test/public/public-environments.test.ts: 587 passed.pnpm exec turbo run test --filter=@bb/db: 724 passed.check:query-costspasses.bb-applauncher suites: 92 passed.@bb/cli,@bb/sdk,@bb/server-contract,@bb/domain,@get-bb/plugin-sdkand@bb/templatestests pass.turbo run lint typecheckpasses for the affected packages.pnpm start:worktree, same failing provider). Since then the guard and the retry-cleanup test cover the hourly retry and the hint-free message.removewas called at +0, +63 s, +120 s, +240 s and +480 s.Machine teardown needs recoverywithremoveRetryAt: null.bb machine show --jsonthen showed"message": "Needs recovery: repro: provider remove fails Inspect the machine, then run bb machine retry-cleanup host_….", "teardown": {"status":"failed","attempt":5}. The missing full stop QA spotted is fixed in the last commit.removecall came over the next 4.5 min.bb machine retry-cleanupran one attempt at once (attempt 1, next retry +60 s), and the cycle resumed.bb server sweeps,bb server sweeps --jsonandbb server sweeps retryreturnedNo sweep items are failing.,{"failures": []}andNo sweep items need recovery.Side finding, not fixed here:
bb machine removeprints "Machine … removed" even when the removal failed (apps/cli/src/commands/machine.ts:486).🤖 Generated with Claude Code