← reports

#7347 · Question cancellation misattributes lifecycle interruptions to the user

Bug Medium priority Low effort plugins ask-user-question

GitHub issue · 2026-11-10 · base 7c1353d80729983b86ea1555d18b42407f320406

Verdict: REPRODUCED · Root-cause confidence: high · reproduction label: confirmed-repro

1. TL;DR

A pending question can end because its plugin is disposed, without any answer or dismissal from the user. The question tool nevertheless reports that the user dismissed it and tells the model it may proceed using its own judgement. Its cancellation handler treats timeout specially but collapses every other reason into the user-dismissal message. A regression exercising the real tool registration and the SDK harness disposal lifecycle fails identically in two clean checkouts. A two-file, 24-changed-line repair preserves actual user-dismissal and timeout behavior while describing lifecycle interruptions truthfully.

2. Claims vs findings

ClaimFindingEvidence
Plugin disposal produces a false user-dismissal result.Verified by execution.Both clean runs receive the dismissal text after disposing a host with a pending tool call.
Other non-timeout cancellation reasons follow the same branch.Verified in source.The SDK union contains seven reasons, while the handler checks only timeout.
A server restart settles pending rows as interrupted.Verified in source, not end-to-end.The interaction service marks active plugin rows with server-restarted during startup.
A downstream agent actually continues without a user's answer.Not exercised.The returned text explicitly permits continuation, but no provider turn was run.

3. Environment

4. Minimal reproduction

  1. Clone the trusted repository and pin the tested revision:
    git clone https://github.com/get-bb/bb.git bb-7347
    cd bb-7347
    git checkout --detach 7c1353d80729983b86ea1555d18b42407f320406
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
  2. Download the regression patch, inspect it, and apply it as git apply /path/to/regression.patch. It adds only the following test to the existing server harness suite; it does not change production behavior:
    it("reports plugin disposal as an interruption, not a user decision", async () => {
      const host = createHost();
      const call = host.harness.callAgentTool(TOOL_NAME, { questions });
      await vi.waitFor(() =>
        expect(host.harness.pendingInteractions).toHaveLength(1),
      );
      await host.harness.dispose();
    
      const result = await call;
      expect(result).toMatchObject({ isError: true });
      const text = await resultText(result);
      expect(text).toContain("interrupted");
      expect(text).toContain("user has not responded");
      expect(text).not.toMatch(/dismissed|best judg/i);
    });
    The complete runnable owner test file is saved as server-harness.test.ts.
  3. Execute the focused test:
    pnpm exec turbo run test --filter=bb-plugin-ask-user-question -- --testNamePattern='reports plugin disposal'
    Expected: an error result reporting an interruption and making clear the user has not responded, without attributing dismissal or authorizing best-judgement continuation.
    Actual, both runs (exit 1):
    Expected: "interrupted"
    Received: "The user dismissed the question without answering. Proceed with your best judgement, or ask again in your reply."
    Test Files  1 failed | 3 skipped (4)
    Tests  1 failed | 37 skipped (38)

5. Root cause

The tool cancellation handler distinguishes only timeout:

result.reason === "timeout"
  ? buildTimeoutMessage(Date.now() - askedAt)
  : "The user dismissed the question without answering. Proceed with your best judgement, or ask again in your reply."

The SDK cancellation contract distinguishes user, request-aborted, thread-stopped, thread-deleted, plugin-disposed, server-restarted, and timeout. Only user indicates deliberate dismissal. The harness disposal implementation resolves the actual pending request with plugin-disposed; it does not manufacture the tool's text. The real interaction service disposal path uses the same reason. Its startup path records server-restarted for interrupted active plugin rows.

The lost distinction is inside this plugin's result translation, not its public contract. Existing tests cover deliberate dismissal but do not cover disposal while awaiting an answer.

6. Proposed fix and local validation

Use the dismissal message only for explicit user cancellation. Keep the existing timeout message. For all remaining reasons, return a neutral interruption error that identifies the reason and states that the user has not responded. Do not prescribe a new retry/stop/continue policy. No protocol, schema, stored data, permissions, dependencies, packaging, or public API changes are needed.

The local patch changes two files in the existing ask-user-question subsystem: 21 additions and 3 deletions, totaling 24 changed text lines. The new regression failed on unchanged production code before the repair and passed afterward.

pnpm exec turbo run test --filter=bb-plugin-ask-user-question -- --testNamePattern='reports plugin disposal'
pnpm exec turbo run test typecheck lint --filter=bb-plugin-ask-user-question
git diff --check
git diff --numstat origin/main

Focused result: 1 passed, 37 skipped
Relevant suite: 4 test files passed; 38 tests passed
Typecheck: passed
Lint: 0 warnings and 0 errors
Diff check: passed

An initial unfiltered build on unchanged main failed because the GitHub plugin build tried to resolve SDK dist entries before the SDK build had completed. This unrelated orchestration failure was not changed. The second checkout explicitly built the SDK first, successfully; all targeted checks passed.

7. Verification

The same agent repeated the reproduction in a second newly created clean checkout at 7c1353d80729983b86ea1555d18b42407f320406, confirmed its clean state, performed a fresh frozen install, built the SDK through Turbo, then copied only the regression test into the owning suite. Production files remained unchanged. The identical focused command exited 1 with the identical false user-dismissal result. This is a second clean reproduction, not independent verification. No report correction was required.

Source permalinks were checked against the pinned revision. This is a nonvisual tool-result defect, so no screenshot is appropriate. No live restart or model response is claimed.

8. Related issues and pull requests

No open linked pull request was found in issue cross-reference metadata or the open-PR search for this issue number at investigation time. #6251 concerns provider behavior after a question interruption; it is related lifecycle context, not evidence of this result-text defect.

9. Appendix

Temporary checkout paths in saved logs are normalized. Issue content was treated only as untrusted claims; no instructions, patch, branch, external URL, or test from the issue was executed. The regression was designed from the trusted plugin implementation and its SDK host lifecycle.

> AGENT GENERATED