Skip to content

Speed up model and reasoning picker loading - #1810

Merged
ymichael merged 1 commit into
mainfrom
bb/speed-up-model-picker-loading-thr_pffyk7fhcc
Aug 18, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/speed-up-model-picker-loading-thr_pffyk7fhcc

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Summary

  • unblock provider-scoped picker requests as soon as the requested provider plugin registers
  • reuse one initialized Codex app-server for model catalog refreshes
  • invalidate provider and execution-option caches when plugin state changes
  • keep full provider listings gated until plugin startup settles

Testing

  • pnpm exec turbo run test --filter=@bb/server -- --run test/providers/provider-registry.test.ts test/system/execution-options.test.ts
  • pnpm exec turbo run test --filter=bb-plugin-provider-codex --force
  • pnpm exec turbo run test --filter=@bb/app -- --run src/hooks/realtime-cache-effects.test.ts
  • pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/app --filter=bb-plugin-provider-codex
  • pnpm exec turbo run lint --filter=@bb/app (0 errors; existing warnings remain)

AGENT GENERATED: by GPT-5

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 SLOP COP 🚨 · review

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

I will post one final review after the parallel checks finish.

@ymichael
ymichael merged commit c4d20e6 into main Aug 18, 2026
10 checks passed
@ymichael
ymichael deleted the bb/speed-up-model-picker-loading-thr_pffyk7fhcc branch August 18, 2026 19:07
dirtyProjectCommandCatalogQueries,
dirtyPluginManagementQueries,
dirtySystemProviderQueries, // Provider plugins add/remove picker entries.
dirtySystemExecutionOptionQueries, // Refresh a boot-time partial provider roster.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 slopcop/review — Unrelated plugin changes now refetch every active model picker.

This broad execution-option invalidation repairs the partial startup roster. It also runs for any plugin reload or status change. Each active query can start another provider model probe. Please narrow this action to provider roster changes, or add a targeted settlement event. Add a test that an unrelated plugin change does not refetch picker data.

timeoutMs: CHILD_REQUEST_TIMEOUT_MS,
}),
);
const connection = await getModelListConnection();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 slopcop/review — A failed model request leaves the cached child reusable.

connection.request can time out or reject malformed output without marking this connection as exited. The next picker refresh then reuses the same child and can repeat the full timeout. Please clear and stop this cached child after a request failure. Add a test that proves the next request creates a healthy child.

@bb-slop-cop bb-slop-cop Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🚨 SLOP COP 🚨 · review

Plain-English summary

This PR lets the picker answer when its selected provider becomes ready. It also keeps one Codex helper alive for later model requests.

The warm backend request improved from 5.52 seconds to 0.15 seconds in my local check.

Findings

  • High: A timed-out or invalid model/list response leaves the helper cached. Later picker requests reuse that child and can repeat the full timeout. Stop and clear the cached child after any request failure. Add a recovery test.

  • Medium: Every plugin change now invalidates all active execution-option queries. An unrelated plugin reload can start new model and ACP probes. Use a provider-specific change signal, or narrow the invalidation scope.

I left an inline comment for each finding.

Review details

The server and daemon ownership split remains correct. This PR does not change a wire contract, so it does not need a protocol version increase.

I found a duplicate ACP-registration scan in the registry and bridge-launch paths. A shared registry method could remove that low-risk duplicate.

I found no new authentication, authorization, data exposure, or forged-capability issue. The retained-child timeout is the main denial-of-service risk.

Checks

  • GitHub CI passes.
  • Typechecks pass for the server, app, and Codex provider plugin.
  • The Codex provider suite passes 165 tests.
  • The frontend cache suite passes 43 tests.
  • The focused server suites pass 45 tests.
  • git diff --check passes.
  • The direct picker backend returned seven Codex models without an error.

The browser app shell loaded. The worktree Vite API proxy hung, so I could not complete the visual picker interaction.

This is a comment-only review. I did not approve the PR or request changes. I recommend a fix for the cached-child recovery before merge.

ymichael added a commit that referenced this pull request Aug 18, 2026
## Summary

- retire the reusable Codex model-list child after request or catalog
validation failures
- force the next picker refresh to initialize a fresh app-server process
- cover failure recovery while preserving successful child reuse

Addresses the reliability finding from
#1810 (comment).

## Testing

- `pnpm exec turbo run test --filter=bb-plugin-provider-codex --force`
- `pnpm exec turbo run typecheck --filter=bb-plugin-provider-codex`
- `pnpm exec prettier --check
plugins/provider-codex/src/bridge/bridge.ts
plugins/provider-codex/src/bridge/bridge.model-list.test.ts
plugins/provider-codex/src/bridge/fake-codex-app-server.mjs`

> AGENT GENERATED: by GPT-5
ymichael added a commit that referenced this pull request Aug 18, 2026
## Summary

- add a provider-registration-specific realtime change kind
- coalesce registry mutations at plugin lifecycle boundaries using a
monotonic registration revision
- keep provider and execution-option caches intact for unrelated plugin
changes
- invalidate picker caches when a provider is installed, removed,
enabled, disabled, or reloaded

Addresses the performance finding from
#1810 (comment).

## Testing

- `pnpm exec turbo run test --filter=@bb/server -- --run
test/services/plugins/plugin-service.test.ts
test/services/plugins/plugin-provider-registration.test.ts -t
"broadcasts plugins-changed|adds the provider"`
- `pnpm exec turbo run test --filter=@bb/app -- --run
src/hooks/realtime-cache-effects.test.ts`
- `pnpm exec turbo run typecheck --filter=@bb/domain --filter=@bb/server
--filter=@bb/app`
- `pnpm exec turbo run typecheck --filter=@get-bb/plugin-sdk`
- `pnpm exec turbo run lint --filter=@bb/app --filter=@bb/server
--filter=@bb/domain` (0 errors; existing warnings remain)

This changes only the server-to-app realtime event contract; the
host-daemon protocol is unchanged.

> AGENT GENERATED: by GPT-5
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