Skip to content

Make the side-chat plugin the only side chat - #957

Merged
SawyerHood merged 9 commits into
mainfrom
bb/remove-old-sidechat-behavior-thr_ivspe5bpxu
Aug 4, 2026
Merged

SawyerHood merged 9 commits into
mainfrom
bb/remove-old-sidechat-behavior-thr_ivspe5bpxu

Conversation

@SawyerHood

@SawyerHood SawyerHood commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

The builtin side-chat plugin becomes the only side chat. It already ships enabled by default, so the sideChatPlugin experiment that gated it is gone — and with it the per-plugin experiment gate itself, since no other plugin used it.

Existing side chats are migrated rather than stranded, which is what lets the legacy origin kind be removed outright.

Migration

0084 hands every origin_kind = 'side-chat' row to the plugin as a hidden fork. Two earlier migrations did the setup work — 0038 backfilled child_origin/parent_thread_id onto origin_kind/source_thread_id, and 0079 hid every side chat — so only two columns move:

UPDATE threads SET origin_kind = 'fork', origin_plugin_id = 'side-chat'
WHERE origin_kind = 'side-chat' AND source_thread_id IS NOT NULL;

An old side chat then reopens in the plugin's panel exactly like a new one. A row with no source thread cannot be reopened at all (the panel needs both ids), so it drops the origin kind instead of stranding a removed value. The two migrations this branch started with are merged into this one.

What is removed

  • Experiment: sideChatPlugin in the domain schema, the side_chat_plugin column, the Settings toggle, the CLI key, onExperimentsChanged, and the gate machinery in the plugin runtime, activation, registration, and service layers.
  • Native side chat: the tab deck and tab content, side-chat-create-request, the per-message and selection "Reply in side chat" actions, the new-tab launcher entry, and the open-side-chat timeline title action. The plugin already registers all of these.
  • The side-chat origin kind, and everything keyed on it: the server archive cascade (the plugin cascades its own forks), the create-time visibility default / title fallback / permission snapshot, the side-chat exclusions for dynamic tools, plugin instructions, the environment-directory tool and approval requests, the legacy readonly permission inheritance, excludeSideChats / excludeOriginKind (redundant with the existing hidden-thread exclusion), the sourceIsSideChat presentation branch, and --origin-kind side-chat.
  • PluginAgentConfigurationContext.sideChat, which would always be false. origin already carries { kind: "fork", pluginId: "side-chat" }, which is what the plugin reads.

Behavior changes worth review

  1. A side chat may now be a parent thread. The old guard rejected side-chat parents. Generalizing it to hidden threads broke plugins that legitimately parent under their own hidden threads (caught by plugin-sdk.test.ts), so the guard is gone; the depth cap still bounds the hierarchy.
  2. Migrated side chats lose the native safety carve-outs — no approval-request rejection, no environment-directory block, no blanket dynamic tools. These never applied to the plugin's forks, so this aligns old rows with how every side chat has behaved since the plugin shipped.
  3. A migrated side chat that recorded the pre-0078 readonly mode normalizes to accept-edits instead of inheriting its source's effective mode — the more restrictive direction.
  4. The plugin's cleanup sweep now covers migrated rows, so a side chat older than 24h that never received a user message gets archived. Recoverable, and the sweep's intent.

Also fixed here

SlopCop flagged the plugin's hourly empty-fork-cleanup as an unbounded scan once the plugin installs by default — it listed every fork thread and narrowed in JavaScript, against the repo's own "don't filter in JS" rule. Added an originPluginId filter end to end (contract, db WHERE, route, SDK); the sweep now queries originKind + originPluginId + archived: false and pages with a fixed limit. The offset advances by the forks each page left behind, since archiving removes rows from the set being paged — a full-page step would skip that many unswept forks. Tested.

Verification

typecheck, test, and lint pass for every touched package and the side-chat plugin. One pre-existing @bb/server failure is local only: internal-skill-trees.test.ts expects file mode 0644 and my umask gives 0664 — it fails identically on main and passes in CI.

🤖 Generated with Claude Code

@SawyerHood

SawyerHood commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am SlopCop. I started the review of PR #957.

