Skip to content

Fix: Add explicit error when delegate expert not found#9

Merged
FL4TLiN3 merged 3 commits intomainfrom
fix/delegate-expert-not-found-error
Dec 4, 2025
Merged

Fix: Add explicit error when delegate expert not found#9
FL4TLiN3 merged 3 commits intomainfrom
fix/delegate-expert-not-found-error

Conversation

@FL4TLiN3
Copy link
Contributor

@FL4TLiN3 FL4TLiN3 commented Dec 4, 2025

Summary

  • Add explicit check when delegate expert is not found in experts map
  • Provides clear error message instead of cryptic undefined error

Test plan

  • Typecheck passes
  • Unit tests pass
  • E2E tests pass

Note

Add explicit error when a delegate expert is not found during skill manager initialization; update review report and changeset metadata.

  • Runtime:
    • Improve error handling in packages/runtime/src/skill-manager/helpers.ts by throwing Error("Delegate expert \"{name}\" not found in experts") when a delegate is missing during getSkillManagers initialization.
  • Docs/Reports:
    • Update CODE_REVIEW_REPORT.md to mark the issue as fixed and add commit cc23849.
  • Release:
    • Add changeset "@perstack/runtime": patch in .changeset/fix-delegate-expert-not-found.md.

Written by Cursor Bugbot for commit 3ea1452. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Dec 4, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
perstack Ready Ready Preview Comment Dec 4, 2025 1:45am

@FL4TLiN3 FL4TLiN3 merged commit cd5dbb1 into main Dec 4, 2025
8 checks passed
@FL4TLiN3 FL4TLiN3 deleted the fix/delegate-expert-not-found-error branch December 4, 2025 01:46
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

This PR is being reviewed by Cursor Bugbot

Details

You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

const delegate = experts[delegateExpertName]
if (!delegate) {
throw new Error(`Delegate expert "${delegateExpertName}" not found in experts`)
}
Copy link

Choose a reason for hiding this comment

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

Bug: Resource leak when delegate expert not found

When a delegate expert is not found, the error is thrown after MCP and interactive skill managers have already been initialized (via initSkillManagersWithCleanup calls at lines 59 and 68). Since the error escapes from within the .map() callback without any cleanup, these already-initialized managers are never closed. This can cause resource leaks such as unclosed MCP server connections. The allManagers array contains initialized managers that need close() called on them before throwing.

Fix in Cursor Fix in Web

@github-actions github-actions bot mentioned this pull request Dec 4, 2025
@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

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

Files with missing lines Patch % Lines
packages/runtime/src/skill-manager/helpers.ts 0.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

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