Skip to content

Add Advisor controls for existing threads - #5

Merged
salemsayed merged 2 commits into
salemsayed:mainfrom
ChrBoebel:feat/per-thread-advisor-switch
Sep 14, 2026
Merged

salemsayed merged 2 commits into
salemsayed:mainfrom
ChrBoebel:feat/per-thread-advisor-switch

Conversation

@ChrBoebel

@ChrBoebel ChrBoebel commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Advisor's global setting cannot exclude a noisy thread or enable one thread while the default is off. This adds an on/off switch to existing-thread composers and bb advisor enable|disable|follow [thread-id] commands. Overrides persist per thread and win in both directions; new threads follow the global setting.

Switching a thread off suppresses automatic reviews, instruction injection, and automatic corrective turns. The tool rechecks the setting when called by an already-running agent session. Automatic continuation also rechecks after a review finishes, so switching off during a review cannot start an unwanted corrective turn. Explicit Review now and Fix in new turn requests continue to work while off.

The UI reports the effective server state, follows realtime and global-setting changes, and prevents overlapping toggle writes. Archiving preserves the override; deleting the thread removes it. The unscoped new-thread setting is retired through an appended migration, preserving migration indices for installations that tried earlier versions of this branch.

Based on the merged SDK compatibility fixes in #3. Generated bundles and the README are updated.

Validation:

  • Node 22.19.0: typecheck, all 107 tests, build, and package dry-run pass.
  • Regression tests cover switching off during a review, both override directions, explicit review/fix requests while off, CLI controls, archive/delete, new-thread defaults, failed and overlapping UI writes, and global-setting updates.
  • Removing the continuation guard makes both off-state regression cases fail; the guard was restored afterward.
  • Live bb 0.43.1: plugin loads, model discovery returns the host catalog, browser switching persists the override, and CLI changes update the visible switch. An actual reviewer completed an explicit review while the primary thread's Advisor setting was off and produced a persisted pass with no incidents.

ChrBoebel and others added 2 commits September 14, 2026 23:37
The global Advisor setting is all-or-nothing: a thread where the reviewer is
noise cannot opt out without turning it off everywhere. This adds a switch
beside the harness selector in the composer, for a thread and for a new thread.

A thread override wins over the global setting in both directions, so the
global value is a default rather than a ceiling. Off means the advisor never
acts on its own in that thread; anything explicitly asked for — "Review now",
waiting for completion — still runs.

Two tables, both appended to the migration list:

  advisor_thread_settings     one row per overridden thread
  advisor_new_thread_default  the choice armed in the new-thread composer

The new-thread composer has no thread id to write against, and plugin settings
are read-only from the plugin, so the choice is stored and materialized in
thread.created. It is single-use: the next user-created thread consumes and
clears it. An earlier sticky variant behaved as a second hidden global that
shadowed the real setting with no way back.

The gate is checked at every entry point that can start a review on the
advisor's own initiative, including inside the tool's execute(): bb does not
hot-mutate a running provider session's tool set, so advisor_review can still
be present after the switch is flipped off, and it must refuse rather than
review. It returns an explicit non-approval so the refusal is not read as a
pass.

Adds 18 tests (101 total), covering both override directions, single-use
arming, other plugins' worker threads not consuming the arm, and the refusal
in an already-running session.
@salemsayed salemsayed changed the title Add a per-thread advisor switch Add Advisor controls for existing threads Sep 14, 2026
@salemsayed
salemsayed force-pushed the feat/per-thread-advisor-switch branch from eebe4a8 to 663abdf Compare September 14, 2026 20:37
@salemsayed
salemsayed merged commit ed611fc into salemsayed:main Sep 14, 2026
1 check passed
@salemsayed

Copy link
Copy Markdown
Owner

Thanks for the per-thread controls contribution. It is now shipped in Advisor v0.1.1. Existing threads have their own switch and CLI override; new threads follow the global default. The release includes the switch-off-during-review guard, and all 108 tests passed.

The live checks also confirmed BB #2384: an existing Codex session cannot gain the newly enabled tool just by stopping/resuming. The README documents the fresh-session requirement and immediate Review now alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants