Skip to content

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

Draft
lifelmy wants to merge 1 commit into
CodebuffAI:mainfrom
lifelmy:agent-tasks/1018
Draft

fix(sdk): skip plugin code during agent discovery#1026
lifelmy wants to merge 1 commit 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

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.

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)

1 participant