I will check security, code quality, performance, architecture, and the end-to-end behavior. I will post an update after each phase.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

End-to-end phase complete.

Result: pass.

I tested the exact pull request SHA in a clean development instance. The message action opened the plugin side chat. The new-tab action also opened it. The experiment page did not show a side-chat gate.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Performance phase complete.

Result: one medium finding.

The default plugin now starts an hourly cleanup task on each install. That task reads all fork threads, including archived forks, and then filters them in JavaScript. Its cost grows with the thread history.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Security phase complete.

Result: no actionable security issue.

The removed experiment controlled a feature. It did not control trust or authority. The server still validates fork requests and permission modes. Strict input checks remain on both side-chat RPC methods.

defaultEnabled: true,
experiment: "sideChatPlugin" as const,
},
{ name: "side-chat", pluginId: "side-chat", defaultEnabled: true },

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — The default plugin now starts an unbounded hourly thread scan

Removing this gate loads the side-chat plugin on each default install. Its hourly empty-fork-cleanup task lists all hidden fork threads. It omits an archived filter and a limit. It then filters the plugin identifier in JavaScript.

Each run reads active and archived forks from the full install history. The cost grows without a bound. Add an originPluginId query filter and archived: false. Use fixed-size pages if the API needs pagination.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Code-quality and architecture phase complete.

Result: two medium cleanup items and several low residue items.

The removed native path left an unused selection sequence field. It also left an unused embedded-chat send-to-main property. I also found stale comments and one inconsistent legacy title contract.

The gate removal does not duplicate another runtime policy. The plugin is now the single side-chat implementation.

The affected type checks passed. The database migration tests passed with 355 tests. The selected application tests passed with 101 tests.

? ({ kind: "open-plugin-side-chat", threadId: sourceThreadId } as const)
: null;
const sourceLink =
sourceThreadId === null || sideChatAction !== null

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Keep the legacy side-chat title model consistent

This function still accepts sourceIsSideChat, but the value no longer affects sourceLink. A legacy side-chat source now receives a normal thread link in the returned title model.

The renderer hides that link with a separate check, so the current screen hides the contract error. Another title consumer can expose the wrong link. Include sourceIsSideChat in this guard, or remove the field from this contract and update the tests.

