Skip to content

fix(network): TASK_PHASE_ERROR handling, CancelTask notification, yaml phase validation#478

Merged
mvillmow merged 1 commit into
mainfrom
coordinator-bundle-m7
Apr 26, 2026
Merged

fix(network): TASK_PHASE_ERROR handling, CancelTask notification, yaml phase validation#478
mvillmow merged 1 commit into
mainfrom
coordinator-bundle-m7

Conversation

@mvillmow
Copy link
Copy Markdown
Collaborator

Summary

  • GetTaskResult does not handle TASK_PHASE_ERROR #225: GetTaskResult now returns a distinct, descriptive error message when a task ends in TASK_PHASE_ERROR (infrastructure/unexpected error), differentiating it from other non-completed terminal states.
  • CancelTask: notify assigned agent on cancellation #224: CancelTask sends a CANCEL_TASK KeystoneMessage to the assigned agent via the (optionally-wired) IMessageRouter after marking a task cancelled, enabling cooperative cancellation. A new setMessageRouter() method exposes this wiring point.
  • yaml_parser::parseStatus should validate phase strings against enum #222: yaml_parser::parseStatus now validates the phase string against the known hmas::TaskPhase enum values using the new public isKnownPhaseString() / stringToPhase() utilities in include/network/task_phase_utils.hpp. Unknown phase strings cause parseTaskSpec to return std::nullopt.

Changes

  • include/network/task_phase_utils.hpp: Added public phaseToString, stringToPhase, and isKnownPhaseString inline functions (previously only private static methods on HMASCoordinatorServiceImpl).
  • include/network/hmas_coordinator_service.hpp: Added optional IMessageRouter* member and setMessageRouter() setter.
  • src/network/hmas_coordinator_service.cpp: Implemented setMessageRouter; updated GetTaskResult and CancelTask as described above.
  • src/network/yaml_parser.cpp: Added phase validation in parseStatus; catch block broadened to std::exception so the validation error propagates correctly.

Test plan

  • Existing test_task_phase_utils.cpp continues to pass (terminal state detection, cleanup, etc.)
  • Build with cmake --preset debug && cmake --build --preset debug — no new warnings
  • GetTaskResult test: set task to TASK_PHASE_ERROR, call GetTaskResult, verify response contains the infrastructure-error message
  • CancelTask test: wire a mock IMessageRouter, cancel a task, verify routeMessage was called with a CANCEL_TASK message addressed to the assigned agent
  • yaml_parser test: parse a spec with status.phase: "BOGUS_PHASE"parseTaskSpec returns std::nullopt; valid phase strings still parse correctly

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

✅ Dependency Audit

Severity Count
Critical 0
High 0
Medium 0
Low 0

See the Security tab for detailed findings.


Workflow: Dependency Audit

@github-actions
Copy link
Copy Markdown

Security Scan Results

  • ❌ Secret Scanning: Potential secrets found
  • ✅ SAST: Completed (check Security tab for details)
  • ✅ Dependency Scanning: Completed
  • ✅ C++ Static Analysis: Completed
  • ✅ Docker Image Scanning: 0 high, 22 medium vulnerabilities (acceptable)

Recommendations

  • Review findings in the GitHub Security tab
  • Check artifact uploads for detailed reports
  • Address critical Docker vulnerabilities immediately

Workflow: Security Scanning

@mvillmow mvillmow force-pushed the coordinator-bundle-m7 branch 4 times, most recently from 2d3d8d3 to bcd095e Compare April 26, 2026 18:34
@mvillmow mvillmow force-pushed the coordinator-bundle-m7 branch from bcd095e to b9a2db3 Compare April 26, 2026 18:37
@mvillmow mvillmow merged commit 40996d4 into main Apr 26, 2026
4 of 9 checks passed
@mvillmow mvillmow deleted the coordinator-bundle-m7 branch April 26, 2026 18:37
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