Skip to content

Commit f172409

Browse files
odgrimclaude
andcommitted
fix: use String keys for task→goal mapping to support non-UUID A2A task IDs
Third contract review found that task_to_federated_goal used Uuid keys, silently dropping the mapping when a child swarm returns a non-UUID task ID (valid per A2A spec). This would deadlock SwarmDag execution since FederatedGoalConverged events would never emit for the affected node. Changed HashMap<Uuid, Uuid> to HashMap<String, Uuid> so any A2A task ID format is tracked correctly. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 74ad560 commit f172409

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/services/federation/service.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ pub struct FederationService {
238238
/// Maps federation task_id → FederatedGoal.id so that result handlers
239239
/// can correlate incoming results back to the federated goal that owns
240240
/// the DAG node.
241-
task_to_federated_goal: Arc<RwLock<HashMap<Uuid, Uuid>>>,
241+
task_to_federated_goal: Arc<RwLock<HashMap<String, Uuid>>>,
242242
/// Delegation timestamps for stall detection (task_id → last_activity_at).
243243
last_activity: Arc<RwLock<HashMap<Uuid, chrono::DateTime<chrono::Utc>>>>,
244244
/// EventBus for emitting federation events.
@@ -937,9 +937,9 @@ impl FederationService {
937937
// 7. Record the task_id → federated_goal.id mapping so result handlers
938938
// can correlate incoming FederationResultReceived events back to the
939939
// FederatedGoal (and therefore the DAG node).
940-
if let Ok(task_uuid) = remote_task_id.parse::<Uuid>() {
940+
{
941941
let mut map = self.task_to_federated_goal.write().await;
942-
map.insert(task_uuid, federated_goal.id);
942+
map.insert(remote_task_id.clone(), federated_goal.id);
943943
}
944944

945945
// 8. Return the FederatedGoal.
@@ -1244,7 +1244,7 @@ impl FederationService {
12441244
/// DAG nodes.
12451245
pub async fn federated_goal_id_for_task(&self, task_id: Uuid) -> Option<Uuid> {
12461246
let map = self.task_to_federated_goal.read().await;
1247-
map.get(&task_id).copied()
1247+
map.get(&task_id.to_string()).copied()
12481248
}
12491249

12501250
/// Get a reference to the task transformer.

0 commit comments

Comments
 (0)