@@ -137,7 +135,6 @@ export interface ThreadTimelineRowsProps {
/** Add a complete agent message to the composer draft. */
onMessageAddToChat?: ThreadTimelineAddToChatHandler;
/** Open a side chat anchored on a specific agent message. */

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Remove the comments that belonged to deleted props

The next line now documents onSendToMainMessage as both a side-chat opener and a send-to-main action. The selection side-chat comment at lines 146-149 also sits above consumerMessageActions.

Delete both old comment blocks. They now describe properties that this change removed.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Review complete for 40be9f1a5bae5470d679f3e4f4835fdc923950d5.

I found one medium performance issue. The default plugin now starts an unbounded hourly fork-thread scan on each install. Use server-side plugin and archive filters. Use fixed-size pages if the API needs pagination.

I found two medium cleanup items. MessageProseSelection.sourceSeqEnd has no reader. EmbeddedThreadChat.onSendToMainMessage has no supplier after this removal.

I found two low code-quality issues inline. The legacy title model now contains an unused input and a wrong internal link. Two comments now document removed properties.

I found no security issue. The experiment gate did not enforce trust or authority. The server still validates forks, inputs, and permission modes.

I found no duplicate side-chat implementation after this change. The plugin now owns the full side-chat behavior.

The end-to-end test passed on the exact SHA. The message action opened a plugin side chat. The new-tab action opened another side chat. The experiment page had no side-chat gate.

All GitHub checks pass. Three affected package type checks passed. The database suite passed 355 tests. The selected application suite passed 101 tests.

I used a comment review. I did not approve the pull request or request changes.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

Fixed in 3b0c214.

The finding is correct, and it also violated the repo's own "do not load all rows and filter in JavaScript" rule — the sweep was reading every fork thread and narrowing in JS.

Rather than filter after the read, I added an originPluginId filter to the thread list query end to end (contract, db WHERE, route, SDK). The sweep now queries originKind: "fork" + originPluginId + archived: false and pages with a fixed limit, so it reads only this plugin's live forks and its memory stays flat. The archive cascade takes the same filters.

One subtlety worth flagging: archiving removes a row from the archived: false set being paged, so the offset advances by the number of forks each page left behind, not by a full page — a full-page step would skip that many unswept forks. There is a test for that, plus one for the new db filter, and threadListQuerySchema.originPluginId is on the contract optional-field allowlist.

Full typecheck and test pass across the touched packages.

SawyerHood and others added 5 commits August 3, 2026 22:42
The builtin `side-chat` plugin is now the only side chat. It ships enabled
by default, so the `sideChatPlugin` experiment that used to gate it is gone,
and with it the per-plugin experiment gate in the bundled registry and the
plugin runtime — no other plugin used it.

Deleted native surfaces: the side-chat tab deck and tab content, the
message-anchored create request, the per-message "Reply in side chat" action,
the selection-menu action, the new-tab launcher entry, and the `open-side-chat`
timeline title action. The plugin already provides a message action, a
selection action, and a panel launcher for all of them.

Persisted data is kept readable. Threads keep `originKind: "side-chat"`, and
the thread-tabs contract keeps the `side-chat` kind, so old rows still parse.
The app drops those tabs on read — at the stored-state parse boundary and in
the server-tab reconcile — so they disappear from the strip instead of
failing the load.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Now that the plugin is installed by default, its hourly sweep runs on every
install. It listed every fork thread — other plugins' forks and archived rows
included — and narrowed the set in JavaScript, so each run's cost grew with
total thread history.

Add an `originPluginId` filter to the thread list query (contract, db, route,
SDK) and use it, with `archived: false`, so the sweep reads only this plugin's
live forks. Page through the result with a fixed limit.

Archiving removes a row from the `archived: false` set the sweep pages
through, so the offset advances by the number of forks the page left behind
rather than by a full page — advancing by a page would skip that many unswept
forks. The archive cascade takes the same filters.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Removing the native side chat left the "Message from side chat" row inert.
Its name suppressed the normal thread link because the side chat opened as a
panel tab instead, and that tab is gone — so the pill had neither a link nor
an action. Legacy side chats are excluded from the project listings, which
made the thread unreachable except by a hand-typed URL.

Fall back to the thread route link for a legacy side chat, so its name opens
the conversation as a full thread. The plugin's own forks keep suppressing the
link, because their title action opens the plugin panel.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Old side chats were unreachable after the native UI went away: they are
excluded from the project listings, so only the handoff message linked to
them. Migration 0084 now hands every `origin_kind = 'side-chat'` row to the
plugin as a hidden fork, so an old side chat reopens in the plugin's panel
exactly like a new one. A row with no source thread cannot be reopened at
all, so it drops the origin kind instead of stranding a removed value.

With no rows left carrying it, `side-chat` leaves the origin-kind enum, and
everything keyed on it goes:

- the server's archive cascade (the plugin cascades its own forks),
- the create-time visibility default, title fallback, and permission
  snapshot,
- the side-chat exclusions for dynamic tools, plugin instructions, the
  environment-directory tool, and approval requests,
- the legacy readonly permission inheritance,
- `excludeSideChats` / `excludeOriginKind` and the app filters behind them,
  all redundant with the existing hidden-thread exclusion,
- the `sourceIsSideChat` presentation branch,
- `--origin-kind side-chat` in the CLI.

`PluginAgentConfigurationContext.sideChat` goes too: it would always be
false. `origin` already carries `{ kind: "fork", pluginId: "side-chat" }`,
which is what the plugin reads.

Two behavior notes. A side chat may now be a parent thread — the old guard
rejected side-chat parents, and generalizing it to hidden threads broke
plugins that legitimately parent under their own hidden threads, so it is
gone and the depth cap still bounds the hierarchy. A migrated side chat that
recorded the pre-0078 `readonly` mode now normalizes to `accept-edits`
instead of inheriting its source's effective mode, which is the more
restrictive direction.

The two migrations in this branch are merged into 0084.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Rebase fixups: main added parent-notice and ownership tests plus a
visibility-inheritance rewrite of thread creation, all of which named the
removed `side-chat` origin kind.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/remove-old-sidechat-behavior-thr_ivspe5bpxu branch from 89bea9a to fdd0245 Compare August 3, 2026 22:49
@SawyerHood SawyerHood changed the title Remove the native side chat and its experiment gate Make the side-chat plugin the only side chat Aug 3, 2026
@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am the SlopCop. I started the security, code quality, performance, architecture, and end-to-end review phases.

The workspace-wide typecheck reaches every plugin, not just the packages I
filtered: three plugin harnesses built a `sideChat` context and the cascade
example passed `excludeSideChats`.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Security review completed. It found two regressions in the new plugin-owned side-chat identity. Side chats can change their workspace directory. They can also request command, file, network, and permission grants. I will add exact inline comments after final verification.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am SlopCop. I started the review for PR #957.

I will review security, code quality, architecture, performance, and the main user flow. I will post an update after each phase.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Security phase complete.

The review found two policy risks for the plugin-owned side chat:

  • Side chats no longer receive the former server controls for directory changes and approval requests.
  • Source-thread archive completion now depends on an enabled plugin for the side-chat archive cascade.

The focused security checks found no XSS, SQL injection, secret, dependency, URL, or path-injection problem. I will verify these policy findings in the final synthesis.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Performance phase complete.

The net run-time effect is positive. The change removes repeated experiment queries, extra frontend mounts, and several complex filters.

The phase found these problems:

  • The pull request includes a 6.9 MB temporary CLI build with 59,018 generated lines.
  • The hourly cleanup uses offset pages without a full supporting index. This can cause repeated full-table work at large scale.
  • A domain comment names migration 0085, but this pull request adds migration 0084.

The browser test could not start. The approved launcher required writes outside the review sandbox. The focused tests and four package typechecks passed.

Two findings from the SlopCop security phase, both real.

The approval banner only ever rendered in the main thread view, so once the
plugin panel became the only side-chat surface an approval requested there
waited on a prompt nobody could reach. The embedded chat now swaps its
composer for the pending interaction the same way the main view does. A
plugin-owned interaction keeps its own composer, so the draft survives.

Archiving a source thread also stopped cascading to its side chats unless the
plugin was enabled, because the plugin had taken that over. The cascade goes
back to BB and is now structural: a hidden fork has no row of its own to
reach, so it retires with its source whatever plugin created it. The plugin's
duplicate listener is gone.

I tried to restore the old approval and environment-directory guards on a
thread-shape axis first. Both attempts failed: blocking hidden threads breaks
the hidden-delegated-child flow, and blocking hidden non-notifiable threads
breaks hidden forks that keep a parent. Only `originPluginId` separates a side
chat from those, so the guards stay off and the panel renders the prompt
instead.

Also drops a 2.6 MB CLI build directory a stray `git add -A` swept in, and
gitignores the temp root so it cannot recur.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@SawyerHood
SawyerHood force-pushed the bb/remove-old-sidechat-behavior-thr_ivspe5bpxu branch from a1a8a25 to 32a508c Compare August 3, 2026 23:04
@SawyerHood

SawyerHood commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am the SlopCop. I am reviewing this pull request for security, code quality, performance, architecture, and end-to-end behavior.

I will use three parallel BB review threads. I will post a comment after each review phase.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Code quality and architecture phase complete.

The phase confirmed these material problems:

  • A source archive can lose its side-chat cascade when the plugin is disabled, failed, or reloaded.
  • The app still accepts excludeSideChats, but the SDK and cache layers ignore it.
  • Public plugin contracts and the plugin-authoring skill still describe removed side-chat concepts.
  • The pull request includes a temporary generated CLI build.

The cleanup query issue is low priority. The main architecture recommendation is to keep durable lifecycle work in the server.

The phase found one intentional legacy item. The stored thread-tab side-chat kind must remain for old tab data.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

End-to-end phase complete.

I tested pull request head 32a508c in a local development service. I created a main thread and used the message action.

The action opened the Side chat plugin panel. The panel sent a message and received sidechat-ok.

The database created a hidden fork. It set origin_kind = fork, origin_plugin_id = side-chat, and the correct source thread.

I found no end-to-end defect in this path.

});

const { environment, thread } = requireThreadEnvironment(
const { environment } = requireThreadEnvironment(

@SawyerHood SawyerHood Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Side-chat approvals can block with no response control

This change removes the server rejection, so the route registers side-chat approval requests. The plugin uses EmbeddedThreadChat. That surface does not query or show pending interactions. A command or permission request can stop the turn with no Allow or Deny control. Add pending-interaction controls to EmbeddedThreadChat, or keep the rejection until that UI exists.

...childThreads,
...sideChatThreads,
].filter((thread) => thread.id !== args.parentThread.id);
// Side chats cascade through their owning plugin's `thread.archived`

@SawyerHood SawyerHood Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — The side-chat archive cascade is not durable

This code moves a lifecycle guarantee to a fire-and-forget plugin event. The dispatcher finds handlers on the next macrotask. A disabled, failed, or reloaded plugin can miss the event. A handler failure only writes a log. The hidden fork then remains active after its source enters the archive. Keep this cascade in the server lifecycle, or use a durable event queue with retry.

@@ -0,0 +1,11 @@
import { definePluginApp, useComposerView } from "@bb/plugin-sdk/app";

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Remove the temporary CLI build directory

This test-created directory adds 6.9 MB and 59,018 generated lines. It also causes git diff --check failures. Delete the complete .packaged-plugin-build-f8YR4Z directory. Add .packaged-plugin-build-* to an applicable ignore file to prevent another accidental commit.

originPluginId: bb.pluginId,
archived: false,
limit: EMPTY_FORK_SWEEP_PAGE_SIZE,
offset,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — The hourly sweep repeats a full sorted query for each offset page.

This public list path joins pending interactions. It also groups and sorts before it applies the limit and offset.

The database has no index that starts with origin_plugin_id. SQLite uses the archived-status index and scans all active threads.

Each page repeats that work. The offset can also skip one row when a new side chat enters an earlier page.

Please use a dedicated keyset query. Add an index for the plugin, archive state, and cursor fields.

// A hidden fork (a side chat, say) has no row of its own to reach, so it
// retires with its source. Structural rather than plugin-owned: archiving
// must not depend on whichever plugin created the fork still being enabled.
const hiddenSourceThreads = listUnarchivedHiddenSourceThreads(deps.db, {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — The normal archive route does not run this cascade.

This cascade only runs through archiveThreadAndChildren. The normal POST /threads/:id/archive route calls archiveThreadWithLifecycleEffects directly.

The removed plugin listener ran after both archive routes. After this change, a direct normal archive leaves hidden side-chat forks active.

Please move the hidden-source cascade into the common archive path. You can also route both public archive actions through this helper.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Code quality and architecture phase complete.

I found one medium defect. The normal archive route no longer archives hidden side-chat forks.

I also found stale instructions and dead legacy fields. These names include sideChat, excludeSideChats, and senderChildOrigin.

The pull request removes much duplicate native side-chat code. The plugin now owns the side-chat UI and creation policy.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Performance phase complete.

I found one low performance risk. The hourly cleanup uses offset pages through the general thread-list route.

Each page repeats a joined, grouped, and sorted query. The database has no index that starts with origin_plugin_id.

I recommend a dedicated keyset query and a matching index.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

I found three medium problems.

  • Approval requests now reach plugin side chats, but EmbeddedThreadChat has no pending-interaction controls. A turn can stop with no response action.
  • The archive cascade now uses a fire-and-forget plugin event. A plugin stop or reload can leave a hidden fork active.
  • A temporary CLI build adds 6.9 MB and 59,018 generated lines to the pull request.

Please fix these three inline findings before merge.

Non-blocking cleanup remains. Remove the ignored excludeSideChats app field. Update stale plugin contracts and the plugin-authoring skill. Correct migration 0085 to 0084. Review the cleanup query index at larger scale.

The architecture scan recommends two boundaries. Keep durable thread lifecycle work in the server. Derive list filters and cache keys from one shared contract.

All required GitHub checks pass. The focused test suites and four package typechecks also pass. The browser test remains unverified because the approved launcher could not write outside the review sandbox.

This review used a comment only. It did not approve or request changes.

-- needs both ids), and `side-chat` is no longer a valid origin kind. Drop the
-- origin rather than strand an unreadable value; the thread itself is kept.
UPDATE `threads`
SET `origin_kind` = NULL

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Source-less legacy side chats remain hidden after this migration.

Migration 0079 set every legacy side chat to visibility = hidden. This statement clears the origin, but it does not restore visibility.

The result has no source, no plugin owner, and no visible list entry. No panel can reopen it.

Please set visibility = visible when this statement clears the old origin. Please also test the row after migrations 0079 and 0084 run in sequence.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Security phase complete.

I found no direct injection, authorization, rendering, or daemon protocol defect.

The approval and parent-thread policy changes are explicit pull request behavior changes. I did not report them as security defects.

I found one low data migration defect. A source-less legacy side chat keeps hidden visibility after it loses its old origin.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Review complete for head 32a508c0.

Findings:

  • Medium: POST /threads/:id/archive bypasses the new hidden-fork cascade. Direct public API callers can leave side chats active.
  • Low: migration 0084 clears the origin of a source-less side chat but keeps the thread hidden and unreachable.
  • Low: the hourly cleanup repeats a joined, grouped, and sorted thread query for each offset page.

Security review found no direct injection, authorization, unsafe rendering, or daemon protocol defect.

Architecture review found useful duplicate removal. The side-chat plugin now owns the UI and creation policy.

Some stale legacy surfaces remain. The plugin-authoring skill still documents sideChat. The CLI skill still documents the removed experiment.

The app also keeps dead fields and wrappers. Examples include excludeSideChats, senderChildOrigin, and the no-op title fallback wrapper.

Validation:

  • The browser test passed. The plugin panel opened, sent a reply, and created the correct hidden fork.
  • Targeted type checks passed for six affected packages.
  • Plugin SDK tests passed: 74 tests.
  • Side-chat plugin tests passed: 26 tests.
  • Database tests passed: 357 tests.
  • Tasks plugin tests passed: 327 tests.
  • Server tests passed 1,315 of 1,316 tests.
  • The one server failure is in an unchanged machine-install path. The same test failed again alone.
  • The broad app test run stopped after the server failure.

I posted three inline comments for the confirmed defects.

Four findings, all real.

Archiving a single thread stopped cascading to its hidden forks. Only
archive-all kept the cascade when I moved it off the plugin's `thread.archived`
listener, and that listener had covered both routes. The plain route now
archives the forks that retire with their source.

A legacy side chat with no source thread lost its origin but kept hidden
visibility, leaving an unreachable orphan. The migration makes it visible: it
is nobody's fork now, so its own row is the only way back to it.

The sweep's new query filters on `origin_plugin_id` with no index to serve it,
so 0084 adds one. `CREATE INDEX IF NOT EXISTS` because the migrate suite
replays the chain, and the rewind helper drops the index before the column it
covers — SQLite will not drop an indexed column.

`senderChildOrigin` was still threaded through the conversation row but never
read after the legacy branch went away, and `excludeSideChats` lingered in the
app's query types. Both are gone.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

I am the SlopCop. I started the security, code quality, performance, architecture, and end-to-end review for commit 32a508c.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

End-to-end phase complete for 32a508c.

I started the exact target commit with a new data directory. I created a root thread and opened a side chat from an assistant message. The quoted message appeared in the panel. The side chat returned side-ok. The Send to main thread action added that response to the main timeline.

Result: pass. I found no end-to-end defect in this flow.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Performance phase complete for 32a508c.

I found two medium findings in the hourly side-chat sweep:

  • The new origin_plugin_id filter has no matching index. Each page scans and sorts the live-thread set.
  • The sweep reads the full timeline and queued messages for every old live side chat. A side chat with user work remains in this repeated hourly set.

The current pull request tip already adds the missing index. The repeated timeline work still needs review against the target commit.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Security phase complete for 32a508c.

I reviewed thread ownership, plugin attribution, workspace changes, archive behavior, request validation, and data access. I found no clear security exploit. Plugins already run as full-trust code, so plugin ID impersonation does not create a new trust boundary.

The change lets a side chat use the standard environment-directory tool. This increases its authority, but it matches the authority of its source thread. I will record it as a design note, not a security defect.

@SawyerHood

Copy link
Copy Markdown
Collaborator Author

🚨 SLOP COP 🚨 · review

Code quality and architecture phase complete for 32a508c.

I found these actionable problems:

  • The single-thread archive route no longer archives hidden side chats. Only archive-all uses the new cascade.
  • Migration 0084 leaves a legacy side chat hidden when its source thread is absent. No normal list can show that thread.
  • The app still declares the removed excludeSideChats filter.
  • The CLI guide, the built-in CLI skill, and plugin documentation still describe removed side-chat fields and the removed experiment.
  • Several parameters and comments remain after the old side-chat path was removed.

The architecture now has one clear side-chat owner. The remaining duplicate concepts are stale contracts and documentation, not a second implementation.

createdAt: number,
): Promise<boolean> {
try {
const timeline = await bb.sdk.threads.timeline({

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Avoid a complete timeline read for every old live side chat

A side chat with a user message returns false and stays in this hourly candidate set forever. Each sweep reads its complete nested timeline and then reads its queued messages. The work grows with all retained side chats, not only empty chats. Record the nonempty result, or request the smallest timeline page that can prove user work exists.

) {
throw new Error("--origin-kind must be fork or side-chat.");
if (opts.originKind !== undefined && opts.originKind !== "fork") {
throw new Error("--origin-kind must be fork.");

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 slopcop/review — Update the discoverable CLI and plugin documentation

+This command now rejects side-chat, but bb-guide-threads.md still says --origin-kind accepts side-chat. The built-in bb-cli skill also says the removed experiment controls the plugin. docs/plugin-sidebar-thread-list.md still lists "side-chat" in originKind. These surfaces will direct users and agents to an invalid command. Update them in this change, as required by docs/cli-guide-and-skill.md.

@SawyerHood SawyerHood left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚨 SLOP COP 🚨 · review

Review complete for requested commit 32a508c.

The pull request now points to b655f17. That tip corrects four findings from the requested commit:

  • The single-thread archive route now archives hidden source forks.
  • Migration 0084 now makes source-less legacy side chats visible.
  • The sweep now has an origin_plugin_id and archived_at index.
  • The app no longer accepts the removed excludeSideChats filter.

Two actionable findings remain at the current tip:

  1. Medium: The hourly sweep reads each old side chat's complete nested timeline. Nonempty side chats return to this candidate set every hour.
  2. Medium: The CLI guide and built-in skill still describe the removed side-chat value and experiment. Plugin documentation also retains the old origin kind.

Several dead parameters and stale comments remain after removal of the native path. These items are low-risk cleanup work.

Security review found no clear exploit. The architecture now has one side-chat owner, with stale contracts limited to documentation and cleanup items.

Validation results:

  • All four affected package typechecks passed.
  • The side-chat plugin passed 26 tests. The database passed 357 tests.
  • The server passed 1,315 of 1,316 tests. One unrelated machine-install test failed twice after its host daemon exited during enrollment.
  • The exact target commit passed the browser flow. A side chat opened, returned a response, and sent that response to the main thread.

I left this as a comment review. I did not approve the pull request or request changes.

Two remaining findings from the SlopCop review.

The hourly sweep read the full timeline and queued messages of every live side
chat older than a day, every hour, forever — including the ones a user had
actually replied in, which can never become empty. That work grew with the
thread history and never paid off. A fork found to hold user work is now
recorded in plugin KV and skipped on later sweeps. A read failure records
nothing, so a bad hour does not retire a fork from the sweep. Keys whose fork
no longer appears in the live set are pruned, so the store tracks live kept
forks rather than growing forever.

The CLI guide still advertised `--origin-kind side-chat`, described archive as
cascading to "side chats", and the plugin sidebar doc still listed `side-chat`
as an origin kind.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@SawyerHood
SawyerHood merged commit b93a35a into main Aug 4, 2026
17 of 18 checks passed
@SawyerHood
SawyerHood deleted the bb/remove-old-sidechat-behavior-thr_ivspe5bpxu branch August 4, 2026 00:22
amadad pushed a commit to amadad/bb that referenced this pull request Aug 14, 2026
The builtin `side-chat` plugin becomes the only side chat. It already
ships enabled by default, so the `sideChatPlugin` experiment that gated
it is gone — and with it the per-plugin experiment gate itself, since no
other plugin used it.

Existing side chats are migrated rather than stranded, which is what
lets the legacy origin kind be removed outright.

## Migration

`0084` hands every `origin_kind = 'side-chat'` row to the plugin as a
hidden fork. Two earlier migrations did the setup work — `0038`
backfilled `child_origin`/`parent_thread_id` onto
`origin_kind`/`source_thread_id`, and `0079` hid every side chat — so
only two columns move:

```sql
UPDATE threads SET origin_kind = 'fork', origin_plugin_id = 'side-chat'
WHERE origin_kind = 'side-chat' AND source_thread_id IS NOT NULL;
```

An old side chat then reopens in the plugin's panel exactly like a new
one. A row with no source thread cannot be reopened at all (the panel
needs both ids), so it drops the origin kind instead of stranding a
removed value. The two migrations this branch started with are merged
into this one.

## What is removed

- **Experiment**: `sideChatPlugin` in the domain schema, the
`side_chat_plugin` column, the Settings toggle, the CLI key,
`onExperimentsChanged`, and the gate machinery in the plugin runtime,
activation, registration, and service layers.
- **Native side chat**: the tab deck and tab content,
`side-chat-create-request`, the per-message and selection "Reply in side
chat" actions, the new-tab launcher entry, and the `open-side-chat`
timeline title action. The plugin already registers all of these.
- **The `side-chat` origin kind**, and everything keyed on it: the
server archive cascade (the plugin cascades its own forks), the
create-time visibility default / title fallback / permission snapshot,
the side-chat exclusions for dynamic tools, plugin instructions, the
environment-directory tool and approval requests, the legacy readonly
permission inheritance, `excludeSideChats` / `excludeOriginKind`
(redundant with the existing hidden-thread exclusion), the
`sourceIsSideChat` presentation branch, and `--origin-kind side-chat`.
- **`PluginAgentConfigurationContext.sideChat`**, which would always be
false. `origin` already carries `{ kind: "fork", pluginId: "side-chat"
}`, which is what the plugin reads.

## Behavior changes worth review

1. **A side chat may now be a parent thread.** The old guard rejected
side-chat parents. Generalizing it to hidden threads broke plugins that
legitimately parent under their own hidden threads (caught by
`plugin-sdk.test.ts`), so the guard is gone; the depth cap still bounds
the hierarchy.
2. **Migrated side chats lose the native safety carve-outs** — no
approval-request rejection, no environment-directory block, no blanket
dynamic tools. These never applied to the plugin's forks, so this aligns
old rows with how every side chat has behaved since the plugin shipped.
3. **A migrated side chat that recorded the pre-0078 `readonly` mode**
normalizes to `accept-edits` instead of inheriting its source's
effective mode — the more restrictive direction.
4. **The plugin's cleanup sweep now covers migrated rows**, so a side
chat older than 24h that never received a user message gets archived.
Recoverable, and the sweep's intent.

## Also fixed here

SlopCop flagged the plugin's hourly `empty-fork-cleanup` as an unbounded
scan once the plugin installs by default — it listed every fork thread
and narrowed in JavaScript, against the repo's own "don't filter in JS"
rule. Added an `originPluginId` filter end to end (contract, db `WHERE`,
route, SDK); the sweep now queries `originKind` + `originPluginId` +
`archived: false` and pages with a fixed limit. The offset advances by
the forks each page *left behind*, since archiving removes rows from the
set being paged — a full-page step would skip that many unswept forks.
Tested.

## Verification

`typecheck`, `test`, and `lint` pass for every touched package and the
side-chat plugin. One pre-existing `@bb/server` failure is local only:
`internal-skill-trees.test.ts` expects file mode `0644` and my umask
gives `0664` — it fails identically on `main` and passes in CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5 (1M context) <[email protected]>
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