← reports

#6226 · Active-goal continuation event-path diagnostic

BugPriority: MediumEffort: Medium providers · threads · provider-codexIssue

2026-10-24 · Trusted base: efd10ce0b0d0785148e1bc7e375f51e00d3b5b85

Verdict: NOT REPRODUCED · Root-cause confidence: low · Reproduction label: no-repro

1. TL;DR

The report describes a native Codex goal remaining active while its thread stops working between turns. Two clean checkouts were used to test BB’s actual Codex bridge with the repository’s scripted app-server child. An active goal snapshot remains active after a completion, and a subsequent native turn is forwarded when the child supplies it. This establishes the event-path behavior, not the intermittent native scheduler failure: the script deliberately chooses whether a second turn exists. No authenticated native Codex goal was run, and no failing real event trace was available, so the reported defect and its root cause remain unconfirmed.

2. Claims vs findings

ClaimStatusEvidence
Goal state can remain active after a completed turn.Verified at the bridge boundaryBoth diagnostic cases retain an active, under-budget goal payload after completion.
The real native goal scheduler intermittently fails to start a next turn.UnverifiedNo native goal execution or original failure trace; the scripted no-continuation case intentionally emits no second turn.
BB loses every native continuation after a completion.Refuted for the tested bridge sequenceA single BB turn/start request forwards two distinct native turn lifecycles.
No queued work or other blocker existed in the reported occurrence.UnverifiedNo affected thread ID, queue snapshot, interaction state, provider version, or timestamps.

3. Environment

4. Minimal diagnostic reproduction

This is not an end-to-end reproduction of the reported native bug. It distinguishes absent provider continuation events from bridge loss of supplied events.

  1. Fetch trusted main and create two clean checkouts at the recorded commit. In each, install with the frozen lockfile and run the normal Turbo build.
  2. Copy the inline diagnostic source to plugins/provider-codex/src/bridge/bridge.goal-continuation-probe.test.ts in each checkout. No production code changes are needed.
  3. Run in each checkout:
    pnpm exec turbo run test --filter=bb-plugin-provider-codex -- src/bridge/bridge.goal-continuation-probe.test.ts --silent=false
  4. Case A sends an active goal snapshot and one completed native turn. Case B sends that same state and two native turns. Each case uses exactly one BB turn/start request, the real bridge implementation, and the trusted fake app-server child.
  5. Expected and observed diagnostic output:
    {"providerContinues":false,"completedTurns":1,"goalStatus":"active","clientTurnRequests":1,"observationMs":250}
    {"providerContinues":true,"completedTurns":2,"goalStatus":"active","clientTurnRequests":1,"observationMs":250}
    Test Files  1 passed (1)
    Tests       2 passed (2)

The 250 ms window only bounds this probe; it does not prove that a real native scheduler would never continue later. The child remains alive through the observation window: the test checks that no SIGTERM was logged before cleanup.

Full repeatable probe
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, expect, it, vi } from "vitest";
import {
  experimental_assembleCapturedThreadEvents as assembleCapturedThreadEvents,
  experimental_createBridgeJsonRpcTestHarness as createBridgeJsonRpcTestHarness,
} from "@get-bb/plugin-sdk/provider-bridge/testing";
import { handleLine } from "./bridge.js";
import {
  FULL_ACCESS_SESSION_OPTIONS,
  stubFakeCodexAppServer,
} from "./fake-codex-app-server-harness.js";

afterEach(() => vi.unstubAllEnvs());

