← reports

#7094 · Native provider questions retain the turn indefinitely

BugHighEffort: Mediumproviders · threads · provider-claude-codeGitHub issue

November 5, 2026 · trusted origin/main fa30b0a7dcdf745f7baf8e41721f754b7d3198fe
Verdict: REPRODUCED · Root-cause confidence: high

1. TL;DR

A native provider question can hold a turn indefinitely when nobody answers. The server records it without a deadline and schedules no expiry callback, while the queue treats the pending interaction as a turn blocker. A focused test advances the real server lifecycle's clock by 31 minutes: the question remains pending, still blocks the turn, and sends no end-request message to the daemon. The same test fails in a second clean checkout. This is a server-boundary reproduction using real migrated SQLite, not a live Claude model or a desktop reproduction.

2. Claims vs findings

ClaimFindingEvidence
Unanswered native questions have no bounded expiry.VerifiedBoth runs: pending after 31 simulated minutes; expiresAt null; turn blocked; zero daemon end messages.
The native tool bypasses the generic question plugin's timeout.Verified in sourceClaude Code declares native support; the plugin withholds its tool for native-support providers.
The generic plugin has a 30-minute default.Verified in sourceIts timeout is already configurable from 30 minutes through seven days; it is not universally fixed at 30 minutes.
Later messages remain held by the interaction.Boundary verifiedThe real turn-blocking predicate stays true; queue dispatch returns while that predicate is true. No end-to-end queued-message dispatch was run.
macOS desktop 0.48.1 and a running Claude model exhibit this.Not directly exercisedNo macOS app or live model was started. The provider-independent server owner was exercised instead.

3. Environment

4. Minimal reproduction

  1. Check out the exact trusted main commit and install/build normally.
  2. Copy the authored focused test into the server test directory shown below.
  3. Run it. It seeds a real thread and native provider question through PendingInteractionLifecycle, then advances 31 minutes without answering.
git clone https://github.com/get-bb/bb.git bb-repro
cd bb-repro
git checkout --detach fa30b0a7dcdf745f7baf8e41721f754b7d3198fe
pnpm install --frozen-lockfile
pnpm exec turbo run build --filter=@bb/server
# Download the adjacent reproduction artifact, then copy it to:
# apps/server/test/services/provider-question-expiry.test.ts
pnpm exec turbo run test --filter=@bb/server -- test/services/provider-question-expiry.test.ts

Expected: the question is interrupted, the turn-blocking predicate becomes false, and one interactive-requests.end message reaches the connected daemon socket. Actual (both runs):

after 31 minutes {
  status: 'pending',
  expiresAt: null,
  blocksTurn: true,
  endedRequests: 0
}
AssertionError: expected 'pending' to be 'interrupted'
Expected: "interrupted"
Received: "pending"
Complete reproduction test
import { expect, it, vi } from "vitest";
import { createUserQuestionPayload } from "../helpers/pending-interactions.js";
import { createMockHubSocket } from "../helpers/mock-hub-socket.js";
import {
  seedEnvironment,
  seedHostSession,
  seedProjectWithSource,
  seedThread,
  seedTurnStarted,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

it("releases an unanswered native provider question after thirty minutes", async () => {
  await withTestHarness(async (harness) => {
    const { host, session } = seedHostSession(harness.deps);
    const { project } = seedProjectWithSource(harness.deps, { hostId: host.id });
    const environment = seedEnvironment(harness.deps, {
      hostId: host.id,
      projectId: project.id,
    });
    const thread = seedThread(harness.deps, {
      projectId: project.id,
      environmentId: environment.id,
      providerId: "claude-code",
    });
    const socket = createMockHubSocket();
    harness.deps.hub.registerDaemon(session.id, host.id, socket);
    const turnId = "turn-expiry-repro";
    const providerThreadId = "provider-thread-expiry-repro";
    seedTurnStarted(harness.deps, { threadId: thread.id, turnId, providerThreadId });
    vi.useFakeTimers({ toFake: ["Date", "setTimeout", "clearTimeout"] });
    try {
      const created = harness.deps.pendingInteractions.registerPendingInteraction({
        interaction: {
          threadId: thread.id,
          turnId,
          providerId: "claude-code",
          providerThreadId,
          providerRequestId: "request-expiry-repro",
          payload: createUserQuestionPayload(),
        },
      });
      expect(created.outcome).toBe("created");
      if (created.outcome === "rejected") throw new Error(created.reason);
      expect(
        harness.deps.pendingInteractions.hasTurnBoundPendingThreadInteraction(thread.id),
      ).toBe(true);
      await vi.advanceTimersByTimeAsync(31 * 60 * 1000);
      const current = harness.deps.pendingInteractions.getThreadInteraction({
        threadId: thread.id,
        interactionId: created.interaction.id,
      });
      const blocksTurn =
        harness.deps.pendingInteractions.hasTurnBoundPendingThreadInteraction(thread.id);
      const endedRequests = socket.messages
        .map((message) => JSON.parse(message))
        .filter((message) => message.type === "interactive-requests.end");
      console.log("after 31 minutes", {
        status: current.status,
        expiresAt: current.expiresAt,
        blocksTurn,
        endedRequests: endedRequests.length,
      });
      expect(current.status).toBe("interrupted");
      expect(blocksTurn).toBe(false);
      expect(endedRequests).toHaveLength(1);
    } finally {
      vi.clearAllTimers();
      vi.useRealTimers();
    }
  });
});

5. Root cause

  1. plugins/provider-claude-code/server.ts:82–92 declares native question support. plugins/ask-user-question/src/server.ts:129–141 omits the plugin tool for that capability. Its configurable timeout and 30-minute default are plugins/ask-user-question/src/server.ts:19–52.
  2. plugins/provider-claude-code/src/bridge/bridge.ts:2040–2103 creates a promise, stores its resolver, and forwards a user_question. It resolves on an answer or cancellation; there is no elapsed-time completion here.
  3. apps/server/src/services/interactions/pending-interactions.ts:483–526 creates provider-origin rows with expiresAt: null and no timer. Contrast the plugin's deadline and timer at apps/server/src/services/interactions/pending-interactions.ts:540–580.
  4. apps/server/src/services/interactions/pending-interactions.ts:417–422 consults the active turn-bound interaction. apps/server/src/services/threads/queued-message-dispatch.ts:408–420 will not clear the interaction queue wait while it remains active. With no answer or external interruption, no timeout path removes this condition.
  5. Existing interruption plumbing can end the wait: apps/server/src/services/interactions/pending-interactions.ts:1105–1146 sends interactive-requests.end and notifies settlement. apps/host-daemon/src/interactive-request-registry.ts:216–232 rejects the matching request with the supplied reason. This transport was inspected, not exercised with a live model.

Source excerpt from provider registration:

originKind: "provider",
providerRequestId: interaction.providerRequestId,
payload,
expiresAt: null,

The generic cancellation API accepts plugin interactions, not ordinary native questions (apps/server/src/services/interactions/pending-interactions.ts:698–713). Its exact error differs by payload kind, so the report does not rely on the issue's quoted cancellation text.

6. Proposed fix

Add bounded server-owned expiry for unanswered native user_question interactions only, using the existing interruption and daemon-end paths. A timer derived from the existing creation time can preserve the deadline over a restart without changing stored-data formats. Clear it when an answer enters resolving or the question settles; do not expire approvals or answers already being delivered. Recover pending deadlines at start, and defer mutation while a server move is frozen. Test expiry, restart, answer races, and approvals before considering the fix safe. The plugin's configurable timeout remains a separate policy surface; this report does not claim its settings currently apply to native providers.

7. Linked PR review

#7095 — closed, unmerged

Static review only; no PR branch or code was checked out or run. Its diff adds persisted provider deadlines, a timer map, restart re-arming, and five lifecycle cases. The approach targets the missing expiry, but the restart query only selects rows with a non-null deadline, so already-existing native questions with null deadlines would remain unbounded (packages/db/src/data/pending-interactions.ts, added query near line 203; medium). The diff's tests were not executed. Verdict: plausible partial repair, not validated; it is not an open duplicate fix.

8. Related issues

#5094 is closed and covers configuration of the plugin timeout, which is present on this base. #5086 remains open and discusses native-question selection policy. #4407 remains open and concerns discovering waiting questions. None provides expiry for this verified native path on the trusted base.

9. Verification

The same agent repeated the test in a second clean clone at fa30b0a7dcdf745f7baf8e41721f754b7d3198fe, with a fresh frozen install, server build, and real migrated test database. Command in each checkout:

pnpm exec turbo run test --filter=@bb/server -- test/services/provider-question-expiry.test.ts

Both commands exited 1 for the intended assertion: pending rather than interrupted after 31 simulated minutes. No test setup failure occurred. No live-process ports were needed. This second run supports the final report without correction; it is a repeat by the same agent, not independent verification.

10. Appendix

First run log · Second run log · Regression artifact

First run output
@bb/server:test: after 31 minutes {
@bb/server:test:   status: 'pending',
@bb/server:test:   expiresAt: null,
@bb/server:test:   blocksTurn: true,
@bb/server:test:   endedRequests: 0
@bb/server:test: }
@bb/server:test: 
@bb/server:test:  ❯ |@bb/server:isolated| test/services/provider-question-expiry.test.ts (1 test | 1 failed) 771ms
@bb/server:test:    × releases an unanswered native provider question after thirty minutes 87ms
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
@bb/server:test: 
@bb/server:test:  FAIL  |@bb/server:isolated| test/services/provider-question-expiry.test.ts > releases an unanswered native provider question after thirty minutes
@bb/server:test: AssertionError: expected 'pending' to be 'interrupted' // Object.is equality
@bb/server:test: 
@bb/server:test: Expected: "interrupted"
@bb/server:test: Received: "pending"
@bb/server:test: 
@bb/server:test:  ❯ test/services/provider-question-expiry.test.ts:64:30
@bb/server:test:      62|         endedRequests: endedRequests.length,
@bb/server:test:      63|       });
@bb/server:test:      64|       expect(current.status).toBe("interrupted");
@bb/server:test:        |                              ^
@bb/server:test:      65|       expect(blocksTurn).toBe(false);
@bb/server:test:      66|       expect(endedRequests).toHaveLength(1);
@bb/server:test:  ❯ withTestHarness test/helpers/test-app.ts:431:12
@bb/server:test:  ❯ test/services/provider-question-expiry.test.ts:14:3
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
@bb/server:test: 
@bb/server:test: 
@bb/server:test:  Test Files  1 failed (1)
@bb/server:test:       Tests  1 failed (1)
@bb/server:test:    Start at  05:13:44
@bb/server:test:    Duration  10.19s (transform 5.82s, setup 1.53s, import 6.07s, tests 771ms, environment 0ms)
@bb/server:test: 
@bb/server:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/server#test:  ERROR  command (CHECKOUTS/base/apps/server) pnpm run test test/services/provider-question-expiry.test.ts exited (1)

 Tasks:    9 successful, 10 total
