#7502 · Scheduler history survives Claude session forks
Verdict: PARTIALLY REPRODUCED · Root-cause confidence: medium · reproduction label: partial-repro
1. TL;DR
The issue describes hidden side conversations repeating work scheduled in their parent Claude conversation. A direct test of bb's real fork worker and the installed Anthropic SDK confirms that a fork after a synthetic scheduler operation contains both the original CronCreate tool call and its matching result, unchanged. A fork before that operation does not contain them. The bridge then resumes the copied session, which is a plausible route for a native scheduler to restore the same work. This investigation did not start a Claude scheduler or observe any timer fire, so transcript copying is established but duplicate execution and its exact restoration mechanism remain unverified.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Side chats use the general thread-fork route and are hidden. | Verified statically | plugins/side-chat/server.ts:107 constructs a hidden fork and calls the SDK. |
| Forking preserves scheduler tool history. | Verified dynamically | Two clean checkouts; real worker, real SDK, no mocks; full and after-result forks each retain one call/result pair. |
| The provider resumes the copied session. | Verified statically | plugins/provider-claude-code/src/bridge/bridge.ts:2543 and plugins/provider-claude-code/src/bridge/sdk-session.ts:264. |
| Each fork restores a live scheduler and performs duplicate external effects. | Unverified | No authenticated scheduler process was started. A preserved tool call is not proof of a restored timer. |
| Deleted schedules stay deleted, and the reported process lifetimes/fire counts are accurate. | Unverified | No access to reporter runtime data; the synthetic fixture does not exercise deletion or timer expiry. |
| The isolated context-usage probe can also fire a task. | Unverified | plugins/provider-claude-code/src/bridge/context-usage-probe.ts:28 resumes with forkSession enabled, but does not establish that a scheduler fires. |
3. Environment
- Public repository get-bb/bb; origin/main base
88cf8f644c81fca797ad80bc31bb36a61ce5cc9b; clean detached checkouts namedbaseandverify. - Linux 4.19.0-gvisor x86_64; Node v22.19.0; locked @anthropic-ai/claude-agent-sdk 0.3.318.
- No bb development server, host daemon, browser, authenticated provider session, or listening port was started. The test creates a unique temporary config directory on every invocation and deletes it in a finally block.
- Frozen installs succeeded in both checkouts. The first broad build exposed a missing built Plugin SDK prerequisite; the prescribed SDK build/build:types task succeeded before the broad build was retried. Final build/test status is recorded in the appendix artifact.
4. Minimal reproduction
- Use the trusted base and frozen dependency graph, then download this report's independently authored diagnostic harness. The commands below do not use the issue's suggested script or the reporter's files.
- Run the harness in each clean checkout. It creates four synthetic transcript messages, forks the actual bb provider worker three ways, reads the new transcript files, and removes its temporary directory.
- Compare the output with the expected observations. No assertion claims a native scheduler was restored.
BASE=88cf8f644c81fca797ad80bc31bb36a61ce5cc9b REPRO_DIR=$(mktemp -d) git clone --no-checkout https://github.com/get-bb/bb.git "$REPRO_DIR/base" git -C "$REPRO_DIR/base" checkout --detach "$BASE" cd "$REPRO_DIR/base" pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk pnpm exec turbo run build curl --fail --output "$REPRO_DIR/fork-history.mjs" https://get-bb.github.io/reports/issues/7502/repro/fork-history.mjs node "$REPRO_DIR/fork-history.mjs" "$REPRO_DIR/base" git clone --no-checkout https://github.com/get-bb/bb.git "$REPRO_DIR/verify" git -C "$REPRO_DIR/verify" checkout --detach "$BASE" cd "$REPRO_DIR/verify" pnpm install --frozen-lockfile --prefer-offline node "$REPRO_DIR/fork-history.mjs" "$REPRO_DIR/verify"
Expected observation: full and after-result forks preserve one scheduler tool call/result pair; before-task preserves none; every fork gets a distinct session ID; source bytes remain unchanged.
Actual first run (exit 0):
full: distinct_session=true CronCreate_calls=1 matching_results=1 source_unchanged=true after-result: distinct_session=true CronCreate_calls=1 matching_results=1 source_unchanged=true before-task: distinct_session=true CronCreate_calls=0 matching_results=0 source_unchanged=true PASS: real bb fork worker and installed SDK copied scheduler tool history; no scheduler process was started.
Behavioral expectation from the bug report: a child must not execute the parent's schedule. That expectation is not tested by this diagnostic. The script is an observational reproduction of the persistence path, not a failing regression test for timer ownership.
Artifact: fork-history.mjs. Full source:
import assert from "node:assert/strict";
import { randomUUID } from "node:crypto";
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join, resolve } from "node:path";
import { pathToFileURL } from "node:url";
const checkout = resolve(process.argv[2] ?? ".");
const { forkClaudeSession } = await import(
pathToFileURL(join(checkout, "plugins/provider-claude-code/src/bridge/session-fork.ts"))
);
const configDirectory = await mkdtemp(join(tmpdir(), "bb-7502-history-"));
try {
const transcriptDirectory = join(configDirectory, "projects", "-tmp-synthetic");
await mkdir(transcriptDirectory, { recursive: true });
const sourceSessionId = randomUUID();
const messageIds = Array.from({ length: 4 }, () => randomUUID());
const callId = "synthetic-scheduler-call";
const taskInput = {
cron: "13 * * * *",
prompt: "Synthetic diagnostic reminder",
recurring: true,
};
const messages = [
{ type: "user", message: { role: "user", content: "Synthetic history fixture" } },
{
type: "assistant",
message: {
id: "synthetic-assistant-message",
type: "message",
role: "assistant",
model: "synthetic-model",
content: [{ type: "tool_use", id: callId, name: "CronCreate", input: taskInput }],
stop_reason: "tool_use",
stop_sequence: null,
usage: { input_tokens: 1, output_tokens: 1 },
},
},
{
type: "user",
message: {
role: "user",
content: [{ type: "tool_result", tool_use_id: callId, content: JSON.stringify({ id: "synthetic-task", ...taskInput }) }],
},
},
{ type: "assistant", message: { role: "assistant", content: [{ type: "text", text: "Synthetic fixture complete" }] } },
];
const sourceEntries = messages.map((message, index) => ({
...message,
uuid: messageIds[index],
parentUuid: index === 0 ? null : messageIds[index - 1],
sessionId: sourceSessionId,
timestamp: new Date().toISOString(),
isSidechain: false,
}));
const sourcePath = join(transcriptDirectory, `${sourceSessionId}.jsonl`);
const sourceText = sourceEntries.map(entry => JSON.stringify(entry)).join("\n") + "\n";
await writeFile(sourcePath, sourceText, { mode: 0o600 });
const forkIds = new Set();
for (const [mode, upToMessageId, expectedCalls] of [
["full", undefined, 1],
["after-result", messageIds[3], 1],
["before-task", messageIds[0], 0],
]) {
const forkId = await forkClaudeSession({ configDirectory, sourceSessionId, upToMessageId });
assert.notEqual(forkId, sourceSessionId);
assert.ok(!forkIds.has(forkId));
forkIds.add(forkId);
const entries = (await readFile(join(transcriptDirectory, `${forkId}.jsonl`), "utf8"))
.trim().split("\n").map(line => JSON.parse(line));
const blocks = entries.flatMap(entry => Array.isArray(entry.message?.content) ? entry.message.content : []);
const schedulerCalls = blocks.filter(block => block.type === "tool_use" && block.name === "CronCreate");
const schedulerResults = blocks.filter(block => block.type === "tool_result" && block.tool_use_id === callId);
assert.equal(schedulerCalls.length, expectedCalls);
assert.equal(schedulerResults.length, expectedCalls);
if (expectedCalls) assert.deepEqual(schedulerCalls[0].input, taskInput);
assert.equal(await readFile(sourcePath, "utf8"), sourceText);
console.log(`${mode}: distinct_session=true CronCreate_calls=${schedulerCalls.length} matching_results=${schedulerResults.length} source_unchanged=true`);
}
console.log("PASS: real bb fork worker and installed SDK copied scheduler tool history; no scheduler process was started.");
} finally {
await rm(configDirectory, { recursive: true, force: true });
}
5. Root cause
Verified boundary: plugins/provider-claude-code/src/bridge/session-fork.ts:83 supplies a custom SessionStore to the SDK's forkSession. The store reads the source transcript and serializes the entries produced by that SDK into a new exclusive-create transcript file. There is no bb-specific scheduler-state separation at this boundary. The actual SDK preserved the synthetic CronCreate call and result in both post-operation forks.
const result = await forkSession(args.sourceSessionId, {
sessionStore: createProjectTranscriptStore(args.configDirectory),
...(args.upToMessageId !== undefined
? { upToMessageId: args.upToMessageId }
: {}),
});
Verified continuation: plugins/provider-claude-code/src/bridge/bridge.ts:2543 attaches the new provider session ID; plugins/provider-claude-code/src/bridge/sdk-session.ts:264 persists the session and passes that ID as resume. Side chat is one caller, rather than a separate transcript implementation.
Remaining causal gap: if the native Claude runtime reconstructs active timers from this copied history or related session state, independently resumed children can own the same work. That conditional mechanism fits the report, but this test does not identify which native records own scheduling, demonstrate reconstruction, or rule out SDK-side fork handling that distinguishes history from active timers. Merely finding CronCreate in a transcript is not sufficient evidence of the full bug.
6. Proposed fix / next experiment
First run an isolated, authorized native-provider experiment with a harmless in-memory notification, then observe the parent and two children through a real timer tick. Establish whether active tasks are stored separately or reconstructed from tool events; check deletion, resume, and checkpoint forks. A valid regression must fail on the unchanged provider and pass after removing inherited executable scheduling state while retaining useful conversation history.
Do not blindly strip all scheduler tool messages: doing so may damage tool-result pairing or context without affecting the real scheduler store. Disabling scheduling for every fork would also prevent legitimate new tasks in that fork and needs a deliberate behavior decision. No production patch or pull request is safe under this autopilot's simple-fix gate: live duplication has not been reproduced and no pre-fix failing behavioral regression exists.
7. Verification
The same agent repeated the diagnostic in a second clean detached checkout at the exact same trusted commit, using a separate frozen install and a newly created temporary config directory. This is a second run, not an independent review. The second command was node fork-history.mjs "$REPRO_DIR/verify"; exit status 0. No correction to the first run's observation was needed; the verdict remains deliberately partial.
full: distinct_session=true CronCreate_calls=1 matching_results=1 source_unchanged=true after-result: distinct_session=true CronCreate_calls=1 matching_results=1 source_unchanged=true before-task: distinct_session=true CronCreate_calls=0 matching_results=0 source_unchanged=true PASS: real bb fork worker and installed SDK copied scheduler tool history; no scheduler process was started.
Logs: first run, second run, build and existing-test results.
8. Related issues and pull requests
A repository search for the native scheduler tool found only this issue at investigation time. The issue's connected/cross-reference metadata and an open pull-request search for 7502 returned no pull request. No linked pull-request code was fetched, checked out, or executed.
9. Appendix
Priority High reflects the reported possibility of repeated unattended external side effects; this report does not independently confirm such effects. Effort Medium reflects the unverified native restoration boundary and the need for a faithful lifecycle regression. Existing classifications were absent; Type, Priority, Effort, and area/plugin labels were filled and read back.
The issue and its links were treated as untrusted claims. No issue-supplied command, patch, test, external URL, or private runtime data was used. Reproduction code was authored from the trusted repository's worker, SessionStore, and test patterns. No dependencies or product files were changed.
Relevant commands beyond the reproduction: git fetch https://github.com/get-bb/bb.git main:refs/remotes/origin/main; git worktree add --detach for each checkout; pnpm exec turbo run build build:types --filter=@get-bb/plugin-sdk; pnpm exec turbo run build; pnpm exec turbo run test --filter=bb-plugin-provider-claude-code -- session-fork.test.ts. Only synthetic test artifacts are published.