fix(network): TASK_PHASE_ERROR handling, CancelTask notification, yaml phase validation#478
Merged
Conversation
✅ Dependency Audit
See the Security tab for detailed findings. Workflow: Dependency Audit |
Security Scan Results
Recommendations
Workflow: Security Scanning |
2d3d8d3 to
bcd095e
Compare
bcd095e to
b9a2db3
Compare
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
GetTaskResultnow returns a distinct, descriptive error message when a task ends inTASK_PHASE_ERROR(infrastructure/unexpected error), differentiating it from other non-completed terminal states.CancelTasksends aCANCEL_TASKKeystoneMessageto the assigned agent via the (optionally-wired)IMessageRouterafter marking a task cancelled, enabling cooperative cancellation. A newsetMessageRouter()method exposes this wiring point.yaml_parser::parseStatusnow validates the phase string against the knownhmas::TaskPhaseenum values using the new publicisKnownPhaseString()/stringToPhase()utilities ininclude/network/task_phase_utils.hpp. Unknown phase strings causeparseTaskSpecto returnstd::nullopt.Changes
include/network/task_phase_utils.hpp: Added publicphaseToString,stringToPhase, andisKnownPhaseStringinline functions (previously only private static methods onHMASCoordinatorServiceImpl).include/network/hmas_coordinator_service.hpp: Added optionalIMessageRouter*member andsetMessageRouter()setter.src/network/hmas_coordinator_service.cpp: ImplementedsetMessageRouter; updatedGetTaskResultandCancelTaskas described above.src/network/yaml_parser.cpp: Added phase validation inparseStatus; catch block broadened tostd::exceptionso the validation error propagates correctly.Test plan
test_task_phase_utils.cppcontinues to pass (terminal state detection, cleanup, etc.)cmake --preset debug && cmake --build --preset debug— no new warningsGetTaskResulttest: set task toTASK_PHASE_ERROR, callGetTaskResult, verify response contains the infrastructure-error messageCancelTasktest: wire a mockIMessageRouter, cancel a task, verifyrouteMessagewas called with aCANCEL_TASKmessage addressed to the assigned agentyaml_parsertest: parse a spec withstatus.phase: "BOGUS_PHASE"—parseTaskSpecreturnsstd::nullopt; valid phase strings still parse correctly🤖 Generated with Claude Code