feat(agents): handle TASK_FAILED events to prevent DAG deadlocks#182
Merged
feat(agents): handle TASK_FAILED events to prevent DAG deadlocks#182
Conversation
Security Scan Results
Recommendations
Workflow: Security Scanning |
5ad6b7f to
0fb3ed2
Compare
✅ Dependency Audit
See the Security tab for detailed findings. Workflow: Dependency Audit |
When a subordinate task fails, the parent Lead Agent previously had no mechanism to record the failure as a terminal event. Pending downstream tasks would remain in WAITING state forever — the DAG deadlocked with no recovery path. Changes: - Add ActionType::TASK_FAILED to KIM protocol (core/message.hpp) - Add recordFailure(), hasFailures(), getFailureCount(), getFailureMessages() to CoordinationState — failures count toward the total-received threshold, so isComplete() fires correctly - Add processSubordinateFailure() virtual hook to LeadAgentBase with default implementation that records the failure and transitions to ERROR state when all results (success + failure) are received - Dispatch ActionType::TASK_FAILED messages in LeadAgentBase::processMessage() before the normal result path (prevents false WAITING stall) - TaskAgent now sends action_type = TASK_FAILED instead of a plain "response" message on exception, so parent Lead Agents receive the correct signal - ModuleLeadAgent::synthesizeResults() and ComponentLeadAgent::synthesizeComponentResult() return descriptive error strings when current state is ERROR - 11 new unit tests: 7 CoordinationState failure-tracking tests, 4 ModuleLeadAgent DAG-deadlock-prevention tests Closes #87 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rewrite multi-line lambda in emplace_back to single-line form that clang-format-18 (CI) and clang-format-22 (local) both accept. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CI Summary
|
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
ActionType::TASK_FAILEDto the KIM protocol so subordinate agents can explicitly signal failure to their parentCoordinationStatenow tracks failures separately viarecordFailure()— failures count toward the all-received threshold so deadlocked WAITING states are impossibleLeadAgentBase::processMessage()dispatchesTASK_FAILEDmessages to a newprocessSubordinateFailure()hook (with default implementation that transitions to ERROR)TaskAgentsetsaction_type = TASK_FAILEDinstead of plainresponsewhen an exception occurs during command executionsynthesizeResults()/synthesizeComponentResult()return descriptive error messages when in ERROR stateTest plan
CoordinationStatefailure-tracking tests (Category 7 intest_coordination_state.cpp)ModuleLeadAgentDAG-deadlock-prevention tests intest_module_lead_agent.cpp-fsyntax-onlywith no errorsspdlog/fmt/fmt.hnot found — this is fixed onmain(commitfix(cmake): split combined target_link_libraries and fix spdlog visibility) but not yet merged into this branchCloses #87
🤖 Generated with Claude Code