connector-reasoning-item fix: Refusal publishes as one flat string enum again; a test pins the shape

The doc comment on ForeignReasoningState made schemars emit a oneOf; a plain
comment keeps the closed set one enum.

Finding refusal-schema-split.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-10-28 13:10:26 +01:00
commit c3f503e160
3 changed files with 32 additions and 24 deletions

View file

@ -540,8 +540,9 @@ pub enum Refusal {
Indeterminate,
ReplayConflict,
Malformed,
/// A `ReasoningState` of another provider sits in the in-flight tool
/// exchange, where dropping it would break the provider's own rules.
// A `ReasoningState` of another provider sits in the in-flight tool
// exchange, where dropping it would break the provider's own rules. A plain
// comment: a doc comment would split the published schema into a union.
ForeignReasoningState,
}

View file

@ -98,3 +98,18 @@ fn the_published_ciphertext_is_what_the_wire_sends() {
.unwrap();
assert!(matches!(wire, rmpv::Value::Binary(bytes) if bytes.len() == 40));
}
#[test]
fn the_refusal_schema_is_one_flat_string_enum() {
let schema: serde_json::Value = serde_json::from_str(&render::<Refusal>()).unwrap();
assert!(schema.get("oneOf").is_none(), "{schema}");
assert_eq!(schema["type"], "string");
let variants: Vec<&str> = schema["enum"]
.as_array()
.expect("a closed set of strings")
.iter()
.map(|value| value.as_str().unwrap())
.collect();
assert_eq!(variants.len(), 12);
assert!(variants.contains(&"ForeignReasoningState"));
}

View file

@ -38,28 +38,20 @@
]
},
"Refusal": {
"oneOf": [
{
"type": "string",
"enum": [
"Expired",
"IdentitySubstitution",
"ProviderDigestSubstitution",
"ModelNotAllowed",
"OutputBound",
"PayloadBound",
"Capacity",
"InFlight",
"Indeterminate",
"ReplayConflict",
"Malformed"
]
},
{
"description": "A `ReasoningState` of another provider sits in the in-flight tool\nexchange, where dropping it would break the provider's own rules.",
"type": "string",
"const": "ForeignReasoningState"
}
"type": "string",
"enum": [
"Expired",
"IdentitySubstitution",
"ProviderDigestSubstitution",
"ModelNotAllowed",
"OutputBound",
"PayloadBound",
"Capacity",
"InFlight",
"Indeterminate",
"ReplayConflict",
"Malformed",
"ForeignReasoningState"
]
},
"StopReason": {