Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/agent_automation/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ impl AutomationTaskState {
return false;
};
let action = &self.action;
if goal.status != GoalStatus::Active
!(goal.status != GoalStatus::Active
|| action.goal_revision != Some(goal.revision)
|| action.id.is_none()
|| action.status == AutomationActionStatus::Idle
Expand All @@ -437,11 +437,7 @@ impl AutomationTaskState {
|| action.kind == Some(AutomationActionKind::OfflineCombined)
&& action.status != AutomationActionStatus::Cancelled
&& action.send_accepted == Some(true)
&& action.messages_fenced)
{
return false;
}
true
&& action.messages_fenced))
}

pub(crate) fn goal_retry_at_ms(&self) -> Option<u64> {
Expand Down
30 changes: 26 additions & 4 deletions src/tools/goal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,12 @@ impl Tool for GoalTool {
"writeOnly": true
}
},
// Avoid status-dependent anyOf on this tool's wire schema.
// Some MCP adapters normalize its conditional branches into
// an untyped map and silently drop the summary/reason fields,
// leaving an otherwise valid goal_finish call impossible.
// finish_report checks the status-specific requirement below.
"required": ["expectedRevision", "status", "nextSteps"],
"anyOf": [
{"properties": {"status": {"const": "completed"}}, "required": ["summary"]},
{"properties": {"status": {"const": "blocked"}}, "required": ["reason"]}
],
"additionalProperties": false
}),
}
Expand Down Expand Up @@ -604,6 +605,27 @@ mod tests {
GoalTool::Set.input_schema()["properties"]["markdown"]["writeOnly"],
true
);
assert!(schema.get("anyOf").is_none());
assert_eq!(schema["properties"]["summary"]["type"], "string");
assert_eq!(schema["properties"]["reason"]["type"], "string");
let valid: FinishArgs = serde_json::from_value(json!({
"expectedRevision":1,
"status":"completed",
"summary":"Completed the independent read-only audit with evidence",
"nextSteps":"None"
}))
.expect("flat finish schema should preserve the summary");
assert!(matches!(
finish_report(&valid),
Ok(GoalFinish::Completed { .. })
));
let missing: FinishArgs = serde_json::from_value(json!({
"expectedRevision":1,
"status":"completed",
"nextSteps":"None"
}))
.expect("summary remains optional on the wire but required by runtime validation");
assert!(finish_report(&missing).is_err());

let goal = GoalRecord {
revision: 1,
Expand Down
Loading