Skip to content

[codex] Fix local agent discovery imports#738

Open
brandonkachen wants to merge 3 commits into
mainfrom
jahooma/fix-pasted-text-issues
Open

[codex] Fix local agent discovery imports#738
brandonkachen wants to merge 3 commits into
mainfrom
jahooma/fix-pasted-text-issues

Conversation

@brandonkachen
Copy link
Copy Markdown
Collaborator

@brandonkachen brandonkachen commented May 23, 2026

Summary

Fixes local agent discovery so loading .agents no longer recurses into known non-agent/support directories that can contain executable scripts.

Root Cause

The SDK local agent loader recursively imported every JS/TS-like file under .agents except skills/. That meant unrelated executable scripts, including quarantined skill scripts under directories like skills-quarantine, could run top-level side effects while Freebuff or Codebuff was only trying to discover local agents.

Changes

  • Skip hidden directories, node_modules, scripts, skills, and skills-* during local agent discovery.
  • Preserve the existing behavior for candidate agent files outside those directories instead of using source-level heuristics.
  • Add regression tests proving quarantined skill scripts and support scripts are not imported.
  • Add coverage showing shorthand agent exports still load.

Validation

  • bun test sdk/src/__tests__/load-agents.test.ts
  • bun run --cwd sdk typecheck
  • 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.

2 participants