← reports

#6537 · Plugin lifecycle, history limits, and task pagination

Bug High priority High effort plugins cli tasks provider-claude-code

GitHub issue · 2026-10-29 · trusted main 3bacfac9ed69d42392076e5b3da2815bec822cd8

PARTIALLY REPRODUCED · Root-cause confidence: high for the tested paths, not for the entire twenty-item report.

1. TL;DR

The thread-history command reaches an endpoint that silently clamps requested limits to 50: two regression assertions fail on unchanged main, while the 50-entry control passes. Plugin update and install tests confirm the moved-tag refusal and source-replacement refusal; removal clears settings, but the plugin KV value survives removal and reinstall in the direct test. Task-list cursors intentionally reject continuation after a mutation. Two other claims do not reproduce at this base: fresh worktree teardown removes the attempt parent, and plugin CLI output is accepted up to 32 MiB, not 1 MiB. These findings were repeated by the same agent in a second clean checkout; the remaining visual, macOS, historical, and third-party-runtime claims are not established by these tests.

2. Claims vs findings

Numbers identify the original report's items. “Unverified” is not a denial of the reporter's experience. A unit-level reproduction of a mechanism does not establish the historical version, real plugin workload, or macOS behavior.

Item / paraphrased claimFinding on trusted mainEvidence and limits
1. Accepting a rewritten release tag requires destructive reinstall.Partially verifiedThe existing real-git update test confirms the security refusal and unchanged recorded commit. The new lifecycle test confirms settings deletion on removal. No claim that every possible recovery path has been exhaustively excluded.
2. Switching an installed release to a candidate is refused; persistent data may disappear.Mixed: refusal and settings deletion verified; KV deletion refuted for tested pathThe new service-boundary test rejects semver-to-branch installation, removes the plugin, and reinstalls it. Settings are empty after removal; the seeded KV value remains readable after reinstall. The reporter's third-party seat-binding loss remains unexplained.
3. A timed-out service stop leaves the previous plugin unusable.UnverifiedThe update suite passes, including rollback coverage, but no faithful busy-service timeout reproduction was established. Passing other lifecycle tests does not refute this claim.
4. Plugin UI contributions disappear after reinstall until reload.UnverifiedNo browser reproduction or screenshot was captured. Requires an isolated app, mounted contributions, and a reinstall while the client stays open.
5. SDK-created panel tabs and launcher tabs can diverge in identity.Unverified end to end; source supports the concernThe current launcher still looks up a constructed tab ID, and serialization distinguishes omitted params from explicit null. That is not proof of a duplicate-tab user journey.
6. A stale plugin health detail persists after a successful RPC.UnverifiedNo matching failure/recovery sequence or third-party runtime was available.
7. Working RPCs can be absent from CLI discovery.UnverifiedNo reporter plugin was installed or executed. A working route alone does not establish whether its methods were registered with discoverable metadata.
8. Plugin CLI output is restricted to 1 MiB.Refuted at this baseCurrent shared ceiling is 32 × 1024 × 1024 bytes. The existing HTTP command test accepts output at that ceiling, with and without JSON, and rejects the next byte. Both checkout runs pass.
9. A browser-control lease blocks human keyboard input.UnverifiedLinux test environment did not exercise an actual macOS desktop browser and lease. No security/permission policy was changed.
10. Acquire-control requests reject a retired field.Source-supported onlyThe present acquire schema is strict and does not declare that field. Historical compatibility, introduction date, and deprecation policy were not reproduced.
11. Oversized composer contributions are clipped.UnverifiedVisual reproduction requires a running app and representative layout. No synthetic image is supplied as evidence.
12. Environment teardown leaves a worktree attempt parent.Not reproduced for fresh teardownAll 45 worktree host tests pass, including a real process/worktree cleanup test that asserts the worktrees root is empty. Historical orphan directories or core registry loss were not recreated.
13. A historical worktree basename has an unexpected suffix.UnverifiedNo original directory or writer version was available. Current provider paths take an explicit path key; callers should not infer an authoritative thread ID from a basename.
14. Persisted environment readiness can outlive its on-disk directory.UnverifiedNo isolated environment registry deletion/reconciliation experiment was run.
15. A larger thread-history limit still returns only 50.VerifiedWith 60 real persisted entries, requested limits 50, 51, and 200 return 50. The separate paginated history endpoint sees all 60. Two expected assertions fail in each checkout.
16. Human-readable thread logs lack useful time filtering/presentation.UnverifiedNo complete event-log rendering comparison was run; no timestamps or date-filter feature was added.
17. Skill inspection expects an internal ID rather than a name.Source-supported; not established as a bugThe current CLI explicitly declares show <skill-id> and forwards skillId. A human-name resolution enhancement requires a contract and ambiguity policy.
18. Task creation and update use different label options.Source-supported; compatibility/design questionThe update command declares an additive label option. An additive update and initial label assignment are not automatically the same operation.
19. Concurrent task changes invalidate list cursors.Verified, intentional current contractThe existing real-SQLite task-store test invalidates cursors after create, delete, reorder, and update. The complete DB suite passes twice. Changing this needs a consistency-policy decision, not just suppressing an error.
20. Sandboxed macOS GitHub Enterprise TLS fails.UnverifiedNo macOS sandbox, Enterprise endpoint, or matching credential/keychain was used. No credentials were read.

3. Environment

4. Minimal reproduction

From a trusted checkout at the recorded base, run the normal preparation commands, then save the following investigator-authored test at apps/server/test/public/issue-6537-repro.test.ts. It uses the real public routes and database, not a mock of the behavior under test.

pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build:types build:runtime --filter=@get-bb/plugin-sdk
pnpm exec turbo run build
pnpm exec turbo run test --force --filter=@bb/server -- --run test/public/issue-6537-repro.test.ts
import { createPromptHistoryEntry } from "@bb/db";
import { promptHistoryListResponseSchema } from "@bb/server-contract";
import { describe, expect, it } from "vitest";
import { readJson } from "../helpers/json.js";
import { textInput } from "../helpers/prompt-input.js";
import {
  seedHostSession,
  seedProjectWithSource,
  seedThread,
} from "../helpers/seed.js";
import { withTestHarness } from "../helpers/test-app.js";

describe("issue 6537 prompt history limit", () => {
  it.each([50, 51, 200])("honors a requested limit of %i", async (limit) => {
    await withTestHarness(async (harness) => {
      const { host } = seedHostSession(harness.deps);
      const { project } = seedProjectWithSource(harness.deps, {
        hostId: host.id,
      });
      const thread = seedThread(harness.deps, { projectId: project.id });
      for (let sequence = 1; sequence <= 60; sequence += 1) {
        createPromptHistoryEntry(harness.deps.db, {
          projectId: project.id,
          threadId: thread.id,
          scope: "thread",
          requestSequence: sequence,
          input: textInput(`Prompt ${sequence}`),
        });
      }
      const globalResponse = await harness.app.request(
        "/api/v1/prompt-history?limit=200",
      );
      expect(globalResponse.status).toBe(200);
      const globalHistory = promptHistoryListResponseSchema.parse(
        await readJson(globalResponse),
      );
      expect(globalHistory.entries).toHaveLength(60);
      const response = await harness.app.request(
        `/api/v1/threads/${thread.id}/prompt-history?limit=${limit}`,
      );
      expect(response.status).toBe(200);
      const history = await readJson(response);
      console.log(
        JSON.stringify({
          requested: limit,
          stored: globalHistory.entries.length,
          returned: Array.isArray(history) ? history.length : null,
        }),
      );
      expect(history).toHaveLength(Math.min(limit, 60));
    });
  });
});

Expected: With 60 entries, a command advertised as taking a maximum entry count would return 50, 51, and 60 respectively, or explicitly disclose/reject a smaller hard limit. Actual: every request succeeds but only returns 50. The test deliberately states the reporter-facing expectation; failing it does not by itself authorize changing a public contract.

{"requested":51,"stored":60,"returned":50}
{"requested":200,"stored":60,"returned":50}
AssertionError: expected [ …(50) ] to have a length of 51 but got 50
AssertionError: expected [ …(50) ] to have a length of 60 but got 50
Tests  2 failed | 1 passed (3)

Plugin replacement and persistence probe

Add this test inside the existing plugin update service and routes describe block in apps/server/test/services/plugins/plugin-update.test.ts. It reuses only trusted repository fixtures and their real git repositories.

it("issue 6537 checks replacement refusal and removal data boundaries", async () => {
  const tagged = await taggedRepo();
  await service.install(`git:${tagged}@semver:^1.0.0`, { kind: "root" });
  await expect(
    service.install(`git:${tagged}@main`, { kind: "root" }),
  ).rejects.toThrow(/already installed/);
  const api = service.getApi("tagged");
  if (api === undefined) throw new Error("fixture plugin did not load");
  await api.storage.kv.set("seat", "bound");
  setPluginSettingsValues(db, "tagged", {
    fixturePath: JSON.stringify("fixture-value"),
  });
  expect(await service.remove("tagged")).toBe(true);
  expect(getPluginSettingsValues(db, "tagged")).toEqual({});
  expect(getPluginKvValue(db, "tagged", "seat")).toBe(
    JSON.stringify("bound"),
  );
  await service.install(`git:${tagged}@main`, { kind: "root" });
  expect(await service.getApi("tagged")?.storage.kv.get("seat")).toBe(
    "bound",
  );
});
pnpm exec turbo run test --force --filter=@bb/server -- --run test/services/plugins/plugin-update.test.ts test/services/plugins/plugin-cli.test.ts
pnpm exec turbo run test --force --filter=bb-plugin-environment-git-worktree -- --run host.test.ts
pnpm exec turbo run test --force --filter=bb-plugin-tasks -- --run db.test.ts

The plugin suite also includes the existing moved-release-tag test, which mutates a local git tag, checks that the update is unavailable, attempts the update, and verifies that the recorded commit is unchanged. The CLI suite executes plugin HTTP commands at the actual byte ceiling. These are affirmative observations of current behavior, not new failing regression tests for those design gaps.

5. Root cause

Silent history clamp

The CLI advertises a maximum entry count and forwards it. The thread endpoint sets both default and maximum to PROMPT_HISTORY_ENTRY_LIMIT, which is 50. The common parser clamps with Math.min without returning a truncation signal. The new global history endpoint separately allows up to 1,000; the control proves the data exists and the thread route, not insertion or global retention, causes this result.

const limit = parseBoundedPositiveOptionalInteger({
  defaultValue: PROMPT_HISTORY_ENTRY_LIMIT,
  max: PROMPT_HISTORY_ENTRY_LIMIT,
  name: "limit",
  value: query.limit,
});

const parsed = Math.min(
  parseOptionalInteger(args.value, args.name) ?? args.defaultValue,
  args.max,
);

Source transitions and data removal

The update resolver deliberately rejects tag movement. Independently, registration rejects a mismatched source intent. The prescribed removal path deletes schedules, settings, and secret files. Ordinary removal does not call the KV deletion used by a separate retired-builtin handover path. The KV schema has no installed-plugin cascading foreign key, agreeing with the observed retained value. Therefore the report's seat-binding loss cannot be attributed to ordinary KV deletion on current main.

Cursor consistency contract

The tasks store compares the cursor's revision with the current task-list revision and raises stale_cursor on mismatch. The existing mutation coverage verifies all four mutation types. This deliberately prevents continuing a changed ordering; live keyset pagination would need an explicitly different consistency contract.

Two claims that do not hold in the tested current paths

Plugin CLI output is now 32 MiB, with boundary tests. The constant changed in d23374da733792081ef1eb6da91f3961f4e70293 on 2026-10-26. This is not evidence of what binary the reporter actually ran. Worktree removal removes the parent only when empty; the host first removes its completion marker. The real teardown test confirms the root is empty. Leftover nonempty directories, older writers, and a lost registry record need separate experiments.

Other source-only observations: launcher tab identity lookup, params serialization, and strict acquire-control schema. They are explicitly not live reproductions.

6. Proposed fix and safety decision

Split this omnibus into independently scoped changes, preserving the reporter's numbering. First decide whether thread history should disclose the composer-sized cap or offer a separate paginated thread-filtered API; do not globally uncap shared UI history behavior. A future regression should retain the real-route test's above-50 data control. For plugin replacement, design an explicit, atomic source-transition operation that preserves settings, secrets, storage, and rollback state without silently trusting rewritten release tags. For task cursors, choose snapshot-consistent or mutation-tolerant semantics before changing the revision check.

No fix branch or PR: the verified report spans multiple subsystems and includes security checks and public API/consistency-policy decisions, failing the simple-fix guardrails. A broad PR with Fixes #6537 would also falsely imply the unverified macOS and visual reports were resolved. No production code, public schema, dependency, migration, or stored data was changed.

7. Verification

The same agent repeated the reproduction, not an independent reviewer. A second clean detached checkout was created at exactly 3bacfac9ed69d42392076e5b3da2815bec822cd8 under a fresh temporary directory (checkout path anonymized). It received a fresh frozen install, SDK preparation, full build, and only the two investigator-authored test additions shown above. No linked PR branch was checked out.

VERIFY=$(mktemp -d)
git worktree add --detach "$VERIFY/clean" 3bacfac9ed69d42392076e5b3da2815bec822cd8
cd "$VERIFY/clean"
pnpm install --frozen-lockfile --prefer-offline
pnpm exec turbo run build:types build:runtime --filter=@get-bb/plugin-sdk
pnpm exec turbo run build

After placing the inline test and plugin probe in that checkout, rerun all four test commands from section 4. --force was used on the second run to execute tests again rather than reuse a cached test result. Each suite constructs fresh temporary fixtures; no ports or user data are reused.

CheckFirst checkoutSecond clean checkout
Full Turbo build72 tasks successful72 tasks successful
History reproduction2 expected failures, 1 passing control2 expected failures, 1 passing control
Plugin update suite with new persistence probe30 passed30 passed
Plugin CLI output suite12 passed12 passed
Worktree host suite45 passed45 passed
Tasks DB suite20 passed20 passed

Report correction from testing: do not blame KV deletion for the observed third-party data loss, do not present the output cap as 1 MiB on this base, and do not claim the fresh-worktree cleanup failure reproduced. Repeated evidence supports the limited partial verdict, not all twenty items. Code permalinks were checked against the recorded base.

8. Related issues and PR status

No linked open PR appeared in issue timeline metadata or the repository-scoped open-PR search at investigation time. No duplicate issue was established from the small triage sample. This report does not create follow-up issues or claim unrelated reports are duplicates.

9. Appendix

Reproduction additions and full local command logs are retained in the private temporary report workspace and backup, not committed to this public site. The complete test and meaningful output are inline above so the HTML alone is sufficient to repeat the core failure. No screenshots are attached because no visual behavior is claimed reproduced. No external links, commands, code, or requested changes from issue content were executed; issue content was used only as hypotheses.

Triage filled previously absent built-in fields with Bug / High / High, and applied plugins, cli, tasks, and provider-claude-code. High priority reflects major workflow interruption and reported configuration loss; High effort reflects independent lifecycle, UI, environment, browser, CLI, and provider concerns. Existing classifications were absent; no existing values were replaced.