#6240 · Asset trees abort skill staging
Verdict: REPRODUCED · Root-cause confidence: high
1. TL;DR
The daemon rejects a valid skill tree solely because its supporting asset exceeds a fixed 10 MiB budget. A fresh, correctly hashed two-file tree with a 12 MiB supporting file aborts catalog staging even when a healthy skill is included in the same request. The same test with a 2 MiB asset succeeds and both staged skills are readable. The error is rethrown before runtime preparation can complete; the failure does not depend on sending asset text to a model. This was reproduced at the real exported host-staging boundary in two separate clean source checkouts, not in a desktop UI or a real provider turn.
2. Claims vs findings
| Claim | Finding | Evidence |
|---|---|---|
| Asset bytes count toward a fixed per-skill budget. | Verified | The 92-byte entry document plus a 12,582,912-byte ordinary asset fails at validatedTreeEntries; 2,097,152 asset bytes pass. |
| No caches, symlinks, excessive depth, or large file count are necessary. | Verified | The tree has exactly two entries, shallow paths, ordinary modes, valid base64, and a matching content hash. |
| One bad globally sourced tree prevents otherwise healthy skills from finishing staging. | Verified at host boundary | Both requests contain the same healthy source. The 12 MiB case rejects the entire operation rather than returning a partial catalog. |
| All kinds of skill sources have identical failure behavior. | Not true | Source inspection shows workspace-path failures are warned and skipped; required fetched-tree failures are rethrown. User data-directory skills are represented as fetched trees. |
| The outer error identifies the skill and reports actual bytes. | Not true | The exception contains only the limit. The warning separately contains name, source type, and synthetic tree hash, but not actual bytes. |
| The reported macOS desktop installation and its original asset collection fail identically. | Not rerun | No reporter files, real data directory, desktop installation, or provider session were used. |
| A recent release introduced this behavior. | Unverified | This report establishes current trusted-main behavior only. |
3. Environment
- Public repository: get-bb/bb; commit
9eb0c09254a21482c0cfd935e0a9908049333e93; package version 0.47.1. - Linux 4.19.0-gvisor x86_64; Node v22.19.0; pnpm 9.15.0; Vitest 4.1.1.
- Two clean detached worktrees named
baseandverify, created at the same trusted commit. - Each test uses
mkdtempunder the operating-system temporary directory and removes its data directory infinally. - No live server, HTTP port, browser, desktop application, or provider process is used. The transport callback supplies generated tree payloads; real production validation, persistence, catalog staging, and reads run unchanged.
4. Minimal reproduction
- Create a clean checkout at the trusted commit and install the locked dependencies:
git clone https://github.com/get-bb/bb.git bb-6240-base cd bb-6240-base git checkout --detach 9eb0c09254a21482c0cfd935e0a9908049333e93 pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run build:types build --filter=@get-bb/plugin-sdk pnpm exec turbo run build
The first unqualified build encountered an SDK build-order failure in the GitHub plugin. Building the SDK runtime and types first resolved it without changing any source; the subsequent complete build passed all 71 tasks.
- Save this independently authored test as
apps/host-daemon/src/issue-6240.repro.test.ts. It targets an existing exported production boundary and adds no production seam:
import { createHash } from "node:crypto";
import { mkdtemp, readFile, rm } from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import type {
HostDaemonInjectedSkillSource,
HostDaemonSkillTree,
} from "@bb/host-daemon-contract";
import { describe, expect, it } from "vitest";
import { stageInjectedSkillSources } from "./injected-skills.js";
function payload(name: string, assetBytes: number): HostDaemonSkillTree {
const entries = [
{
path: "SKILL.md",
mode: 0o644,
contentBase64: Buffer.from(
`---\nname: ${name}\ndescription: Isolated staging probe\n---\n\nSupporting files remain on disk.\n`,
).toString("base64"),
},
{
path: "assets/support.dat",
mode: 0o644,
contentBase64: Buffer.alloc(assetBytes, 7).toString("base64"),
},
];
const hash = createHash("sha256");
hash.update("bb-skill-tree-v1");
for (const entry of entries) {
const bytes = Buffer.from(entry.contentBase64, "base64");
hash.update("\0file\0");
hash.update(entry.path);
hash.update("\0");
hash.update(entry.mode.toString(8));
hash.update("\0");
hash.update(String(bytes.length));
hash.update("\0");
hash.update(bytes);
}
return { treeHash: hash.digest("hex"), entries };
}
function source(name: string, treeHash: string): HostDaemonInjectedSkillSource {
return {
kind: "tree",
sourceType: "data-dir",
name,
description: "Isolated staging probe",
treeHash,
entryPath: "SKILL.md",
};
}
describe("issue 6240 asset staging", () => {
it.each([2, 12])(
"stages a %i MiB supporting asset alongside a healthy skill",
async (assetMiB) => {
const dataDir = await mkdtemp(path.join(os.tmpdir(), "bb-6240-probe-"));
const healthy = payload("a-healthy", 16);
const assetTree = payload("z-asset", assetMiB * 1024 * 1024);
const trees = new Map([
[healthy.treeHash, healthy],
[assetTree.treeHash, assetTree],
]);
try {
const staged = await stageInjectedSkillSources({
workspacePath: null,
dataDir,
injectedSkillSources: [
source("a-healthy", healthy.treeHash),
source("z-asset", assetTree.treeHash),
],
fetchSkillTree: async (treeHash) => {
const tree = trees.get(treeHash);
if (!tree) throw new Error("Unexpected tree request");
return tree;
},
logger: {
debug() {},
warn(context, message) {
console.log(message, JSON.stringify(context));
},
},
});
expect(staged.skillRoots).toHaveLength(1);
for (const root of staged.skillRoots) {
expect(
await readFile(path.join(root.path, "a-healthy", "SKILL.md"), "utf8"),
).toContain("a-healthy");
expect(
await readFile(path.join(root.path, "z-asset", "assets", "support.dat")),
).toHaveLength(assetMiB * 1024 * 1024);
}
} finally {
await rm(dataDir, { recursive: true, force: true });
}
},
);
});
- Run the focused regression expectation:
pnpm exec turbo run test --filter=@bb/host-daemon -- src/issue-6240.repro.test.ts
Expected: both asset sizes stage successfully, and the healthy skill and supporting asset remain readable. This is the desired large-asset behavior, not a claim that the current intentional budget already promises it.
Actual, first run (exit 1; selected verbatim Vitest lines with the Turbo prefix removed):
✓ stages a 2 MiB supporting asset alongside a healthy skill 41ms × stages a 12 MiB supporting asset alongside a healthy skill 44ms Error: Skill tree exceeds max byte count 10485760 ❯ validatedTreeEntries src/injected-skills.ts:739:13 ❯ writeFetchedTreeToStore src/injected-skills.ts:872:17 Tests 1 failed | 1 passed (2)
The warning message is Failed to pull required injected skill tree. Its structured context identifies the generated z-asset data-directory source. The failing tree totals 12,583,004 decoded bytes; the passing tree totals 2,097,244 bytes. The healthy tree is identical in both cases.
5. Root cause
- The server collector recursively reads ordinary supporting files, not only the entry document. readSkillsRoot registers their hash and returns
kind: "tree"; user skills usesourceType: "data-dir". - The daemon defines a private fixed budget and validatedTreeEntries sums decoded bytes before persisting a received tree:
const MAX_STAGED_SKILL_BYTES = 10 * 1024 * 1024;
const bytes = decodeTreeEntryContent(entry.contentBase64, entry.path);
totalBytes += bytes.length;
if (totalBytes > MAX_STAGED_SKILL_BYTES) {
throw new Error(
`Skill tree exceeds max byte count ${MAX_STAGED_SKILL_BYTES}`,
);
}
- writeFetchedTreeToStore invokes that validator. stageInjectedSkillSources logs then rethrows the error for a required fetched tree, so no usable partial catalog is returned. By contrast, the workspace-path branch warns and skips failures.
- resolveRuntimeSkillConfig returns this staging operation, and ensureEnvironmentOnce awaits it before even looking up an existing runtime entry. Therefore the same global tree can prevent preparation for unrelated threads and for an existing runtime. This last turn-level consequence is source-traced, not independently exercised with a live provider.
The defect is the combination of a fixed resource budget that counts on-disk supporting assets and mandatory whole-catalog failure propagation. It is not a model text-window limit. The current warning already includes the skill name; the thrown error lacks that context, actual size, and any supported override.
6. Proposed fix and automation safety
Decide an owner-controlled resource policy first: bounded/configurable transfer, storage, and staging behavior, or an asset-aware delivery design. Carry any selected budget through the supported server, SDK, CLI, and daemon surfaces, validate it at boundaries, and report the skill identity, measured bytes, configured budget, and recovery action. Preserve path, symlink, hash, depth, and file-count protections. Test both received and local trees, complete-store reuse, aggregate failures, and any size-limit override.
Do not merely increase the private constant, remove the only decoded-tree byte guard without a replacement policy, or swallow every required-tree error. An existing required-pull regression test explicitly requires transport failures to propagate. Distinguishing optional oversized assets from missing required instructions is a product decision, not a safe blanket catch.
No fix PR: removing or configuring this resource safeguard, or changing whether required instruction trees may be omitted, requires a resource/failure-policy decision. Those changes fail the autopilot simple-fix gate. No production code was changed, no fix branch was pushed, and no failing regression test is proposed for merge by itself.
7. Related issues
The issue and related-reference metadata were treated as untrusted evidence only. No linked branch, patch, test, or script was executed. GitHub timeline metadata and an open-PR search found no open pull request linked to #6240 at investigation time. No broader claim about duplicate requests is made.
8. Verification
The same agent created a second clean detached checkout, verify, at 9eb0c09254a21482c0cfd935e0a9908049333e93, ran a separate frozen install, copied only the new test, and repeated the same Turbo command. Fresh temporary test directories were used; no ports were needed. The host test actually ran rather than returning a cached result. This is a repeated check by the same investigator, not independent verification.
pnpm install --frozen-lockfile --prefer-offline pnpm exec turbo run test --filter=@bb/host-daemon -- src/issue-6240.repro.test.ts ✓ stages a 2 MiB supporting asset alongside a healthy skill 41ms × stages a 12 MiB supporting asset alongside a healthy skill 45ms Error: Skill tree exceeds max byte count 10485760 Tests 1 failed | 1 passed (2)
Second-run result: exit 1 for the identical intended regression reason. No report correction was needed. The existing staging suite also passed unchanged:
pnpm exec turbo run test --filter=@bb/host-daemon -- src/injected-skills.test.ts Test Files 1 passed (1) Tests 25 passed | 2 skipped (27)
The trusted main ref was fetched again after testing and remained at the recorded commit. Code links were checked against that commit. This is a nonvisual host-staging bug, so there are no screenshots.
9. Appendix and limits
- Relevant executed commands: frozen install in both clean checkouts; full Turbo build; SDK runtime/type build and full-build retry; focused repro in each checkout; existing staging suite; GitHub issue/property/label reads; trusted-main fetch and source/history inspection; open-linked-PR metadata lookup.
- Raw build and test logs are retained outside the public report repository. Public reproduction code and selected output are inline, as required by the reports repository's privacy/artifact policy.
- Untrusted-data boundary: the issue supplied hypotheses only. Its commands, fixtures, URLs, and desired implementation instructions were not executed or used as trusted code. The test was derived from the trusted source API and hashing contract.
- Not verified: macOS-specific presentation, the reporter's original files, installed-bundle equivalence, a real turn, behavior at other limits, and any configuration feature not present in the inspected path.
- No dependency, stored-data change, public protocol change, or runtime configuration change was made. The test removes each isolated data directory in its cleanup path.