fix: handle delegation failures gracefully instead of crashing#567
Merged
fix: handle delegation failures gracefully instead of crashing#567
Conversation
When a child delegation run fails (e.g., missing @perstack/base skill, MCP connection failure), the process crashed with exit code 1 because DelegationExecutor.executeSingleDelegation() didn't handle exceptions or non-completed checkpoint statuses from child runs. - Wrap child runFn() in try/catch to handle thrown exceptions - Check child checkpoint status and return error text to parent for non-completed statuses (stoppedByError, stoppedByExceededMaxSteps) - Auto-include @perstack/base in createExpert when LLM omits it - Increase create-expert e2e timeout from 180s to 300s Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DelegationExecutor.executeSingleDelegation()now catches child run exceptions and non-completed statuses, returning error text to the parent coordinator instead of crashing the processcreateExpertcallback auto-includes@perstack/basewhen the LLM omits it from skills, preventingSkillManager.fromExpert()from throwing "Base skill is not defined"Context
The create-expert e2e test was flaky in CI (#563). Root cause: when
createExpertcreates an expert without@perstack/basein skills, delegating to it crashes the entire process because the exception propagates uncaught through the delegation executor.Reproduced locally (3 failures in 25 runs before fix, 0 in 10 after fix).
Test plan
🤖 Generated with Claude Code