Skip to content

Bound workspace skill reads and restore discovery rules - #5267

Merged
ymichael merged 1 commit into
mainfrom
bb/workspace-skill-read-bounds
Oct 9, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/workspace-skill-read-bounds

Conversation

@ymichael

@ymichael ymichael commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The combined workspace-context reader introduced in #5257 could read up to 1,000 project skill files concurrently without an aggregate content budget. It also lost excluded-directory filtering and exact-case filename matching on case-insensitive filesystems, and checked containment only when reading individual files. Command lookup unnecessarily read .bb/AGENTS.md, allowing an invalid instructions file to break the command catalog.

What changed

  • Keep the combined RPC and supply read policy from the server: 1,000 directories, 10 MiB per file, and 32 MiB total JSON-encoded project-skill content. The aggregate allowance gives several large skills room while bounding retained content; it is a pragmatic starting policy, not a benchmark-derived optimum. Metadata, shared skill discovery, and workspace instructions are outside this content budget, so it is not a whole-response cap.
  • Read skill files sequentially into bounded buffers, account for JSON escaping, and skip over-budget content with server warnings. Smaller later files can still fit.
  • Restore excluded-directory filtering and exact-case SKILL.md matching. Check root containment before enumeration and file containment before reading; retain symlink skips.
  • Make instruction reads explicit: command lookup skips them, while turn preparation still reads instructions and reports errors.
  • Bump HOST_DAEMON_PROTOCOL_VERSION from 232 to 233 for required request fields and the budget-exceeded result variant; bump SDK declarations to 0.6.35. Document policy and budget scope in the debugging guide.

How you verified

  • Four regression tests failed against the merged implementation for the intended reasons before the fixes: discovery filtering/case, encoded-content budgeting, escaping empty roots, and unnecessary instruction reads.
  • Focused Turbo tests passed: 8 daemon tests, 46 server tests, and 49 contract tests. Coverage includes encoded-size accounting, admitting smaller later skills, oversized files, symlinks, count limits, command lookup, and runtime configuration.
  • pnpm exec turbo run test --filter=@bb/server --filter=@bb/host-daemon --filter=@bb/host-daemon-contract -- src/command-handlers/workspace-agent-context.test.ts test/public/public-project-commands.test.ts test/threads/thread-runtime-config.test.ts test/contract.test.ts
  • pnpm exec turbo run typecheck --filter=@bb/server --filter=@bb/host-daemon --filter=@bb/host-daemon-contract
  • Formatting and git diff --check passed. No live UI or performance benchmark was run for this follow-up.

AGENT GENERATED

@ymichael
ymichael merged commit 6844154 into main Oct 9, 2026
48 checks passed
@ymichael
ymichael deleted the bb/workspace-skill-read-bounds branch October 9, 2026 18:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant