A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: accept optional chat and plugin fields after Zod upgrade (#11114)
Shahmir Varqhaa215ffeb3a55
diff --git a/frontend/plugins.openapi.yaml b/frontend/plugins.openapi.yamlindex 959a1fcd19..19a461abce 100644--- a/frontend/plugins.openapi.yaml+++ b/frontend/plugins.openapi.yaml@@ -2882,16 +2882,12 @@ components:parts:type: arrayitems: {}- metadata:- anyOf:- - {}- - type: "null"+ metadata: {}required:- id- role- content- parts- - metadatarequired:- messagesmarimo-chatbot.send_prompt.input:@@ -2919,16 +2915,12 @@ components:parts:type: arrayitems: {}- metadata:- anyOf:- - {}- - type: "null"+ metadata: {}required:- id- role- content- parts- - metadataconfig:type: objectproperties:diff --git a/frontend/src/components/chat/tool-call/__tests__/tool-result.test.tsx b/frontend/src/components/chat/tool-call/__tests__/tool-result.test.tsxnew file mode 100644index 0000000000..440536c12e--- /dev/null+++ b/frontend/src/components/chat/tool-call/__tests__/tool-result.test.tsx@@ -0,0 +1,56 @@+/* Copyright 2026 Marimo. All rights reserved. */++import { cleanup, render, screen } from "@testing-library/react";+import { afterEach, describe, expect, it } from "vitest";+import { ResultRenderer } from "../tool-result";++afterEach(cleanup);++describe("ResultRenderer", () => {+ it.each([+ { status: "success", message: "No output was returned." },+ { status: "success", next_steps: ["Run the edited cells."] },+ {+ status: "success",+ action_url: null,+ next_steps: null,+ meta: null,+ message: "Finished",+ },+ {+ status: "success",+ action_url: "/notebook",+ next_steps: ["Review the output."],+ meta: { source: "notebook" },+ cellsToOutput: { cell: { cellOutput: "Hello", consoleOutput: "" } },+ },+ ])("renders structured results with optional fields: %j", (result) => {+ render(<ResultRenderer result={result} />);++ expect(screen.getByRole("heading", { name: "Tool Result" })).toBeVisible();+ expect(screen.getByText("success")).toBeVisible();+ });++ it("displays messages and tool-specific output without metadata", () => {+ render(+ <ResultRenderer+ result={{+ status: "success",+ message: "Cells finished running.",+ cellsToOutput: { cell: { cellOutput: "Hello", consoleOutput: "" } },+ }}+ />,+ );++ expect(screen.getByText("Cells finished running.")).toBeVisible();+ expect(screen.getByText("cellsToOutput")).toBeVisible();+ expect(screen.getByText(/"cellOutput": "Hello"/)).toBeVisible();+ });++ it("preserves the fallback for unstructured results", () => {+ render(<ResultRenderer result="Plain text result" />);++ expect(screen.queryByRole("heading", { name: "Tool Result" })).toBeNull();+ expect(screen.getByText("Plain text result")).toBeVisible();+ });+});diff --git a/frontend/src/components/chat/tool-call/tool-result.tsx b/frontend/src/components/chat/tool-call/tool-result.tsxindex ee6dccd9d8..ac93118fa2 100644--- a/frontend/src/components/chat/tool-call/tool-result.tsx+++ b/frontend/src/components/chat/tool-call/tool-result.tsx@@ -21,9 +21,9 @@ function isUninformative(value: unknown): boolean {const SuccessResultSchema = z.looseObject({status: z.string().default("success"),auth_required: z.boolean().default(false),- action_url: z.any(),- next_steps: z.any(),- meta: z.any(),+ action_url: z.any().optional(),+ next_steps: z.any().optional(),+ meta: z.any().optional(),message: z.string().nullish(),});diff --git a/frontend/src/plugins/impl/chat/ChatPlugin.tsx b/frontend/src/plugins/impl/chat/ChatPlugin.tsxindex 814a5c810b..83462cad33 100644--- a/frontend/src/plugins/impl/chat/ChatPlugin.tsx+++ b/frontend/src/plugins/impl/chat/ChatPlugin.tsx@@ -27,7 +27,7 @@ const messageSchema = z.array(role: z.enum(["system", "user", "assistant"]),content: z.string().nullable(),parts: z.array(z.any()),- metadata: z.any().nullable(),+ metadata: z.any().optional(),}),);