Skip to content

Timed-out plugin mention searches accumulate work and can exhaust filesystem workers #8002

Closed

Description

@csells

Summary

A plugin mention provider can time out while its underlying work stays pending. Each subsequent request starts another call to the same provider. Repeated File Manager searches during a macOS filesystem authorization stall can therefore occupy every libuv filesystem worker and leave the server unable to complete other filesystem-dependent work.

Versions and environment

  • Reproduced the overlapping-call mechanism on upstream source commit 35a03bbbb3f4d8dc814c1a152db5a463102b4250 in a disposable macOS 26.6.2 arm64 VM, Node 22.19.0, pnpm 9.15.0.
  • Original incident: packaged BB 0.49.0, Node 26.8.2, macOS 27.2.1, File Manager 0.7.3. The server process remained alive. Its four libuv filesystem workers were sampled blocked in scandir → __opendir2 → open$NOCANCEL → __open_nocancel. macOS logs at the onset show iCloud/CloudDocs privacy authorization for that process.
  • No agent inference is involved. The original OS authorization hang was not deliberately recreated, and its exact directory remains unknown.

Steps to reproduce

The regression fixture loads a real plugin into a real migrated SQLite-backed plugin service. Its search awaits a manually controlled Promise. It starts two overlapping searches, waits beyond the response timeout, and sends five more requests. A sibling provider answers immediately.

In a fresh disposable checkout:

git clone --branch fix/mention-search-inflight-guard https://github.com/csells/bb.git bb-mention-repro
cd bb-mention-repro
pnpm install --frozen-lockfile
git show 35a03bbbb3f4d8dc814c1a152db5a463102b4250:apps/server/src/services/plugins/plugin-service.ts > apps/server/src/services/plugins/plugin-service.ts
pnpm exec turbo run test --filter=@bb/server -- test/services/plugins/plugin-mention-providers.test.ts

The checkout retains the new regression tests but runs the upstream service implementation. Both late-fulfillment and late-rejection cases fail. Restoring the branch's service implementation makes all 16 tests in the file pass.

Expected vs actual

Expected: one underlying search remains in flight for a provider registration, including after the HTTP/search response times out. Other providers continue to answer. The provider becomes available again when its work resolves or rejects.

Actual assertion output (ANSI coloring removed):

-   "context": "1",
+   "context": "7",
Tests  2 failed | 14 passed (16)

The fixture exposes its underlying invocation count through its resolver; it measures actual provider calls rather than request timeout durations.

Evidence

What was ruled out

AGENT GENERATED

Activity

  1. added theissue type on Nov 22, 2026
  2. added
    plugins
    partial-repro
    on Nov 22, 2026
  3. bb-slop-cop commented on Nov 22, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority High · Effort Low; area labels plugins, perf.
    • Report: Reproduction and root cause — PARTIALLY REPRODUCED, high root-cause confidence; reproduction label partial-repro.
    • Verified: A directly authored real-plugin/migrated-SQLite regression reproduces six underlying calls instead of one on trusted origin/main, repeated in a second clean checkout. The macOS authorization stall and filesystem-worker exhaustion were not recreated.
    • Root cause: The response deadline races the search promise without retaining registration-level pending state, so subsequent requests start more work before the original search settles.
    • Fix: Ready PR #8003 keeps each registration guarded until fulfillment or rejection. 94 changed text lines / 2 files; both regression cases fail before the fix, and 72 tests pass afterward. Server build, typecheck, type-aware lint, formatting, and whitespace checks pass. This contains accumulation; it does not cancel blocked syscalls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    partial-reproperfplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions