Skip to content

Plugin agents.configure() instructions over 4096 characters are cut off without any runtime signal #5565

Open

Description

@AntekM

Summary

When a plugin's bb.agents.configure() callback returns instructions longer than 4096 characters, the host keeps the first 4096 characters and drops the rest. There is no error, warning, log line, or plugin status. The agent gets text cut off mid-sentence, and the trailing rules never reach it. The same limit for a tool's static instructions is enforced the other way: registration fails with an error. We expected the dynamic path to surface the overflow too.

Versions and environment

  • bb 0.46.0 (desktop app built from source at desktop-v0.46.0); the code path is identical on main at 411eac54ac16d0a3cb57d1de8396d37564884a73.
  • macOS 15.7.4, Node 22.19.0.
  • Provider-independent (the truncation happens on the server before any provider sees the text).

Steps to reproduce

Smallest repro, at the exact code path, in packages/plugin-sdk/src/internal/:

import { it } from "vitest";
import { normalizePluginAgentConfiguration } from "./host-policy";

it("repro", () => {
  const rules = Array.from({ length: 9 }, (_, i) => `- Rule ${i + 1}: ${"x".repeat(480)}`);
  rules.push("- Last rule: never call grill_round in this panel.");
  const instructions = rules.join("\n");
  const out = normalizePluginAgentConfiguration({
    knownSkillIds: new Set(),
    knownToolIds: new Set(),
    pluginId: "example",
    value: { tools: [], skills: [], instructions },
  });
  process.stderr.write(JSON.stringify({
    inputLength: instructions.length,
    outputLength: out.instructions?.length,
    lastRuleKept: out.instructions?.includes("Last rule"),
  }) + "\n");
});

pnpm exec vitest run <that file> from packages/plugin-sdk.

Expected vs actual

Actual:

{"inputLength":4469,"outputLength":4096,"lastRuleKept":false}

Nothing else is reported: the server stores the sliced text in dynamicInstructions and the plugin stays running.

Expected: the overflow is visible to the plugin author, for example a configure() failure like the static tool-instructions check, a plugin status/log warning naming the plugin and the length, or at least a one-time warning in the plugin's log.

Evidence

What we ruled out

Suggested priority and effort

Low priority, small effort. It affects plugin authors with long dynamic instructions; the workaround is to keep instructions short or move guidance into a thread message. Nothing is lost except the cut-off instructions, but because nothing reports the cut, it can go unnoticed indefinitely.

AGENT GENERATED

Activity

  1. added theissue type on Oct 15, 2026
  2. added
    plugins
    confirmed-repro
    on Oct 15, 2026
  3. bb-slop-cop commented on Oct 15, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

    • Classification: Bug · Priority: Low · Effort: Low · area: plugins.
    • Report: Reproduction and root-cause analysis — REPRODUCED, high confidence; reproduction label: confirmed-repro.
    • Root cause: The shared normalizer slices oversized dynamic guidance and returns success without a diagnostic; both the server and testing host inherit that silence.
    • Evidence: The warning regression fails on unchanged main in two clean checkouts. It passes after the repair; all 407 relevant tests and SDK/server typechecks pass.
    • No safe autopilot PR: Candidate #5568 was withdrawn, not merged. CI requires two SDK version files beyond the tested patch; even without the documentation change, a complete fix exceeds this rule's five-file limit. No release checks were bypassed.

    AGENT GENERATED

  4. markasoftware-tc commented on Nov 2, 2026

    @markasoftware-tc

    Summary

    Additional reproduction for this defect class: the legacy bb.agents.contributeInstructions() path also silently slices contributions at 4096 characters, independently of the agents.configure() normalizer described above. This remains present on current main at 890c8482e1e1b0137484ccc372452250ef2f764c. A fix limited to the normalizer would leave this second path unchanged.

    Versions and environment

    • Code tested: upstream main at 890c8482e1e1b0137484ccc372452250ef2f764c, fetched directly from GitHub.
    • Investigation host: BB 0.48.1, Nix-packaged desktop installation; Ubuntu 24.04.5 LTS, Linux 6.17.0-35-generic, Node v22.23.4.
    • Provider-independent code-path reproduction. No provider session or live plugin installation was used for this reproduction. The same slicing loop is also present in the installed 0.48.1 server bundle.

    Steps to reproduce

    This executes the exact instruction-contribution loop extracted from production source in a small VM harness, with a contribution callback and logger spy. TypeScript annotations are removed with Node's stripTypeScriptTypes; the loop's logic is not rewritten. Run in a scratch directory with Node 22.23.4 and an authenticated gh:

    gh api 'repos/get-bb/bb/contents/apps/server/src/services/threads/thread-runtime-config.ts?ref=890c8482e1e1b0137484ccc372452250ef2f764c' --jq .content | base64 -d > runtime-config.ts
    cat > repro.cjs <<'JS'
    const assert = require('node:assert/strict');
    const fs = require('node:fs');
    const vm = require('node:vm');
    const { stripTypeScriptTypes } = require('node:module');
    
    const source = fs.readFileSync(process.argv[2], 'utf8');
    const start = source.indexOf('for (const contribution of listPluginInstructionContributions()) {');
    const end = source.indexOf('for (const contribution of conditionalConfiguration.dynamicInstructions)', start);
    assert(start >= 0 && end > start);
    const limit = Number(source.match(/const PLUGIN_INSTRUCTION_CONTRIBUTION_MAX_CHARS = (\d+);/)[1]);
    const code = stripTypeScriptTypes(source.slice(start, end));
    for (const [name, input] of [
      ['overflow', 'x'.repeat(limit) + '\nFINAL_RULE_MUST_SURVIVE'],
      ['exact-limit', 'x'.repeat(limit)],
      ['empty', ''],
    ]) {
      const instructionSections = [];
      const warnings = [];
      vm.runInNewContext(code, {
        PLUGIN_INSTRUCTION_CONTRIBUTION_MAX_CHARS: limit,
        listPluginInstructionContributions: () => [{ pluginId: 'repro', provider: () => input }],
        args: { thread: { id: 'thr_repro', projectId: 'proj_repro' } },
        deps: { logger: { warn: (...args) => warnings.push(args) } },
        instructionSections,
      });
      const output = instructionSections[1] ?? '';
      assert.equal(output, input.slice(0, limit));
      assert.equal(warnings.length, 0);
      console.log(JSON.stringify({
        case: name,
        inputLength: input.length,
        outputLength: output.length,
        tailRuleKept: output.includes('FINAL_RULE_MUST_SURVIVE'),
        warnings: warnings.length,
      }));
    }
    JS
    node repro.cjs runtime-config.ts

    Expected vs actual

    Actual stdout, verbatim:

    {"case":"overflow","inputLength":4120,"outputLength":4096,"tailRuleKept":false,"warnings":0}
    {"case":"exact-limit","inputLength":4096,"outputLength":4096,"tailRuleKept":false,"warnings":0}
    {"case":"empty","inputLength":0,"outputLength":0,"tailRuleKept":false,"warnings":0}

    Node additionally prints its standard stripTypeScriptTypes ExperimentalWarning; that warning is from the harness's type stripping, not a BB overflow diagnostic. The overflow case completes successfully, omits FINAL_RULE_MUST_SURVIVE, and makes no logger warning call. The exact-limit and empty cases are negative controls and contain no tail rule in their inputs.

    Expected: overflow should be visible to the plugin author, for example rejection with an actionable error or a diagnostic naming the plugin and input/limit lengths. Silently removing trailing rules should not be reported as an ordinary successful contribution.

    Evidence

    What was ruled out

    • This is not the agents.configure() normalizer: the reproduction calls only the server's separate listPluginInstructionContributions() loop.
    • This is not a provider context-window limit or agent failure to obey instructions: text is already shortened before provider dispatch.
    • Exactly 4096 characters are retained unchanged; empty contributions are skipped.
    • This is a code-path reproduction, not an end-to-end claim about plugin status or provider behavior.

    Authored by GPT-6.

    AGENT GENERATED

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-reproplugins

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions