The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(todos): approvalMode is a two-variant enum, not a free string
M3gA-Mindc583c3ab7769
diff --git a/src/openhuman/threads/todos/schemas_part_02.rs b/src/openhuman/threads/todos/schemas_part_02.rsindex 2cc98f1fc6..86b0f5b419 100644--- a/src/openhuman/threads/todos/schemas_part_02.rs+++ b/src/openhuman/threads/todos/schemas_part_02.rs@@ -148,10 +148,22 @@ fn replace_cards_input() -> FieldSchema {TypeSchema::Array(Box::new(TypeSchema::String)),"Tools the assigned agent may use. Omit to default to []; `null` is rejected.",),- optional_string(- "approvalMode",- "Plan-approval mode, when the card is gated.",- ),+ FieldSchema {+ name: "approvalMode",+ // `TaskApprovalMode` is a two-variant enum, not a free+ // string: declaring `Option(String)` advertised every+ // string as valid, so a catalog-conforming `"sometimes"`+ // would come back `invalid params`. Wrapped in `Option`+ // because the field really is `Option<TaskApprovalMode>`+ // upstream, so `null` genuinely is accepted here — unlike+ // the `defaulted_field` group above.+ ty: TypeSchema::Option(Box::new(TypeSchema::Enum {+ variants: vec!["required", "not_required"],+ })),+ comment: "Plan-approval mode, when the card is gated. \+ `null` clears it.",+ required: false,+ },defaulted_field("acceptanceCriteria",TypeSchema::Array(Box::new(TypeSchema::String)),@@ -176,8 +188,20 @@ fn replace_cards_input() -> FieldSchema {},defaulted_field("order",+ // `TaskBoardCard::order` is a `u32`, but `TypeSchema` has+ // no narrower unsigned type and no bounds, so `U64` is the+ // closest available declaration and the ceiling has to be+ // stated in prose. A value above `u32::MAX` passes schema+ // validation and is then refused by the handler's+ // deserialization. That imprecision is shared by every+ // `TypeSchema::U64` declaration in the catalog (200-odd of+ // them), so closing it means adding a bounded integer to+ // `core::TypeSchema` rather than editing this one field —+ // tracked as #6137. Drop this caveat when that lands.TypeSchema::U64,- "Sort position. Omit to default to 0; `null` is rejected.",+ "Sort position, 0..=4294967295 (u32). Omit to default to 0; \+ `null` is rejected, and a value above the u32 ceiling is \+ refused by the handler rather than by schema validation.",),defaulted_field("updatedAt",diff --git a/tests/raw_coverage/todos_lifecycle_e2e.rs b/tests/raw_coverage/todos_lifecycle_e2e.rsindex e6affbe643..cfcc8cb1db 100644--- a/tests/raw_coverage/todos_lifecycle_e2e.rs+++ b/tests/raw_coverage/todos_lifecycle_e2e.rs@@ -852,6 +852,51 @@ async fn todos_replace_accepts_a_card_built_only_from_its_declared_schema() {);}+ // Every *optional* enum field must advertise exactly the variants its wire+ // type parses, and each must round-trip. The generated card above only+ // populates required fields, so without this an optional enum declared as a+ // free `Option(String)` — which `approvalMode` was — would let a+ // catalog-valid value like "sometimes" through the schema and straight into+ // an `invalid params` from the handler.+ for name in ["approvalMode"] {+ let field = card_fields+ .iter()+ .find(|f| f.get("name").and_then(Value::as_str) == Some(name))+ .unwrap_or_else(|| panic!("the card must declare `{name}`"));+ let variants = field+ .get("ty")+ .and_then(|t| t.get("Option"))+ .and_then(|inner| inner.get("Enum"))+ .and_then(|e| e.get("variants"))+ .and_then(Value::as_array)+ .unwrap_or_else(|| {+ panic!(+ "`{name}` is backed by a closed enum upstream, so the catalog \+ must declare its variants rather than a free string. \+ Declared ty was: {}",+ field.get("ty").unwrap_or(&Value::Null)+ )+ })+ .clone();++ for (i, variant) in variants.iter().enumerate() {+ let mut probe = card.clone();+ probe.insert("id".to_string(), Value::String(format!("enum-{name}-{i}")));+ probe.insert(name.to_string(), variant.clone());+ let response = rpc(+ &harness.rpc_base,+ 90 + i as i64,+ "openhuman.todos_replace",+ json!({ "thread_id": thread, "cards": [Value::Object(probe)] }),+ )+ .await;+ ok(+ &response,+ &format!("todos_replace with the declared `{name}` variant {variant}"),+ );+ }+ }+// Every advertised status variant must actually parse. Taking only the// first would let a misspelled later variant (`in-progress` for// `in_progress`, say) sit in the catalog undetected.