Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(ui): the report button works before the backend has restarted

Harald44e7fa44c9ea
diff --git a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx
index fe36244d08..c8d135991b 100644
--- a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx
+++ b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx
@@ -252,6 +252,31 @@ describe("FeedbackView", () => {
expect(screen.queryByText("Click to attach a screenshot")).toBeNull();
});
+ it("still files a report against a backend that predates the probe fields", async () => {
+ // The bundle reloads itself while the Python process keeps running, so
+ // during an update this view briefly talks to the older API. A submit
+ // button that silently does nothing reads as a broken section.
+ const legacyStatus = {
+ configured: false,
+ github_url: ISSUES_URL,
+ context: { app_version: "1.0.8", os: "TestOS-1.0", python: "3.11.0" },
+ };
+ stubFeedbackApi(legacyStatus, { board: EMPTY_BOARD });
+ const openSpy = vi.spyOn(openExternal, "openExternalUrl").mockResolvedValue(undefined);
+
+ render(<FeedbackView />);
+ const submit = await screen.findByRole("button", { name: "Report the bug on GitHub" });
+ fillBugForm();
+ fireEvent.click(submit);
+
+ await waitFor(() => expect(openSpy).toHaveBeenCalledTimes(1));
+ const url = String(openSpy.mock.calls[0][0]);
+ expect(param(url, "template")).toBe("bug_report.yml");
+ expect(param(url, "what-happened")).toBe("It broke when I clicked the button.");
+ // The unknown dropdown value is omitted rather than sent as "undefined".
+ expect(param(url, "os")).toBeNull();
+ });
+
it("keeps submit disabled until the title and the first field are filled", async () => {
stubFeedbackApi(STATUS_NOT_CONFIGURED);
render(<FeedbackView />);
diff --git a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx
index 3526deaa6d..2cc739a612 100644
--- a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx
+++ b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx
@@ -87,6 +87,21 @@ const FIELD_MAX = 4000;
*/
const URL_MAX_CHARS = 6000;
+/**
+ * Fallback issue-form names for a backend that predates `templates` in the
+ * status probe — the frontend bundle reloads by itself while the Python
+ * process keeps running, so during an update this view can briefly talk to an
+ * older API. Without this the submit button would silently do nothing, which
+ * reads as a broken section rather than as a backend waiting to restart.
+ *
+ * The backend stays the source of truth whenever it answers with the field.
+ */
+const FALLBACK_TEMPLATES: Partial<Record<FeedbackType, string | null>> = {
+ bug: "bug_report.yml",
+ idea: "feature_request.yml",
+ question: null,
+};
+
type ResultKind =
| "sent"
| "error"
@@ -140,7 +155,10 @@ function buildIssueUrl(
primary: string,
secondary: string,
): ComposedIssue | null {
- const template = channel.templates[type];
+ const templates = channel.templates ?? FALLBACK_TEMPLATES;
+ // `question` is mapped to null on purpose — absent means "older backend",
+ // present-but-null means "deliberately not a tracker item".
+ const template = type in templates ? templates[type] : FALLBACK_TEMPLATES[type];
if (!template) return null;
const prefix = type === "bug" ? "[Bug]: " : "[Feature]: ";
@@ -152,9 +170,11 @@ function buildIssueUrl(
if (type === "bug") {
params.set("what-happened", a);
if (b) params.set("steps", b);
- // Both prefilled from the running install, so nobody has to look them up.
- params.set("os", channel.context.os_choice);
- params.set("python", channel.context.python);
+ // Both prefilled from the running install, so nobody has to look them
+ // up. Guarded because an older backend answers without `os_choice`, and
+ // a literal "undefined" is worse than an unfilled field.
+ if (channel.context.os_choice) params.set("os", channel.context.os_choice);
+ if (channel.context.python) params.set("python", channel.context.python);
} else {
params.set("problem", a);
if (b) params.set("solution", b);