it.each([false, true])(
  "preserves active goal state and forwards native continuation when supplied: %s",
  async (providerContinues) => {
    const workspace = mkdtempSync(join(tmpdir(), "bb-goal-probe-"));
    const scriptPath = join(workspace, "script.json");
    const requestLogPath = join(workspace, "requests.jsonl");
    const processLogPath = join(workspace, "process.log");
    const threadId = "thr_goal_probe";
    const goal = {
      objective: "Finish a bounded diagnostic objective",
      status: "active",
      tokenBudget: 100000,
      tokensUsed: 100,
      timeUsedSeconds: 1,
    };
    const nativeTurns = providerContinues ? ["turn-1", "turn-2"] : ["turn-1"];
    writeFileSync(
      scriptPath,
      JSON.stringify({
        requestLogPath,
        processLogPath,
        turns: [
          [
            { method: "thread/goal/updated", params: { threadId, goal } },
            ...nativeTurns.flatMap((turnId) => [
              {
                method: "turn/started",
                params: {
                  threadId,
                  turn: { id: turnId, status: "inProgress" },
                },
              },
              {
                method: "turn/completed",
                params: { threadId, turn: { id: turnId, status: "completed" } },
              },
            ]),
          ],
        ],
      }),
    );
    stubFakeCodexAppServer(scriptPath);
    const bridge = createBridgeJsonRpcTestHarness(handleLine);
    try {
      bridge.sendRequest(1, "thread/start", {
        threadId,
        cwd: workspace,
        instructionMode: "append",
        options: FULL_ACCESS_SESSION_OPTIONS,
      });
      const started = await bridge.waitForResponse(1);
      expect(started.error).toBeUndefined();
      const result = started.result;
      if (
        typeof result !== "object" ||
        result === null ||
        !("providerThreadId" in result) ||
        typeof result.providerThreadId !== "string"
      ) {
        throw new Error("Missing provider identity in thread/start result");
      }
      bridge.sendRequest(2, "turn/start", {
        threadId,
        providerThreadId: result.providerThreadId,
        clientRequestId: "creq_6226prbe23",
        input: [
          { type: "text", text: "Run the bounded diagnostic", mentions: [] },
        ],
        options: FULL_ACCESS_SESSION_OPTIONS,
      });
      const accepted = await bridge.waitForResponse(2);
      expect(accepted.error).toBeUndefined();
      await vi.waitFor(() => {
        const events = assembleCapturedThreadEvents(bridge.messages, "codex");
        expect(
          events.filter((event) => event.type === "turn/completed"),
        ).toHaveLength(nativeTurns.length);
      });
      await new Promise((resolve) => setTimeout(resolve, 250));
      const events = assembleCapturedThreadEvents(bridge.messages, "codex");
      expect(
        events.filter((event) => event.type === "turn/started"),
      ).toHaveLength(nativeTurns.length);
      expect(
        events.filter((event) => event.type === "turn/completed"),
      ).toHaveLength(nativeTurns.length);
      expect(
        events.filter(
          (event) => event.type === "thread/extensionState/updated",
        ),
      ).toContainEqual(
        expect.objectContaining({
          kind: "provider-codex/goal",
          payload: goal,
        }),
      );
      const requests = readFileSync(requestLogPath, "utf8")
        .trim()
        .split("\n")
        .map((line) => JSON.parse(line));
      expect(
        requests.filter((request) => request.method === "turn/start"),
      ).toHaveLength(1);
      expect(readFileSync(processLogPath, "utf8")).not.toContain("sigterm:");
      console.info(
        JSON.stringify({
          providerContinues,
          completedTurns: nativeTurns.length,
          goalStatus: goal.status,
          clientTurnRequests: 1,
          observationMs: 250,
        }),
      );
    } finally {
      bridge.sendRequest(99, "thread/stop", {
        threadId,
        providerThreadId: "probe-cleanup",
        intent: "release",
        activeTurnId: null,
      });
      await bridge.waitForResponse(99);
      bridge.restore();
      rmSync(workspace, { recursive: true, force: true });
    }
  },
  15000,
);

5. Root cause

Not established for the reported incident. In the synthetic stalled case, the cause of the missing second turn is explicitly the fixture, not a demonstrated BB defect. BB translates a provider goal notification into extension state; it is not itself a request to start a turn:

plugins/provider-codex/src/delta-translation.ts:1111

    case "thread/goal/updated": {
      const goal: CodexGoalState = {
        objective: handledEvent.params.goal.objective,
        status: handledEvent.params.goal.status,
        tokenBudget: handledEvent.params.goal.tokenBudget,
        tokensUsed: handledEvent.params.goal.tokensUsed,
        timeUsedSeconds: handledEvent.params.goal.timeUsedSeconds,
      };
      return [
        {
          kind: "extension.state",
          extensionKind: CODEX_GOAL_EXTENSION_KIND,
          payload: goal,
        },
      ];
    }
    case "thread/goal/cleared":

The bridge handles child notifications through its translator and forwards their deltas. The supplied second native turn survives this path in both clean runs:

plugins/provider-codex/src/bridge/bridge.ts:703

async function handleChildNotification(
  bbThreadId: string,
  serial: number,
  method: string,
  params: unknown,
): Promise<void> {
  const session = currentSession(bbThreadId, serial);
  if (!session) {
    return;
  }
  if (method === "thread/started") {
    const parsed = codexThreadStartedNotificationSchema.safeParse(params);
    if (parsed.success) {
      announceSessionIdentity(session, parsed.data.thread.id);
    }
  }
  if (method === "thread/status/changed") {
    settleCompactionDispatchesWhenCodexIsNotRunning(session, params);
  }
  if (method === "turn/started") {
    const parsed = codexTurnNotificationPeekSchema.safeParse(params);
    if (parsed.success && parsed.data.threadId === session.codexThreadId) {
      markResponseOpenedTurnNativelyStarted(session, parsed.data.turn.id);
    }
  }
  const deltas = session.translator.translateEvent(
    toProviderRuntimeEvent(method, params),
  );
  const quotaFailure = deltas.some(
    (delta) =>

The thread list’s active-goal count is derived from goal state independently of turn activity. Consequently an active goal snapshot is not proof that a continuation was scheduled:

apps/server/src/services/threads/thread-runtime-display.ts:371

  const goal = extractThreadTimelineGoal(events);

  return {
    activeGoalCount: goal?.status === "active" ? 1 : 0,
    activePlanModeCount: activePlanTurn === null ? 0 : 1,
    activePlanTurnId: activePlanTurn?.turnId ?? null,

The server’s explicit completion-time continuation here concerns environment-directory switching, not a goal watchdog:

apps/server/src/internal/events.ts:502

        const continuation =
          event.status === "completed" &&
          turnCompleted.nextStatus === "idle" &&
          turnCompleted.isRootTurnCompletion &&
          !wasTurnManuallyStopped(deps, { threadId: entry.threadId, turnId })
            ? findEnvironmentDirectoryContinuation(deps, {
                threadId: entry.threadId,
                turnId,
              })
            : null;

Runtime idle-session bookkeeping observes turn lifecycles, not goal completion. Delayed idle reaping is a further diagnostic candidate, not a verified cause; the short bridge probe does not execute the daemon reaper:

packages/agent-runtime/src/runtime.ts:851

  function observeProviderSessionIdleState(event: ThreadEvent): void {
    if (event.type === "turn/started") {
      pendingTurnStarts.delete(event.threadId);
      markProviderSessionNotIdle(event.threadId);
      return;
    }

    if (event.type === "turn/completed") {
      pendingTurnStarts.delete(event.threadId);
      markHostedProviderSessionIdle(event.threadId);
      return;
    }

    if (event.type === "provider/error" && event.willRetry !== true) {
      pendingTurnStarts.delete(event.threadId);

Source permalinks and excerpt line ranges were resolved against the recorded commit, not a moving branch.

6. Proposed fix / next experiment

No production fix is justified yet. Capture a sanitized native trace with a unique thread/turn identity, BB and Codex versions, goal/budget state, turn/completed, any subsequent turn/started, child-process liveness, host runtime delivery, queue/interaction state, and idle-reaper activity. Replay the failing ordering through the bridge and server before choosing an owner. If the native process never emits a next turn, test its scheduler in isolation; if it emits a next turn that BB drops, add a regression at that proven boundary. A BB watchdog added now would be a policy decision and could duplicate native continuation or override legitimate pause/interaction/budget state.

7. Pull-request check

Issue cross-reference metadata and an open-PR search for the numeric issue ID returned no linked open pull request at investigation time. No PR branch or patch was checked out or executed. No fix PR was opened because no focused regression demonstrates the native failure on trusted main.

8. Related issues

The provider-independent composer-goal feature request is a separate scope. No external links or instructions supplied by issue content were followed.

9. Verification

The same investigator repeated the final diagnostic in CHECKOUT_B, a second clean detached checkout at efd10ce0b0d0785148e1bc7e375f51e00d3b5b85, with fresh temporary case workspaces and child processes. The exact command above executed uncached: two tests passed, including the native-continuation control. CHECKOUT_A’s first focused run also passed both cases. The broader owner-boundary run in CHECKOUT_A passed 96 tests across five files: the probe, bridge zero-work turns, bridge protocol conformance, delta translation, and turn-response translation.

During probe development, an unnecessary notification-name assertion and an invalid synthetic request ID were corrected before the successful runs; these were probe mistakes, not product failures. No production file was changed. The second run required no report correction and supports the bounded, unconfirmed verdict, not an independent native reproduction.

10. Appendix

In accordance with the reports repository’s publishing rules, test source and sanitized output are inline only. Local evidence files remain outside the public repository.

First clean-checkout probe output
bb-plugin-provider-codex:test: cache miss, executing 95bd95db030d3808
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: > bb-plugin-provider-codex@0.1.0 test CHECKOUT_A/plugins/provider-codex
bb-plugin-provider-codex:test: > vitest run --config vitest.config.ts "src/bridge/bridge.goal-continuation-probe.test.ts"
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  RUN  v4.1.1 CHECKOUT_A/plugins/provider-codex
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.goal-continuation-probe.test.ts (2 tests) 602ms
bb-plugin-provider-codex:test:    ✓ preserves active goal state and forwards native continuation when supplied: false  312ms
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  Test Files  1 passed (1)
bb-plugin-provider-codex:test:       Tests  2 passed (2)
bb-plugin-provider-codex:test:    Start at  14:56:02
bb-plugin-provider-codex:test:    Duration  2.45s (transform 1.57s, setup 0ms, import 1.73s, tests 602ms, environment 0ms)
bb-plugin-provider-codex:test: 
Second clean-checkout probe output
bb-plugin-provider-codex:test: cache miss, executing 3e40b79755a8fc9b
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: > bb-plugin-provider-codex@0.1.0 test CHECKOUT_B/plugins/provider-codex
bb-plugin-provider-codex:test: > vitest run --config vitest.config.ts "src/bridge/bridge.goal-continuation-probe.test.ts" "--silent=false"
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  RUN  v4.1.1 CHECKOUT_B/plugins/provider-codex
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/bridge.goal-continuation-probe.test.ts > preserves active goal state and forwards native continuation when supplied: false
bb-plugin-provider-codex:test: {"providerContinues":false,"completedTurns":1,"goalStatus":"active","clientTurnRequests":1,"observationMs":250}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/bridge.goal-continuation-probe.test.ts > preserves active goal state and forwards native continuation when supplied: true
bb-plugin-provider-codex:test: {"providerContinues":true,"completedTurns":2,"goalStatus":"active","clientTurnRequests":1,"observationMs":250}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.goal-continuation-probe.test.ts (2 tests) 605ms
bb-plugin-provider-codex:test:    ✓ preserves active goal state and forwards native continuation when supplied: false  313ms
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  Test Files  1 passed (1)
bb-plugin-provider-codex:test:       Tests  2 passed (2)
bb-plugin-provider-codex:test:    Start at  14:56:31
bb-plugin-provider-codex:test:    Duration  2.34s (transform 1.47s, setup 0ms, import 1.62s, tests 605ms, environment 0ms)
bb-plugin-provider-codex:test: 
96-test relevant-suite output
bb-plugin-provider-codex:test: cache miss, executing c3e29e7b6d607833
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: > bb-plugin-provider-codex@0.1.0 test CHECKOUT_A/plugins/provider-codex
bb-plugin-provider-codex:test: > vitest run --config vitest.config.ts "src/bridge/bridge.goal-continuation-probe.test.ts" "src/bridge/bridge.zero-work-turn.test.ts" "src/bridge/bridge.conformance.test.ts" "src/delta-translation.test.ts" "src/translator.turn-response.test.ts" "--silent=false"
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  RUN  v4.1.1 CHECKOUT_A/plugins/provider-codex
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/translator.turn-response.test.ts (3 tests) 10ms
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/delta-translation.test.ts (67 tests) 59ms
bb-plugin-provider-codex:test: stdout | src/bridge/bridge.goal-continuation-probe.test.ts > preserves active goal state and forwards native continuation when supplied: false
bb-plugin-provider-codex:test: {"providerContinues":false,"completedTurns":1,"goalStatus":"active","clientTurnRequests":1,"observationMs":250}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test: stdout | src/bridge/bridge.goal-continuation-probe.test.ts > preserves active goal state and forwards native continuation when supplied: true
bb-plugin-provider-codex:test: {"providerContinues":true,"completedTurns":2,"goalStatus":"active","clientTurnRequests":1,"observationMs":250}
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.goal-continuation-probe.test.ts (2 tests) 604ms
bb-plugin-provider-codex:test:    ✓ preserves active goal state and forwards native continuation when supplied: false  315ms
bb-plugin-provider-codex:test: stdout | src/bridge/bridge.conformance.test.ts > passes the canonical protocol suite against supervised fake app-server children
bb-plugin-provider-codex:test: codex bridge conformance:
bb-plugin-provider-codex:test: pass    rpc/unknown-method
bb-plugin-provider-codex:test: pass    rpc/invalid-params
bb-plugin-provider-codex:test: pass    rpc/non-json-ignored
bb-plugin-provider-codex:test: pass    rpc/response-not-request
bb-plugin-provider-codex:test: pass    handshake/initialize
bb-plugin-provider-codex:test: pass    skills/configure-declared
bb-plugin-provider-codex:test: pass    commands/list-declared
bb-plugin-provider-codex:test: pass    session/start-identity
bb-plugin-provider-codex:test: pass    session/start-identity-announced
bb-plugin-provider-codex:test: pass    turn/lifecycle
bb-plugin-provider-codex:test: pass    events/schema-valid
bb-plugin-provider-codex:test: pass    item/opens-before-delta
bb-plugin-provider-codex:test: pass    stop/release-not-interrupted
bb-plugin-provider-codex:test: pass    session/resume-identity
bb-plugin-provider-codex:test: pass    session/resume-id-uniqueness
bb-plugin-provider-codex:test: pass    session/fork-identity
bb-plugin-provider-codex:test: pass    session/fork-identity-announced
bb-plugin-provider-codex:test: pass    turn/settles-without-activity
bb-plugin-provider-codex:test: pass    recovery/session-archived
bb-plugin-provider-codex:test: pass    session/threads-independent
bb-plugin-provider-codex:test: pass    stop/interrupt-settles-before-result
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.conformance.test.ts (1 test) 837ms
bb-plugin-provider-codex:test:    ✓ passes the canonical protocol suite against supervised fake app-server children  836ms
bb-plugin-provider-codex:test:  ✓ |bb-plugin-provider-codex| src/bridge/bridge.zero-work-turn.test.ts (23 tests) 12391ms
bb-plugin-provider-codex:test:    ✓ settles a prompt the app-server accepts without any turn activity  308ms
bb-plugin-provider-codex:test:    ✓ keeps one lifecycle when turn/started lags the turn/start response past the grace window  894ms
bb-plugin-provider-codex:test:    ✓ interrupts a response-opened turn once codex reports it started  385ms
bb-plugin-provider-codex:test:    ✓ waits for a compaction turn that starts long after the empty compact response  1052ms
bb-plugin-provider-codex:test:    ✓ settles a compaction when codex reports the thread idle without starting a turn  458ms
bb-plugin-provider-codex:test:    ✓ fails a compaction when the app-server exits before its turn starts  473ms
bb-plugin-provider-codex:test:    ✓ settles compaction on idle-before-response  465ms
bb-plugin-provider-codex:test:    ✓ settles compaction on error-before-response  464ms
bb-plugin-provider-codex:test:    ✓ settles compaction on error-without-turn  456ms
bb-plugin-provider-codex:test:    ✓ bounds interrupt retry for 'native activation before stop'  490ms
bb-plugin-provider-codex:test:    ✓ bounds interrupt retry for 'second rejection'  401ms
bb-plugin-provider-codex:test:    ✓ bounds interrupt retry for 'activation timeout'  5050ms
bb-plugin-provider-codex:test:    ✓ binds delayed tool work to the accepted request on consecutive turns  759ms
bb-plugin-provider-codex:test: 
bb-plugin-provider-codex:test:  Test Files  5 passed (5)
bb-plugin-provider-codex:test:       Tests  96 passed (96)
bb-plugin-provider-codex:test:    Start at  14:56:36
bb-plugin-provider-codex:test:    Duration  14.29s (transform 7.05s, setup 0ms, import 8.05s, tests 13.90s, environment 0ms)
bb-plugin-provider-codex:test: 

Test-authoring gate: this probe checks continuation-event delivery and retained goal state through the production bridge. Its distinct risk is losing a provider-opened turn after another turn closes, which the existing goal-payload translation test alone does not exercise. It introduces no production injection hook. Its scripted scheduler cannot validate native scheduling; the verdict explicitly preserves that limitation.

Read-only investigation used GitHub issue properties/comments/cross-references, open-PR search, trusted-main source inspection and history, and commit-resolved code links. Execution used frozen installs, Turbo builds, Turbo provider tests, and formatting of the local probe. Issue content was treated only as untrusted claims. No scripts, branches, URLs, or instructions supplied by the issue were executed or followed.

AGENT GENERATED