Repository navigation
Back off Keep Awake reconciles after host worker exits - #1792
Merged
Merged
Conversation
Keep Awake requested an immediate reconcile on every host worker exit, which skipped the retry backoff. A crash-looping worker spun the reconciler every ~80ms and flooded the server log. Worker exits now wait for the exponential retry delay (1s to 30s); configuration and host changes still reconcile immediately. Co-Authored-By: Claude <[email protected]>
ymichael
added a commit
that referenced
this pull request
Aug 18, 2026
## Problem Packaged `bb-app` daemons fail every host plugin call with `host plugin worker exited (1)`. Their stderr reports that neither the compiled worker nor its TypeScript development fallback exists in the installed package. `defaultWorkerEntryPath()` looked for `plugin-host-worker.js` beside `daemon-bundle.mjs` and fell back to the `.ts` source. The published package contained neither: the bundle manifest had no worker target, and the `bb-app` package whitelist only shipped the `.mjs` bundles. The Keep Awake-specific retry mitigation was split out and merged in #1792. This PR now contains only the general packaging fix and its release-level coverage. ## Changes - Add a self-contained `bb-plugin-host-worker.mjs` bundle. - Resolve the packaged `.mjs` worker first while retaining compiled-development and source-development fallbacks. - Ship the worker in `bb-app` and require it during launcher artifact validation. - Assert that the npm package whitelist includes the worker. - Exercise the packed worker directly with the packed Keep Awake host artifact. - Verify worker startup in the full packaged stack and on two independently enrolled packaged daemons. No daemon wire contract changed, so no `HOST_DAEMON_PROTOCOL_VERSION` bump is needed. ## Verification - `turbo run typecheck --filter=@bb/host-daemon --filter=bb-app` - `turbo run test --filter=@bb/host-daemon --filter=bb-app --force` (583 host-daemon tests and 65 bb-app tests) - `turbo run smoke:tarball --filter=bb-app --force` (direct packed worker, full stack, and two-daemon enrollment) - Prettier, JavaScript syntax check, and `git diff --check` > AGENT GENERATED: by GPT-5 --------- 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.
Problem
Keep Awake's
experimental_onWorkerExithandler calledrequestReconcile(), which forces an immediate pass and skips the retry backoff. When a host worker crashes on start (see #1790 for the packaging cause), the server loops every ~80ms:One log file collected 60k+ of these lines.
Change
plugins/keep-awake/server.ts: worker exits now request a retry, which waits for the exponential backoff (1s → 2s → … → 30s cap). Configuration changes and host connects still reconcile immediately.plugins/keep-awake/server.test.ts: fake-timer tests for the delayed retry and the crash-loop backoff. The crash-loop test spins forever on the old code.This is the plugin-side half of #1790, split out so it can land now. The packaging fix (ship
bb-plugin-host-worker.mjs) stays in #1790.Verification
turbo run test typecheck --filter=bb-plugin-keep-awakepasses.🤖 Generated with Claude Code