Skip to content

Keep plugin host calls responsive across environment changes - #3557

Merged
ymichael merged 3 commits into
mainfrom
bb/fixer-preserve-running-plugin-calls-when-environ-thr_sgfnrax8n9
Sep 12, 2026
Merged

Keep plugin host calls responsive across environment changes#3557
ymichael merged 3 commits into
mainfrom
bb/fixer-preserve-running-plugin-calls-when-environ-thr_sgfnrax8n9

Conversation

@ymichael

@ymichael ymichael commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

Plugin host calls share a process and its environment. After #3274, a call needing changed machine variables waited for all active calls to finish. That could block a stop/close call behind the long-running work it was meant to stop. Cancelling a waiting call could also trigger the manager's five-second force-kill timer and interrupt unrelated calls in the same worker.

What changed

Remove the environment wait queue. While any calls are active, incoming calls run immediately using the worker's current environment, even if they supply different values. Once all calls finish, the next incoming call supplies fresh values. Values from overlapping calls are not saved as pending updates. Continuous overlapping work can intentionally retain old settings until the worker becomes idle.

The environment is restored when the last active call finishes. Existing cancellation and force-kill protection for unresponsive handlers remain intact. Acquisition stays inside the call's error cleanup.

Bump HOST_DAEMON_PROTOCOL_VERSION from 205 to 206 so enrolled machines update for the changed environment semantics. Document when plugin calls adopt settings in the machine CLI guide, configuration docs, and bb-cli skill reference. No new CLI flags or public SDK members. This PR does not touch UI code.

How you verified

  • Updated real-worker regression coverage for immediate admission with different values, retaining the first values until every overlapping call finishes, adopting the next idle call's values, variable removal, cancellation/deadlines, disposal, and hung-handler termination. Four tests failed with the previous waiting implementation; all 32 plugin host manager tests pass after the change.
  • Post-rebase pnpm exec turbo run test build typecheck --filter=@bb/host-daemon --filter=@bb/host-daemon-contract --force — 617 daemon tests and 56 contract tests passed; all 11 Turbo tasks passed.
  • Actual browser-plugin host handlers running through the real manager, worker process, and IPC, with an injected cooperative runtime: previously close waited behind a two-second run after a variable change; now it interrupts the run and returns in 1 ms with either unchanged or changed values.
  • Verified through the actual built bb CLI, isolated source server, enrolled built daemon, and a diagnostic plugin installed with bb plugin install. Two 20-second calls overlapped across a machine-variable update and retained the old values in one worker PID; stop commands returned in 268 ms and 259 ms; the first idle call adopted the new values and later reflected removal.
  • Targeted formatting and git diff --check origin/main...HEAD passed.

AGENT GENERATED

@ymichael
ymichael force-pushed the bb/fixer-preserve-running-plugin-calls-when-environ-thr_sgfnrax8n9 branch from 44c3b0b to e0a740c Compare September 12, 2026 03:31
@ymichael ymichael changed the title Fix cancellation of plugin host calls waiting for environment values Keep plugin host calls responsive across environment changes Sep 12, 2026
@ymichael
ymichael force-pushed the bb/fixer-preserve-running-plugin-calls-when-environ-thr_sgfnrax8n9 branch from 0dfb654 to 65c3680 Compare September 12, 2026 04:13
@ymichael
ymichael merged commit 8e36a5a into main Sep 12, 2026
25 of 26 checks passed
@ymichael
ymichael deleted the bb/fixer-preserve-running-plugin-calls-when-environ-thr_sgfnrax8n9 branch September 12, 2026 04:28
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