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
31 changes: 30 additions & 1 deletion src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ impl AuthorityRequest {
|| (args.len() == 4
&& matches!(
args[1].as_str(),
"--external-only" | "--direct-response"
"--external-only"
| "--direct-response"
| "--clarification"
| "--auto-clarification"
)
&& args[2] == "--result-file")
|| (args.len() == 6
Expand Down Expand Up @@ -356,6 +359,32 @@ mod tests {
)
.expect("direct completion request");
assert!(direct_completion.authorized_for(config::ORCHESTRATOR_UID));
for route in ["--clarification", "--auto-clarification"] {
let clarification_completion = AuthorityRequest::from_cli(
"orchestrator",
&strings(&[
"complete",
route,
"--result-file",
"/state/clarification.md",
]),
)
.expect("clarification completion request");
assert!(clarification_completion.authorized_for(config::ORCHESTRATOR_UID));
assert!(!clarification_completion.authorized_for(config::READER_UID));
assert_eq!(
clarification_completion.into_cli(),
(
"orchestrator".to_string(),
strings(&[
"complete",
route,
"--result-file",
"/state/clarification.md",
]),
)
);
}
let read_only_completion = AuthorityRequest::from_cli(
"orchestrator",
&strings(&[
Expand Down
4 changes: 3 additions & 1 deletion src/workflow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1581,7 +1581,9 @@ pub fn supervisor_complete_external(id: &str) -> Result<String, String> {
.and_then(serde_json::Value::as_str),
) {
(Some("succeeded"), Some("succeeded")) => successful_operations += 1,
(Some("failed"), Some("failed")) => failed_operations += 1,
(Some("failed"), Some("failed")) | (Some("blocked"), Some("blocked")) => {
failed_operations += 1
}
_ => {
return Err(format!(
"external-only completion requires consistently classified terminal receipts; {} has mismatched state and disposition",
Expand Down
22 changes: 20 additions & 2 deletions tests/lifecycle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,10 @@ cat >"$EXTERNAL_STATE/operations/OP-EXTERNAL/receipt.json" <<'EOF'
}
}
EOF
mkdir -p "$EXTERNAL_STATE/operations/OP-FAILED" "$EXTERNAL_STATE/operations/OP-NONTERMINAL"
mkdir -p \
"$EXTERNAL_STATE/operations/OP-FAILED" \
"$EXTERNAL_STATE/operations/OP-BLOCKED" \
"$EXTERNAL_STATE/operations/OP-NONTERMINAL"
cat >"$EXTERNAL_STATE/operations/OP-FAILED/receipt.json" <<'EOF'
{
"result": {
Expand All @@ -522,6 +525,21 @@ cat >"$EXTERNAL_STATE/operations/OP-FAILED/receipt.json" <<'EOF'
}
}
EOF
cat >"$EXTERNAL_STATE/operations/OP-BLOCKED/receipt.json" <<'EOF'
{
"result": {
"structuredContent": {
"state": "blocked",
"outcome": {
"disposition": "blocked",
"terminal": true,
"retryable": false,
"code": "github_repository_inaccessible"
}
}
}
}
EOF
cat >"$EXTERNAL_STATE/operations/OP-NONTERMINAL/receipt.json" <<'EOF'
{
"result": {
Expand Down Expand Up @@ -570,7 +588,7 @@ assert_contains "$EXTERNAL_STATE/workflows/WF-EXTERNAL/lifecycle/lifecycle.env"
assert_contains "$EXTERNAL_STATE/workflows/WF-EXTERNAL/lifecycle/events.log" \
"route=external-only"
assert_contains "$EXTERNAL_STATE/workflows/WF-EXTERNAL/lifecycle/events.log" \
$'operations=1\tfailed_operations=2'
$'operations=1\tfailed_operations=3'
assert_contains "$EXTERNAL_STATE/orchestrator-result.md" \
"External operation completed with reviewed evidence."

Expand Down
Loading