← reports

#7182 · Provider questions outlive their owning turn

BugHighEffort: Mediumproviders · threads · opencode · ask-user-questionGitHub issue

November 6, 2026 · trusted main 14b3293254da0a3b4c858a01c5415d91f17aa7b5

PARTIALLY REPRODUCED · Root-cause confidence: high for the shared server lifecycle defect; the reported OpenCode deadline and silent model-delivery failure remain unverified.

1. TL;DR

A native provider question remains pending after the server has accepted completion of the turn that asked it. A later answer still passes the server's resolution entry point instead of being rejected as expired. An authored regression test demonstrates both failures for interrupted, failed, and successfully completed turns, with the same result in two clean trusted checkouts. This reproduces the orphaned-question portion of the report, not the complete legacy OpenCode incident: current main ships OpenCode through ACP with native-question support declared false, and this investigation did not run OpenCode 2.2.5 or observe model delivery.

2. Claims vs findings

ClaimFindingEvidence
A provider turn can finish while its question remains answerable.Verified on current mainThe real internal event route returns HTTP 200, but the persisted interaction stays pending in all three terminal-status cases, in both clean runs.
A late answer is accepted despite completion of the owning turn.Verified at the server lifecycle boundaryThe resolver does not throw after completion; the regression's expired-answer assertion fails.
OpenCode itself has an exact 600-second deadline with no configurable override.UnverifiedNo external provider implementation or the reporter's runtime was executed. The test injects a legitimate turn-completion event without simulating a 600-second timer.
A late answer reaches resolved and is never delivered to the model.Unverified end to endThe test establishes acceptance only, not provider acknowledgement or model receipt. Current main separately handles failed delivery acknowledgements.
The plugin is withheld from providers declaring native questions.VerifiedThe plugin capability gate is static. Its own timeout is passed only to the plugin interaction request.
Current OpenCode cannot receive the plugin fallback because it declares native questions.Not true of current main's ACP declarationThe current ACP capability is false; the reported legacy bridge is not present in the searched source. This does not refute the historical 0.48.1 observation.
The UI displays successful answers after delivery fails.Unverified visuallyNo browser or live provider was used. This is a lifecycle report, not a screenshot-based UI reproduction.

3. Environment

4. Minimal reproduction

The reproduction was designed from trusted server code. It was not supplied by the issue. It protects one lifecycle contract at its owner boundary: terminal turns must not leave their native questions answerable. Existing tests cover registration after a completed turn, explicit interruption, and host reconnect reconciliation, but not this already-registered-question/turn-completion sequence.

  1. Check out the recorded trusted base in a new directory:
    git clone https://github.com/get-bb/bb.git bb-7182
    cd bb-7182
    git checkout --detach 14b3293254da0a3b4c858a01c5415d91f17aa7b5
    pnpm install --frozen-lockfile --prefer-offline
    pnpm exec turbo run build --filter=@get-bb/plugin-sdk
    pnpm exec turbo run build

    The initial full build in the first checkout hit an SDK dist ordering failure. Explicitly building the SDK, then retrying the full build, completed all 73 tasks. No production changes were needed.

  2. Copy the full authored regression test printed below into apps/server/test/services/issue-7182-repro.test.ts.
  3. Run the focused test through Turbo:
    pnpm exec turbo run test --filter=@bb/server -- test/services/issue-7182-repro.test.ts
  4. Expected: all three cases close the question and reject a late answer. Actual, identically in both checkouts:
    AssertionError: expected 'pending' to be 'interrupted' // Object.is equality
    Expected: "interrupted"
    Received: "pending"
    
    AssertionError: expected [Function] to throw an error
    
    Test Files  1 failed (1)
         Tests  3 failed (3)

    There are six assertion failures across three table cases: one stale-status failure and one late-answer acceptance failure per terminal status. The event request itself succeeds.

Full regression test

import { describe, expect, it } from "vitest";
import { turnScope } from "@bb/domain";
import { groupHostDaemonEvents } from "@bb/host-daemon-contract";
import { internalAuthHeaders } from "../helpers/commands.js";
import {
  createUserAnswerResolution,
  createUserQuestionPayload,
} from "../helpers/pending-interactions.js";
import {
  seedEnvironment,
  seedHostSession,
  seedProjectWithSource,
  seedThread,
  seedTurnStarted,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("provider question lifetime", () => {
  it.each(["interrupted", "failed", "completed"] as const)(
    "closes a native question when its owning turn is %s",
    async (status) => {
      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",
          status: "active",
        });
        const turnId = "turn-question-lifetime";
        const providerThreadId = "provider-question-lifetime";
        seedTurnStarted(harness.deps, {
          threadId: thread.id,
          turnId,
          providerThreadId,
        });
        const created =
          harness.deps.pendingInteractions.registerPendingInteraction({
            interaction: {
              threadId: thread.id,
              turnId,
              providerId: "claude-code",
              providerThreadId,
              providerRequestId: "request-question-lifetime",
              payload: createUserQuestionPayload(),
            },
          });
        if (created.outcome === "rejected") {
          throw new Error(created.reason);
        }
        const interactionId = created.interaction.id;
        const response = await harness.app.request("/internal/session/events", {
          method: "POST",
          headers: internalAuthHeaders(harness),
          body: JSON.stringify({
            sessionId: session.id,
            eventGroups: groupHostDaemonEvents([
              {
                threadId: thread.id,
                event: {
                  type: "turn/completed",
                  threadId: thread.id,
                  providerThreadId,
                  scope: turnScope(turnId),
                  status,
                },
              },
            ]),
          }),
        });
        expect(response.status).toBe(200);
        const afterCompletion =
          harness.deps.pendingInteractions.getThreadInteraction({
            interactionId,
            threadId: thread.id,
          });
        expect.soft(afterCompletion.status).toBe("interrupted");
        expect(() =>
          harness.deps.pendingInteractions.resolvePendingInteraction({
            interactionId,
            threadId: thread.id,
            resolution: createUserAnswerResolution(),
          }),
        ).toThrow();
      });
    },
  );
});

5. Root cause

The event handler dispatches turn/completed to the turn-completion service, which updates thread lifecycle and pruning but does not settle pending provider interactions: apps/server/src/internal/events.ts:494–511 and apps/server/src/internal/turn-completed-events.ts:34–73.

The interaction resolver checks row ownership, row status, and answer shape, then queues a resolution. It does not check whether the interaction's owning turn has completed: apps/server/src/services/interactions/pending-interactions.ts:762–807. Registration has a completed-turn guard, but that guard cannot close a question registered before the turn finishes: apps/server/src/services/interactions/pending-interactions.ts:430–458.

The result follows directly: a previously registered question retains pending status, so a subsequent submission is accepted. This is the demonstrated shared lifecycle bug. It does not, by itself, prove a model-delivery loss: apps/server/src/services/interactions/pending-interactions.ts:844–876 interrupts ordinary failed deliveries, retains host-unavailable deliveries, and treats some redelivered stale answers specially. The daemon registry also rejects an unknown request, while a delivered tombstone is idempotent: apps/host-daemon/src/interactive-request-registry.ts:178–213.

The plugin gate remains capability-based: plugins/ask-user-question/src/server.ts:131–139. Its configurable deadline belongs to the plugin request: plugins/ask-user-question/src/server.ts:75–85. However, the current ACP declaration sets supportsNativeUserQuestion: false: plugins/provider-acp/src/declaration.ts:8–17; OpenCode is listed as an ACP agent: plugins/provider-acp/src/known-agents.ts:87–103. There is no basis here to claim current main reproduces the legacy bridge's exact gating behavior.

6. Proposed fix and safety gate

A narrowly scoped follow-up should interrupt still-pending provider-origin questions for the exact completed turn and make resolution reject completed-turn questions atomically. Preserve asynchronous plugin cards, other turns' requests, and resolving answers already delivered or awaiting acknowledgement. Cover those races and scope boundaries before shipping. Late-answer conversion to a follow-up user message is a separate product behavior, not an assumption made by this report.

No production fix or pull request was attempted. The report is only partially reproduced, and the reported legacy provider path is absent from current main. A safe full-incident regression and verification of deadline cancellation versus successful delivery were not established, so the autopilot's reproduced-bug simple-fix gate is not satisfied. No linked open pull request was found in issue cross-references or the numeric open-PR search at investigation time.

7. Verification

The same agent repeated the reproduction in a second clean detached checkout at 14b3293254da0a3b4c858a01c5415d91f17aa7b5. Before copying the authored test, the second checkout had no tracked differences. Dependencies were installed with the frozen lockfile and the SDK was built through Turbo. Only the authored test was then added; no production code changed. The second run executed live rather than replaying a cached test result, used a new temporary harness data directory for each case, and required no network ports.

pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build --filter=@get-bb/plugin-sdk
pnpm exec turbo run test --filter=@bb/server -- test/services/issue-7182-repro.test.ts

First run:  3 failed tests, 6 assertion failures, 9.48s Vitest duration
Second run: 3 failed tests, 6 assertion failures, 8.93s Vitest duration

These are repeated checks by one agent, not independent verification. No correction was required between runs. Existing-suite results are provided in the appendix; raw evidence is retained locally rather than committed to the public report repository. Neither repetition proves the external provider's ten-minute timer or a misleading rendered answer label.

8. Related issues

The report's related issue numbers were treated only as unverified contextual claims; no external issue links, patches, or scripts were executed. This investigation confines conclusions to #7182 and the recorded trusted main code. No unrelated issue was changed.

9. Appendix

Existing server pending-interaction suite: 41 passed (41)
Existing ACP agent declaration suite:       19 passed (19)
Existing question plugin harness suite:     21 passed (21)

Focused existing commands, run without the failing reproduction file:

pnpm exec turbo run test --filter=@bb/server -- test/services/pending-interactions.test.ts
pnpm exec turbo run test --filter=bb-plugin-provider-acp -- src/agents.test.ts
pnpm exec turbo run test --filter=bb-plugin-ask-user-question -- src/server-harness.test.ts

Inspection commands included targeted rg, numbered source excerpts, trusted-main git history, GitHub GraphQL issue-property reads, label discovery, and open-PR metadata reads. Issue data was treated as untrusted evidence; no commands, links, code, or instructions originating in issue data were executed. No dependencies were added. Original provider-runtime logs and model conversations were not accessed or published.

> AGENT GENERATED