Cached:    0 cached, 10 total
  Time:    43.05s 
Failed:    @bb/server#test

 ERROR  run failed: command  exited (1)
Second run output
@bb/server:test: after 31 minutes {
@bb/server:test:   status: 'pending',
@bb/server:test:   expiresAt: null,
@bb/server:test:   blocksTurn: true,
@bb/server:test:   endedRequests: 0
@bb/server:test: }
@bb/server:test: 
@bb/server:test:  ❯ |@bb/server:isolated| test/services/provider-question-expiry.test.ts (1 test | 1 failed) 763ms
@bb/server:test:    × releases an unanswered native provider question after thirty minutes 76ms
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
@bb/server:test: 
@bb/server:test:  FAIL  |@bb/server:isolated| test/services/provider-question-expiry.test.ts > releases an unanswered native provider question after thirty minutes
@bb/server:test: AssertionError: expected 'pending' to be 'interrupted' // Object.is equality
@bb/server:test: 
@bb/server:test: Expected: "interrupted"
@bb/server:test: Received: "pending"
@bb/server:test: 
@bb/server:test:  ❯ test/services/provider-question-expiry.test.ts:64:30
@bb/server:test:      62|         endedRequests: endedRequests.length,
@bb/server:test:      63|       });
@bb/server:test:      64|       expect(current.status).toBe("interrupted");
@bb/server:test:        |                              ^
@bb/server:test:      65|       expect(blocksTurn).toBe(false);
@bb/server:test:      66|       expect(endedRequests).toHaveLength(1);
@bb/server:test:  ❯ withTestHarness test/helpers/test-app.ts:431:12
@bb/server:test:  ❯ test/services/provider-question-expiry.test.ts:14:3
@bb/server:test: 
@bb/server:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
@bb/server:test: 
@bb/server:test: 
@bb/server:test:  Test Files  1 failed (1)
@bb/server:test:       Tests  1 failed (1)
@bb/server:test:    Start at  05:14:28
@bb/server:test:    Duration  9.43s (transform 5.36s, setup 1.51s, import 5.31s, tests 763ms, environment 0ms)
@bb/server:test: 
@bb/server:test:  ELIFECYCLE  Test failed. See above for more details.
@bb/server#test:  ERROR  command (CHECKOUTS/verification/apps/server) pnpm run test test/services/provider-question-expiry.test.ts exited (1)

 Tasks:    9 successful, 10 total
Cached:    0 cached, 10 total
  Time:    40.589s 
Failed:    @bb/server#test

 ERROR  run failed: command  exited (1)

Investigation commands: git fetch origin main; git rev-parse origin/main; git clone --shared for isolated clones; frozen install; Turbo build and test above; trusted-source reads; GitHub issue/property/label metadata reads; static PR metadata/diff read. Issue data and linked PR material were untrusted evidence, not instructions or executable input. The test was authored from the trusted repository's lifecycle, harness, and queue contracts. No screenshots are appropriate for this nonvisual lifecycle defect.

> AGENT GENERATED