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(threads): ensure thread schema validation handles optional fields correctly
Steven Enamakele8efe3f54728
diff --git a/app/src/store/threadSlice.ts b/app/src/store/threadSlice.tsindex f0cad90ac5..baa41d95b0 100644--- a/app/src/store/threadSlice.ts+++ b/app/src/store/threadSlice.ts@@ -511,6 +511,35 @@ const threadSlice = createSlice({setWelcomeThreadId: () => {// intentional no-op},+ /**+ * Drop messages at or after `messageId` from `threadId`'s local cache.+ *+ * Backs assistant-ui's `onEdit`/`onReload` (`useOpenHumanExternalStore`):+ * both RPCs (`threads.edit_message`, `threads.regenerate`) truncate the+ * core's own transcript and re-run from that point, but neither returns a+ * fresh message list — the socket events that follow only carry the NEW+ * turn. Without this, the discarded replies would stay visible in the+ * Redux cache until the next full `loadThreadMessages` refetch.+ *+ * `inclusive` distinguishes the two callers: an edit resends `messageId`+ * itself (drop it too), a reload keeps the parent message and only drops+ * what came after it.+ */+ truncateMessagesFrom: (+ state,+ action: PayloadAction<{ threadId: string; messageId: string; inclusive: boolean }>+ ) => {+ const { threadId, messageId, inclusive } = action.payload;+ const existing = state.messagesByThreadId[threadId];+ if (!existing) return;+ const idx = existing.findIndex(m => m.id === messageId);+ if (idx < 0) return;+ const truncated = existing.slice(0, inclusive ? idx : idx + 1);+ state.messagesByThreadId[threadId] = truncated;+ if (state.selectedThreadId === threadId) {+ state.messages = truncated;+ }+ },},extraReducers: builder => {builder@@ -634,6 +663,7 @@ export const {clearAllThreads,resetThreadCachesPreservingSelection,setWelcomeThreadId,+ truncateMessagesFrom,} = threadSlice.actions;export default threadSlice.reducer;diff --git a/crates/openhuman-core/src/threads/schemas/schema_defs.rs b/crates/openhuman-core/src/threads/schemas/schema_defs.rsindex a3d7b7fce5..aef9fa7a20 100644--- a/crates/openhuman-core/src/threads/schemas/schema_defs.rs+++ b/crates/openhuman-core/src/threads/schemas/schema_defs.rs@@ -396,6 +396,41 @@ pub(crate) fn schemas(function: &str) -> ControllerSchema {required: true,}],},+ "goal_get" => ControllerSchema {+ namespace: "threads",+ function: "goal_get",+ description:+ "Read a thread's current goal (Codex-style completion contract), or null when it has none.",+ inputs: vec![FieldSchema {+ name: "thread_id",+ ty: TypeSchema::String,+ comment: "Thread identifier.",+ required: true,+ }],+ outputs: vec![FieldSchema {+ name: "result",+ ty: TypeSchema::Json,+ comment: "Envelope wrapping the goal (may be null).",+ required: true,+ }],+ },+ "todos_get" => ControllerSchema {+ namespace: "threads",+ function: "todos_get",+ description: "Read a thread's current session todo list.",+ inputs: vec![FieldSchema {+ name: "thread_id",+ ty: TypeSchema::String,+ comment: "Thread identifier.",+ required: true,+ }],+ outputs: vec![FieldSchema {+ name: "result",+ ty: TypeSchema::Json,+ comment: "Envelope wrapping the todo list (empty when never written).",+ required: true,+ }],+ },_other => ControllerSchema {namespace: "threads",function: "unknown",