Skip to content

fix(sdk): skip plugin code during agent discovery - #1026

Closed
lifelmy wants to merge 8880 commits into
CodebuffAI:mainfrom
lifelmy:agent-tasks/1018
Closed

fix(sdk): skip plugin code during agent discovery#1026
lifelmy wants to merge 8880 commits into
CodebuffAI:mainfrom
lifelmy:agent-tasks/1018

Conversation

@lifelmy

@lifelmy lifelmy commented Aug 16, 2026

Copy link
Copy Markdown

Summary

  • exclude .agents/plugins trees from local agent-module discovery
  • add a regression test proving a nested MCP CommonJS executable is never imported

Root cause

loadLocalAgents recursively treated every supported JavaScript or TypeScript file under .agents as a candidate agent module and imported it before checking whether it exported an agent definition. Third-party plugin and MCP executables can inspect the host process arguments or call process.exit(), so discovery could terminate the Freebuff CLI.

Closes #1018.

Validation

  • bun test sdk/src/__tests__/load-agents.test.ts --test-name-pattern 'does not execute nested MCP implementation files'
  • bun test sdk/src/__tests__/load-agents.test.ts (34 passed)
  • bun run --cwd sdk typecheck
  • bun run build:sdk
  • git diff --check

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

Labels

bot:triaged Classified by the community triage bot pr:port-candidate Worth porting into the private source tree

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI exits after ~6-10s in interactive TUI; bare freebuff prints "Usage: node mcp_proxy.js" (Crostini/Debian 12, 0.0.148+0.0.149)

3 participants