Skip to content

refactor(agents): migrate deprecated sync loader functions to non-deprecated alternatives#1083

Merged
zbigniewsobiecki merged 1 commit intodevfrom
feature/migrate-sync-agent-loaders
Apr 4, 2026
Merged

refactor(agents): migrate deprecated sync loader functions to non-deprecated alternatives#1083
zbigniewsobiecki merged 1 commit intodevfrom
feature/migrate-sync-agent-loaders

Conversation

@aaight
Copy link
Copy Markdown
Collaborator

@aaight aaight commented Apr 4, 2026

Summary

Migrates away from deprecated loadAgentDefinition(), getKnownAgentTypes(), and loadAllAgentDefinitions() functions in src/agents/definitions/loader.ts.

  • Introduces loadBuiltinDefinition() and getBuiltinAgentTypes() — non-deprecated sync YAML-only helpers for legitimate sync contexts (seed scripts, reset operations, internal fallbacks)
  • Migrates all external callers (API routers + seed script) to the new sync helpers
  • Converts getDefaultTaskPrompt() to async, using resolveAgentDefinition() instead of the deprecated sync loader
  • Removes loadAgentDefinition(), getKnownAgentTypes(), and loadAllAgentDefinitions() entirely
  • Updates ~6 test files with renamed mocks and imports

Files Changed

  • src/agents/definitions/loader.ts — Added loadBuiltinDefinition / getBuiltinAgentTypes; deprecated functions removed
  • src/agents/definitions/index.ts — Updated barrel exports
  • src/agents/prompts/index.ts — Made getDefaultTaskPrompt async, uses resolveAgentDefinition
  • src/api/routers/agentDefinitions.ts — Migrated to new sync helpers, removed // Intentional: comments
  • src/api/routers/agentTriggerConfigs.ts — Migrated to new sync helpers
  • src/db/seeds/seedAgentDefinitions.ts — Migrated to new sync helpers
  • src/api/routers/agentConfigs.ts — Awaits getDefaultTaskPrompt
  • 6 test files — Renamed mocked function names to match new exports

Test plan

  • TypeScript type check passes (npm run typecheck)
  • All 7273 unit tests pass (npm test)
  • Lint check passes (npm run lint:fix)
  • Zero remaining deprecated references in src/ confirmed with grep

Key decisions

  • Kept isBuiltinAgentType() (not deprecated) — already called getKnownAgentTypes() internally, now updated to call getBuiltinAgentTypes()
  • getDefaultTaskPrompt signature change (sync → async) is the only breaking API change; the single caller in agentConfigs.ts was updated to await the result
  • Seed scripts and reset operations legitimately need sync YAML-only access, so clean non-deprecated helpers were introduced rather than forcing everything async

Trello card: https://trello.com/c/69ce1cabafca047d2501437e

🤖 Generated with Claude Code

🕵️ claude-code · claude-sonnet-4-6 · run details

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 4, 2026

Codecov Report

❌ Patch coverage is 90.47619% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/agents/prompts/index.ts 33.33% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@nhopeatall nhopeatall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

LGTM — Clean mechanical rename that removes deprecated sync loader functions, replaces them with clearly-named loadBuiltinDefinition / getBuiltinAgentTypes helpers, and correctly converts getDefaultTaskPrompt to async. All callers are updated, tests pass, and zero deprecated references remain in the codebase.

Code Issues

Nitpick

  • src/agents/definitions/loader.ts:80 — The JSDoc for isBuiltinAgentType still says "to avoid repeated deprecated-function calls" but the function it wraps (getBuiltinAgentTypes()) is no longer deprecated. The phrasing is a leftover from when it wrapped the deprecated getKnownAgentTypes(). Consider updating to e.g. "Wraps getBuiltinAgentTypes().includes() for convenience at each call site."

🕵️ claude-code · claude-opus-4-6 · run details

@zbigniewsobiecki zbigniewsobiecki merged commit b9477fd into dev Apr 4, 2026
9 checks passed
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.

3 participants