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.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(feedback): revive the in-app form beside the Discord CTA
rubenluetke10-beep3aec381e8092
diff --git a/docs/product/knowledge-and-sharing/find-help-in-the-app.md b/docs/product/knowledge-and-sharing/find-help-in-the-app.mdindex cd43d0f8b1..e5e005c3c6 100644--- a/docs/product/knowledge-and-sharing/find-help-in-the-app.md+++ b/docs/product/knowledge-and-sharing/find-help-in-the-app.md@@ -8,7 +8,7 @@ order: 5diataxis: howtostatus: activeowner: maintainers-last_reviewed: 2026-07-21+last_reviewed: 2026-08-12phase: "-"audience: end-usertags: [documentation, help, search, troubleshooting, support]@@ -110,10 +110,16 @@ diagnostic API is a developer tool; Docs and Feedback do not run it or collectits output automatically.For a product bug, idea, or question, open **Feedback** in the main app-sidebar. The current Feedback view does not submit an in-app form, run-diagnostics, or attach logs. It opens the project's **#report-a-bug** forum in-Discord and offers a separate **Join Discord first** button. If Discord is not-suitable, use the project's [public issue tracker](https://github.com/PersonalJarvis/PersonalJarvis/issues).+sidebar. The Discord buttons open the project's **#report-a-bug** forum, with+a separate **Join Discord first** button for new members. Below them, an+in-app form takes the same report without Discord: choose a type, write a+title and description, and submit. On an installation with a configured+feedback channel the report is delivered directly with the app version and+operating system attached; on other installations — the usual case — the same+button opens your text as a prefilled issue on the project's+[public issue tracker](https://github.com/PersonalJarvis/PersonalJarvis/issues),+so nothing has to be retyped. The view does not run diagnostics or attach+logs.Before posting anywhere public, describe what you expected, what happened,and the shortest steps that reproduce it. Remove credentials, recovery codes,diff --git a/docs/product/knowledge-and-sharing/socials-and-feedback.md b/docs/product/knowledge-and-sharing/socials-and-feedback.mdindex 7c6681d0ee..9d56f74523 100644--- a/docs/product/knowledge-and-sharing/socials-and-feedback.md+++ b/docs/product/knowledge-and-sharing/socials-and-feedback.md@@ -8,7 +8,7 @@ order: 4diataxis: howtostatus: activeowner: maintainers-last_reviewed: 2026-07-21+last_reviewed: 2026-08-12phase: "-"audience: end-usertags: [socials, feedback, community, privacy]@@ -16,11 +16,12 @@ related: [profile-and-contacts, jarvis-board, privacy-and-local-data]---**Socials** gives you a local directory of project and community links.-**Feedback** opens the project's Discord server, where you can report a bug,-suggest an idea, or ask a question.+**Feedback** opens the project's Discord server and offers an in-app report+form for a bug, an idea, or a question.-Neither view posts anything for you. Jarvis opens the destination in an-external browser, and you decide whether to sign in or share information.+Neither view posts to a community for you. The Discord and GitHub paths open+in an external browser where you decide what to share, and the in-app form+sends only what you typed, after you press submit.## Before You Start@@ -75,11 +76,17 @@ older destinations, when project defaults change. Disabled entries are hidden.only when they help explain the problem.6. Review the post and any screenshot, then submit it in Discord.-The current Feedback view has no report form. Its two buttons pass only the-chosen Discord address to Jarvis's external-link opener. The view does not send-your report text, screenshots, logs, conversations, or system details, and it-does not queue a report while you are offline. Discord receives what your-browser normally sends when it loads the site and anything you submit there.+Below the Discord buttons, the view also offers an in-app form. Choose+**Bug**, **Idea**, or **Question**, then write a title and a description. What+happens on submit depends on the installation. When the server has a feedback+channel configured, the report is delivered there directly, together with the+app version, the operating system name, and the Python version; a screenshot+can be attached, and you pick the image yourself. On an installation without+a configured channel — the usual case for a personal install — the submit+button instead opens your report as a prefilled issue on the project's public+GitHub tracker, with the same system details appended, and you review and+submit it in the browser. The form never sends conversations or logs, and it+does not queue a report while you are offline.## How It Fits Together@@ -92,8 +99,9 @@ browser normally sends when it loads the site and anything you submit there.headless host reports that it cannot open one, so the Jarvis page tries a newtab in the browser you are already using. Browser popup rules can block thatfallback.-4. **Feedback follows the same opening path.** Jarvis does not turn the active- chat, a voice session, or an output file into a Discord report.+4. **Feedback's Discord buttons follow the same opening path**, and its in-app+ form sends only what you typed plus basic system details. Jarvis does not+ turn the active chat, a voice session, or an output file into a report.5. **Sharing remains separate.** A card from [Jarvis Board](jarvis-board) is notattached to Feedback. Review anything you paste or upload, using[Privacy and Local Data](privacy-and-local-data) as a guide.@@ -107,7 +115,8 @@ browser normally sends when it loads the site and anything you submit there.2. Use **Back**, then select any single-link platform. Confirm that an externalbrowser or browser tab opens the selected site.3. Return to Jarvis, open **Feedback**, and confirm that **Open #report-a-bug**- and **Join Discord first** are both present.+ and **Join Discord first** are both present, with the report form below+ them.You do not need to sign in or publish a post to complete this check. If yoursaved Socials directory differs from the fresh-install list, use any group with@@ -122,7 +131,7 @@ two or more links for the detail-page check.| A saved destination is old | The initial list was written on first use and is not replaced when defaults change | Compare the entry with the current project destination, then update it with `jarvis socials edit` if you administer the installation. || A Socials tile or Feedback button does not open anything | The host has no working browser, a popup was blocked, or the destination is offline | Check the internet connection and desktop browser settings. On a headless installation, allow popups for the Jarvis page and try again. || Discord opens a welcome page or denies the forum | The account has not joined the server or completed onboarding | Return to **Feedback**, select **Join Discord first**, finish onboarding, then use **Open #report-a-bug** again. |-| You selected Feedback but nothing was submitted | The page only opens Discord; it does not send an in-app form | Finish and submit the post inside Discord. If Discord is unavailable, use the project's [GitHub Issues](https://github.com/PersonalJarvis/PersonalJarvis/issues) page. |+| The form's submit button reads **Open a prefilled GitHub issue** | This installation has no direct feedback channel, so the report is handed to GitHub instead | Select the button, then review and submit the issue in the browser. Nothing is delivered until you submit it on [GitHub Issues](https://github.com/PersonalJarvis/PersonalJarvis/issues). |## Next Stepsdiff --git a/jarvis/ui/web/feedback_routes.py b/jarvis/ui/web/feedback_routes.pyindex 18aa13049a..cbb2b22c24 100644--- a/jarvis/ui/web/feedback_routes.py+++ b/jarvis/ui/web/feedback_routes.py@@ -1,11 +1,20 @@"""REST API for the in-app feedback / bug-report form.-Endpoint:+Endpoints:- POST /api/feedback → {"ok": bool, "status": str, "detail": str,- "github_url": str | None}+ GET /api/feedback/status → {"configured": bool, "github_url": str,+ "context": {...}}+ POST /api/feedback → {"ok": bool, "status": str, "detail": str,+ "github_url": str | None}-The endpoint validates the payload, enriches it with system context (app+``GET /status`` is the capability probe: the frontend calls it before the user+types anything, so the form can honestly present the path this install really+has — direct dispatch when the operator webhook exists, or a prefilled GitHub+issue otherwise. ``context`` carries the same system fields the POST route+would attach server-side, so the GitHub fallback can include them in the+issue body.++The POST endpoint validates the payload, enriches it with system context (appversion, OS, Python, UTC timestamp), and forwards it to a Discord webhook asa rich embed. A screenshot may be included as a data-URL; if present it issent as a multipart upload so Discord can render it as an inline image.@@ -64,7 +73,7 @@ _DISCORD_EMBED_DESC_MAX = 4096# Maximum decoded size for an attached screenshot (8 MB)._SCREENSHOT_DECODED_MAX_BYTES = 8 * 1024 * 1024-_SECRET_KEY = "discord_feedback_webhook_url"+_SECRET_KEY = "discord_feedback_webhook_url" # noqa: S105 — key NAME, not a value_ENV_KEY = "DISCORD_FEEDBACK_WEBHOOK_URL"# Public fallback for every downloader when the operator-only Discord webhook@@ -95,6 +104,27 @@ class FeedbackResult(BaseModel):github_url: str | None = None+class FeedbackContext(BaseModel):+ """System fields the server would attach to a dispatched report."""++ app_version: str+ os: str+ python: str+++class FeedbackChannelStatus(BaseModel):+ """Capability probe result for the feedback form (GET /status)."""++ # True when this install can dispatch feedback directly (operator webhook+ # present). False on every fresh download — the frontend then offers a+ # prefilled GitHub issue instead of a submit that would dead-end.+ configured: bool+ # Public issues page of the project — always present so the frontend never+ # has to hardcode it.+ github_url: str+ context: FeedbackContext++# ----------------------------------------------------------------------# Version helper# ----------------------------------------------------------------------@@ -111,26 +141,56 @@ def _app_version() -> str:import jarvis # type: ignore[import]return jarvis.__version__ # type: ignore[attr-defined]- except (ImportError, AttributeError):- pass+ except (ImportError, AttributeError) as exc:+ log.debug("feedback: jarvis.__version__ unavailable — %s", exc)try:- pyproject = Path(__file__).resolve().parents[4] / "pyproject.toml"+ # This file lives at <repo>/jarvis/ui/web/feedback_routes.py, so the+ # repo root (where pyproject.toml sits) is three parents up.+ pyproject = Path(__file__).resolve().parents[3] / "pyproject.toml"text = pyproject.read_text(encoding="utf-8")m = re.search(r'^version\s*=\s*"([^"]+)"', text, re.MULTILINE)if m:return m.group(1)- except Exception: # noqa: BLE001 — best-effort, never fatal- pass+ except Exception as exc: # noqa: BLE001 — best-effort, never fatal+ log.debug("feedback: pyproject.toml version probe failed — %s", exc)return "unknown"+def _system_context() -> FeedbackContext:+ """Gather the system fields attached to every dispatched report."""+ return FeedbackContext(+ app_version=_app_version(),+ os=platform.platform(),+ python=platform.python_version(),+ )++# -----------------------------------------------------------------------# Endpoint+# Endpoints# ----------------------------------------------------------------------[email protected]("/status")+async def feedback_status() -> FeedbackChannelStatus:+ """Report whether this install can dispatch feedback directly.++ The frontend probes this before rendering the form so it can offer the+ honest path up front: direct dispatch when the operator webhook is+ configured, or a prefilled GitHub issue otherwise. ``context`` carries+ the system fields (app version, OS, Python) so the GitHub fallback can+ embed them in the issue body — the same enrichment the POST route+ performs server-side.+ """+ webhook_url = get_secret(_SECRET_KEY, env_fallback=_ENV_KEY)+ return FeedbackChannelStatus(+ configured=bool(webhook_url),+ github_url=_GITHUB_ISSUES_URL,+ context=_system_context(),+ )++@router.post("")async def submit_feedback(body: FeedbackPayload) -> FeedbackResult:"""Submit user feedback or a bug report to the configured Discord webhook.@@ -163,9 +223,7 @@ async def submit_feedback(body: FeedbackPayload) -> FeedbackResult:)# Gather server-side context so the client does not have to send it.- version = _app_version()- os_info = platform.platform()- py_version = platform.python_version()+ ctx = _system_context()reported_at = datetime.datetime.now(datetime.UTC).isoformat()# Decode and size-check the screenshot if the client provided one.@@ -198,9 +256,9 @@ async def submit_feedback(body: FeedbackPayload) -> FeedbackResult:"color": color,"fields": [{"name": "Type", "value": body.type.capitalize(), "inline": True},- {"name": "App version", "value": version, "inline": True},- {"name": "OS", "value": os_info, "inline": False},- {"name": "Python", "value": py_version, "inline": True},+ {"name": "App version", "value": ctx.app_version, "inline": True},+ {"name": "OS", "value": ctx.os, "inline": False},+ {"name": "Python", "value": ctx.python, "inline": True},{"name": "Reported at", "value": reported_at, "inline": True},],"footer": {"text": "Personal Jarvis · in-app feedback"},diff --git a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsxindex 1d772c0655..e25bce5f20 100644--- a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx+++ b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.test.tsx@@ -1,29 +1,72 @@/*** Component tests for FeedbackView.*- * The Feedback section is Discord-only: a single button forwards the user to the- * #report-a-bug forum via {@link openExternalUrl}. A separate permanent invite- * is available for people who have not joined the server yet.- *- * Verifies:- * - The Discord call-to-action (heading + button) renders.- * - Clicking the button opens the Discord invite via the external-open bridge- * (openExternalUrl), NOT a bare anchor — this is what makes it work inside- * the desktop WebView2 shell, which drops target="_blank".+ * The Feedback section offers two honest paths:+ * 1. Discord (primary): a button straight to the #report-a-bug forum plus a+ * permanent invite, both via {@link openExternalUrl} — NOT a bare anchor,+ * because the desktop WebView2 shell drops target="_blank".+ * 2. An in-app form (secondary) that probes GET /api/feedback/status first:+ * - webhook configured → POST /api/feedback (direct dispatch).+ * - not configured → the submit button opens a PREFILLED GitHub+ * issue with the typed report + system context instead.*/import { afterEach, describe, expect, it, vi } from "vitest";-import { cleanup, fireEvent, render, screen } from "@testing-library/react";+import { cleanup, fireEvent, render, screen, waitFor } from "@testing-library/react";import { FeedbackView } from "@/views/feedback/FeedbackView";import * as openExternal from "@/lib/openExternal";+const STATUS_NOT_CONFIGURED = {+ configured: false,+ github_url: "https://github.com/PersonalJarvis/PersonalJarvis/issues",+ context: { app_version: "1.0.8", os: "TestOS-1.0", python: "3.11.0" },+};++const STATUS_CONFIGURED = { ...STATUS_NOT_CONFIGURED, configured: true };++/** Stub fetch: GET /status returns `status`, POST /api/feedback returns `postResult`. */+function stubFeedbackApi(status: object, postResult?: object) {+ const fetchMock = vi.fn(async (url: unknown, init?: RequestInit) => {+ const href = String(url);+ if (href.includes("/api/feedback/status")) {+ return { ok: true, json: async () => status } as Response;+ }+ if (href.includes("/api/feedback") && init?.method === "POST") {+ return {+ ok: true,+ json: async () =>+ postResult ?? { ok: true, status: "sent", detail: "", github_url: null },+ } as Response;+ }+ return { ok: false, status: 404, statusText: "Not Found", json: async () => ({}) } as Response;+ });+ vi.stubGlobal("fetch", fetchMock);+ return fetchMock;+}++function fillForm() {+ fireEvent.change(screen.getByLabelText("Title"), {+ target: { value: "Something broke" },+ });+ fireEvent.change(screen.getByLabelText("Description"), {+ target: { value: "It broke when I clicked the button." },+ });+}+afterEach(() => {cleanup();vi.restoreAllMocks();+ vi.unstubAllGlobals();});describe("FeedbackView", () => {- it("renders the Discord call-to-action with a forward button", () => {+ /** Wait for the mount-time status probe so state settles inside act(). */+ async function probeSettled() {+ await screen.findByRole("button", { name: "Open a prefilled GitHub issue" });+ }++ it("renders the Discord call-to-action with a forward button", async () => {+ stubFeedbackApi(STATUS_NOT_CONFIGURED);render(<FeedbackView />);expect(@@ -32,17 +75,11 @@ describe("FeedbackView", () => {expect(screen.getByRole("button", { name: "Join Discord first" }),).toBeTruthy();+ await probeSettled();});- it("does NOT render the old in-app form (Discord-only)", () => {- render(<FeedbackView />);- // No title/description inputs anymore.- expect(screen.queryByLabelText(/title/i)).toBeNull();- expect(screen.queryByLabelText(/description/i)).toBeNull();- expect(screen.queryByRole("button", { name: /submit/i })).toBeNull();- });-- it("opens the bug forum directly via the external-open bridge", () => {+ it("opens the bug forum directly via the external-open bridge", async () => {+ stubFeedbackApi(STATUS_NOT_CONFIGURED);const openSpy = vi.spyOn(openExternal, "openExternalUrl").mockResolvedValue(undefined);@@ -56,9 +93,11 @@ describe("FeedbackView", () => {expect(openSpy).toHaveBeenCalledWith("https://discord.com/channels/1511102439066177656/1521522036709789736",);+ await probeSettled();});- it("keeps a permanent server invite for people who have not joined yet", () => {+ it("keeps a permanent server invite for people who have not joined yet", async () => {+ stubFeedbackApi(STATUS_NOT_CONFIGURED);const openSpy = vi.spyOn(openExternal, "openExternalUrl").mockResolvedValue(undefined);@@ -70,5 +109,86 @@ describe("FeedbackView", () => {expect(openSpy).toHaveBeenCalledTimes(1);expect(openSpy).toHaveBeenCalledWith("https://discord.gg/x7USduHxbc");+ await probeSettled();+ });++ it("renders the in-app form below the Discord card", async () => {+ stubFeedbackApi(STATUS_NOT_CONFIGURED);+ render(<FeedbackView />);++ expect(screen.getByLabelText("Title")).toBeTruthy();+ expect(screen.getByLabelText("Description")).toBeTruthy();+ expect(screen.getByRole("radiogroup", { name: "Type" })).toBeTruthy();+ expect(screen.getByRole("radio", { name: "Bug" })).toBeTruthy();+ expect(screen.getByRole("radio", { name: "Idea" })).toBeTruthy();+ expect(screen.getByRole("radio", { name: "Question" })).toBeTruthy();+ await probeSettled();+ });++ it("opens a prefilled GitHub issue when no feedback channel is configured", async () => {+ stubFeedbackApi(STATUS_NOT_CONFIGURED);+ const openSpy = vi+ .spyOn(openExternal, "openExternalUrl")+ .mockResolvedValue(undefined);++ render(<FeedbackView />);++ // The probe resolves → the submit button flips to GitHub mode.+ const submit = await screen.findByRole("button", {+ name: "Open a prefilled GitHub issue",+ });+ fillForm();+ fireEvent.click(submit);++ await waitFor(() => expect(openSpy).toHaveBeenCalledTimes(1));+ const url = String(openSpy.mock.calls[0][0]);+ expect(url).toContain(+ "https://github.com/PersonalJarvis/PersonalJarvis/issues/new?",+ );+ expect(url).toContain("Something+broke");+ // System context from the status probe rides along in the issue body.+ expect(decodeURIComponent(url.replace(/\+/g, " "))).toContain(+ "App version: 1.0.8",+ );+ });++ it("hides the screenshot picker in GitHub mode (a URL cannot carry an image)", async () => {+ stubFeedbackApi(STATUS_NOT_CONFIGURED);+ render(<FeedbackView />);++ await screen.findByRole("button", { name: "Open a prefilled GitHub issue" });+ expect(screen.queryByText("Click to attach a screenshot")).toBeNull();+ });++ it("dispatches through POST /api/feedback when the channel is configured", async () => {+ const fetchMock = stubFeedbackApi(STATUS_CONFIGURED);+ render(<FeedbackView />);++ // Configured mode keeps the plain submit label and shows the picker.+ await screen.findByText("Click to attach a screenshot");+ fillForm();+ fireEvent.click(screen.getByRole("button", { name: "Submit" }));++ await screen.findByText("Thanks — sent to our Discord!");+ const post = fetchMock.mock.calls.find(([, init]) => init?.method === "POST");+ expect(post).toBeTruthy();+ const body = JSON.parse(String(post?.[1]?.body)) as Record<string, unknown>;+ expect(body).toMatchObject({+ type: "bug",+ title: "Something broke",+ description: "It broke when I clicked the button.",+ });+ });++ it("keeps submit disabled until title and description are filled", async () => {+ stubFeedbackApi(STATUS_CONFIGURED);+ render(<FeedbackView />);++ const submit = screen.getByRole("button", { name: "Submit" });+ expect((submit as HTMLButtonElement).disabled).toBe(true);+ fillForm();+ await waitFor(() =>+ expect((submit as HTMLButtonElement).disabled).toBe(false),+ );});});diff --git a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsxindex a05521a833..bcb73b3c77 100644--- a/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx+++ b/jarvis/ui/web/frontend/src/views/feedback/FeedbackView.tsx@@ -1,19 +1,40 @@-import { MessageSquareWarning } from "lucide-react";+import { useCallback, useEffect, useRef, useState } from "react";+import {+ Bug,+ ExternalLink,+ HelpCircle,+ ImagePlus,+ Lightbulb,+ MessageSquareWarning,+ X,+} from "lucide-react";import { ViewHeader } from "@/views/ChatsView";import { useT } from "@/i18n";import { openExternalUrl } from "@/lib/openExternal";+import {+ fetchFeedbackStatus,+ submitFeedback,+ type FeedbackChannelStatus,+ type FeedbackType,+} from "@/views/feedback/api";/**- * The Feedback section — bugs, ideas, and questions are reported exclusively in- * the project's Discord #report-a-bug forum. The primary button opens the forum- * directly; a separate permanent invite remains available for people who have- * not joined the server yet.+ * The Feedback section — Discord stays the primary channel (the forum button+ * plus a permanent invite), and below it an in-app form covers everyone the+ * Discord path loses. The form probes GET /api/feedback/status first and+ * presents the ONE path this install really has:*- * The button uses {@link openExternalUrl} rather than a bare+ * - webhook configured (operator install) → direct dispatch with optional+ * screenshot, enriched server-side with app version / OS / Python.+ * - not configured (every fresh download) → the submit button opens the+ * report as a PREFILLED GitHub issue instead, system context included, so+ * the form is never a dead end and nothing has to be retyped.+ *+ * All external links go through {@link openExternalUrl} rather than a bare* `<a target="_blank">`, because the desktop shell (WebView2) silently drops- * `target="_blank"` / `window.open` — the new tab never appears. The bridge asks- * the backend to open the OS default browser instead (and falls back to+ * `target="_blank"` / `window.open` — the new tab never appears. The bridge+ * asks the backend to open the OS default browser instead (and falls back to* `window.open` on a remote/VPS browser).*/@@ -26,6 +47,21 @@ const DISCORD_BUG_FORUM_URL =// Public, never-expiring server invite for people who are not members yet.const DISCORD_INVITE_URL = "https://discord.gg/x7USduHxbc";+// Mirror of the backend's decoded-size cap (feedback_routes.py) so an+// oversized screenshot is rejected before a pointless upload round-trip.+const SCREENSHOT_MAX_BYTES = 8 * 1024 * 1024;++// Matches the backend's Pydantic field constraints.+const TITLE_MAX = 200;+const DESCRIPTION_MAX = 4000;++type ResultKind = "sent" | "error" | "not_configured" | "github_opened";++const INPUT_CLS =+ "w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground " ++ "placeholder:text-muted-foreground/70 focus-visible:outline-none focus-visible:ring-1 " ++ "focus-visible:ring-primary/40";+/** The official Discord brand mark (inline so it renders without an asset). */function DiscordIcon({ className }: { className?: string }) {return (@@ -35,9 +71,151 @@ function DiscordIcon({ className }: { className?: string }) {);}+/**+ * Compose the `/issues/new` URL with the report prefilled. System context+ * comes from the status probe — the same fields the backend would attach on a+ * direct dispatch, so a GitHub issue is not a second-class report.+ */+function buildGithubIssueUrl(+ channel: FeedbackChannelStatus,+ type: FeedbackType,+ title: string,+ description: string,+): string {+ const body = [+ description.trim(),+ "",+ "---",+ `- Type: ${type}`,+ `- App version: ${channel.context.app_version}`,+ `- OS: ${channel.context.os}`,+ `- Python: ${channel.context.python}`,+ ].join("\n");+ const params = new URLSearchParams({ title: title.trim(), body });+ return `${channel.github_url}/new?${params.toString()}`;+}+export function FeedbackView() {const t = useT();+ // null = probe pending or failed → default to the in-app submit path (its+ // own error handling covers a server that is actually down).+ const [channel, setChannel] = useState<FeedbackChannelStatus | null>(null);++ const [type, setType] = useState<FeedbackType>("bug");+ const [title, setTitle] = useState("");+ const [description, setDescription] = useState("");+ const [screenshot, setScreenshot] = useState<string | null>(null);+ const [screenshotTooLarge, setScreenshotTooLarge] = useState(false);+ const [sending, setSending] = useState(false);+ const [result, setResult] = useState<ResultKind | null>(null);+ const fileRef = useRef<HTMLInputElement | null>(null);++ useEffect(() => {+ let cancelled = false;+ fetchFeedbackStatus()+ .then((status) => {+ if (!cancelled) setChannel(status);+ })+ .catch(() => {+ /* probe unreachable — keep the in-app path as default */+ });+ return () => {+ cancelled = true;+ };+ }, []);++ const githubMode = channel !== null && !channel.configured;++ const onPickScreenshot = useCallback((ev: React.ChangeEvent<HTMLInputElement>) => {+ const file = ev.target.files?.[0];+ // Allow re-picking the same file after a remove.+ ev.target.value = "";+ if (!file) return;+ if (file.size > SCREENSHOT_MAX_BYTES) {+ setScreenshotTooLarge(true);+ return;+ }+ setScreenshotTooLarge(false);+ const reader = new FileReader();+ reader.onload = () => {+ if (typeof reader.result === "string") setScreenshot(reader.result);+ };+ reader.readAsDataURL(file);+ }, []);++ const canSubmit = title.trim().length > 0 && description.trim().length > 0 && !sending;++ const onSubmit = useCallback(+ async (ev: React.FormEvent) => {+ ev.preventDefault();+ if (!canSubmit) return;+ setResult(null);++ if (githubMode && channel) {+ await openExternalUrl(buildGithubIssueUrl(channel, type, title, description));+ setResult("github_opened");+ return;+ }++ setSending(true);+ try {+ const res = await submitFeedback({+ type,+ title: title.trim(),+ description: description.trim(),+ screenshot,+ });+ if (res.status === "sent") {+ setResult("sent");+ setTitle("");+ setDescription("");+ setScreenshot(null);+ } else if (res.status === "not_configured") {+ // The probe said "configured" but the dispatch disagreed (webhook+ // removed meanwhile). Flip to GitHub mode so the button becomes the+ // working path instead of a repeat failure.+ setResult("not_configured");+ if (channel && res.github_url) {+ setChannel({ ...channel, configured: false, github_url: res.github_url });+ }+ } else {+ setResult("error");+ }+ } catch {+ setResult("error");+ } finally {+ setSending(false);+ }+ },+ [canSubmit, channel, description, githubMode, screenshot, title, type],+ );++ const typeOptions: Array<{ value: FeedbackType; label: string; icon: typeof Bug }> = [+ { value: "bug", label: t("feedback.type_bug"), icon: Bug },+ { value: "idea", label: t("feedback.type_idea"), icon: Lightbulb },+ { value: "question", label: t("feedback.type_question"), icon: HelpCircle },+ ];++ const resultBanner: Record<ResultKind, { text: string; cls: string }> = {+ sent: {+ text: t("feedback.result_sent"),+ cls: "border-emerald-500/40 bg-emerald-500/10 text-emerald-400",+ },+ error: {+ text: t("feedback.result_error"),+ cls: "border-red-500/40 bg-red-500/10 text-red-400",+ },+ not_configured: {+ text: t("feedback.result_not_configured"),+ cls: "border-amber-500/40 bg-amber-500/10 text-amber-400",+ },+ github_opened: {+ text: t("feedback.result_github_opened"),+ cls: "border-border bg-muted/30 text-muted-foreground",+ },+ };+return (<div className="flex h-full flex-col overflow-y-auto scrollbar-jarvis"><ViewHeader@@ -46,33 +224,195 @@ export function FeedbackView() {subtitle={t("feedback.subtitle")}/>- <div className="flex flex-1 items-center justify-center p-6">- <div className="w-full max-w-md rounded-2xl border border-[#5865F2]/40 bg-[#5865F2]/10 p-8 text-center">- <div className="mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-2xl bg-[#5865F2]/20">- <DiscordIcon className="h-9 w-9 text-[#5865F2]" />+ <div className="flex flex-1 justify-center p-6">+ <div className="w-full max-w-md space-y-6 pb-8">+ {/* Primary path: the Discord community. */}+ <div className="rounded-2xl border border-[#5865F2]/40 bg-[#5865F2]/10 p-8 text-center">+ <div className="mx-auto mb-5 flex h-16 w-16 items-center justify-center rounded-2xl bg-[#5865F2]/20">+ <DiscordIcon className="h-9 w-9 text-[#5865F2]" />+ </div>+ <h2 className="mb-2 text-lg font-semibold text-foreground">+ {t("feedback.discord_cta_title")}+ </h2>+ <p className="mb-6 text-sm text-muted-foreground">+ {t("feedback.discord_cta_subtitle")}+ </p>+ <div className="space-y-3">+ <button+ type="button"+ onClick={() => void openExternalUrl(DISCORD_BUG_FORUM_URL)}+ className="w-full rounded-lg bg-[#5865F2] px-4 py-3 text-sm font-semibold text-white transition hover:bg-[#4752c4]"+ >+ {t("feedback.discord_cta_button")}+ </button>+ <button+ type="button"+ onClick={() => void openExternalUrl(DISCORD_INVITE_URL)}+ className="w-full rounded-lg border border-[#5865F2]/40 px-4 py-2.5 text-sm font-medium text-[#8b94ff] transition hover:border-[#5865F2]/70 hover:bg-[#5865F2]/10"+ >+ {t("feedback.discord_join_button")}+ </button>+ </div></div>- <h2 className="mb-2 text-lg font-semibold text-foreground">- {t("feedback.discord_cta_title")}- </h2>- <p className="mb-6 text-sm text-muted-foreground">- {t("feedback.discord_cta_subtitle")}- </p>- <div className="space-y-3">- <button- type="button"- onClick={() => void openExternalUrl(DISCORD_BUG_FORUM_URL)}- className="w-full rounded-lg bg-[#5865F2] px-4 py-3 text-sm font-semibold text-white transition hover:bg-[#4752c4]"- >- {t("feedback.discord_cta_button")}- </button>++ <div className="flex items-center gap-3" aria-hidden="true">+ <div className="h-px flex-1 bg-border" />+ <span className="text-xs uppercase tracking-wider text-muted-foreground">+ {t("feedback.or_send_here")}+ </span>+ <div className="h-px flex-1 bg-border" />+ </div>++ {/* Secondary path: the in-app form (direct dispatch or GitHub issue). */}+ <form+ onSubmit={(ev) => void onSubmit(ev)}+ className="space-y-4 rounded-2xl border border-border bg-card/60 p-6"+ >+ <div>+ <span+ id="feedback-type-label"+ className="mb-1.5 block text-xs font-medium text-muted-foreground"+ >+ {t("feedback.type_label")}+ </span>+ <div+ role="radiogroup"+ aria-labelledby="feedback-type-label"+ className="grid grid-cols-3 gap-2"+ >+ {typeOptions.map(({ value, label, icon: Icon }) => (+ <button+ key={value}+ type="button"+ role="radio"+ aria-checked={type === value}+ onClick={() => setType(value)}+ className={+ "flex items-center justify-center gap-1.5 rounded-lg border px-2 py-2 text-sm transition " ++ (type === value+ ? "border-primary/60 bg-primary/15 font-medium text-foreground"+ : "border-border text-muted-foreground hover:border-primary/40 hover:text-foreground")+ }+ >+ <Icon className="h-4 w-4" aria-hidden="true" />+ {label}+ </button>+ ))}+ </div>+ </div>++ <div>+ <label+ htmlFor="feedback-title"+ className="mb-1.5 block text-xs font-medium text-muted-foreground"+ >+ {t("feedback.title_label")}+ </label>+ <input+ id="feedback-title"+ type="text"+ value={title}+ maxLength={TITLE_MAX}+ onChange={(ev) => setTitle(ev.target.value)}+ placeholder={t("feedback.title_placeholder")}+ className={INPUT_CLS}+ />+ </div>++ <div>+ <label+ htmlFor="feedback-description"+ className="mb-1.5 block text-xs font-medium text-muted-foreground"+ >+ {t("feedback.description_label")}+ </label>+ <textarea+ id="feedback-description"+ rows={5}+ value={description}+ maxLength={DESCRIPTION_MAX}+ onChange={(ev) => setDescription(ev.target.value)}+ placeholder={t("feedback.description_placeholder")}+ className={`${INPUT_CLS} resize-y`}+ />+ </div>++ {/* A GitHub issue URL cannot carry an image, so the screenshot+ picker only appears when the direct channel exists. */}+ {channel?.configured ? (+ <div>+ <span className="mb-1.5 block text-xs font-medium text-muted-foreground">+ {t("feedback.screenshot_label")}+ </span>+ {screenshot ? (+ <div className="relative overflow-hidden rounded-lg border border-border">+ <img+ src={screenshot}+ alt={t("feedback.screenshot_preview_alt")}+ className="max-h-48 w-full bg-background object-contain"+ />+ <button+ type="button"+ onClick={() => setScreenshot(null)}+ aria-label={t("feedback.screenshot_remove")}+ className="absolute right-2 top-2 rounded-md bg-background/80 p-1 text-muted-foreground transition hover:text-foreground"+ >+ <X className="h-4 w-4" aria-hidden="true" />+ </button>+ </div>+ ) : (+ <button+ type="button"+ onClick={() => fileRef.current?.click()}+ className="flex w-full items-center justify-center gap-2 rounded-lg border border-dashed border-border px-3 py-4 text-sm text-muted-foreground transition hover:border-primary/50 hover:text-foreground"+ >+ <ImagePlus className="h-4 w-4" aria-hidden="true" />+ {t("feedback.screenshot_pick")}+ </button>+ )}+ <input+ ref={fileRef}+ type="file"+ accept="image/*"+ className="hidden"+ onChange={onPickScreenshot}+ />+ {screenshotTooLarge ? (+ <p className="mt-1.5 text-xs text-red-400" role="alert">+ {t("feedback.screenshot_too_large")}+ </p>+ ) : null}+ </div>+ ) : null}++ {githubMode ? (+ <p className="text-xs leading-relaxed text-muted-foreground">+ {t("feedback.github_hint")}+ </p>+ ) : null}++ {result ? (+ <p+ role="status"+ className={`rounded-lg border px-3 py-2 text-sm ${resultBanner[result].cls}`}+ >+ {resultBanner[result].text}+ </p>+ ) : null}+<button- type="button"- onClick={() => void openExternalUrl(DISCORD_INVITE_URL)}- className="w-full rounded-lg border border-[#5865F2]/40 px-4 py-2.5 text-sm font-medium text-[#8b94ff] transition hover:border-[#5865F2]/70 hover:bg-[#5865F2]/10"+ type="submit"+ disabled={!canSubmit}+ className="flex w-full items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2.5 text-sm font-semibold text-primary-foreground transition hover:bg-primary/90 disabled:cursor-not-allowed disabled:opacity-50">- {t("feedback.discord_join_button")}+ {githubMode ? <ExternalLink className="h-4 w-4" aria-hidden="true" /> : null}+ {sending+ ? t("feedback.sending")+ : githubMode+ ? t("feedback.github_submit")+ : t("feedback.submit")}</button>- </div>+ </form></div></div></div>diff --git a/jarvis/ui/web/frontend/src/views/feedback/api.ts b/jarvis/ui/web/frontend/src/views/feedback/api.tsindex 47f0efd619..aeb941b445 100644--- a/jarvis/ui/web/frontend/src/views/feedback/api.ts+++ b/jarvis/ui/web/frontend/src/views/feedback/api.ts@@ -23,8 +23,32 @@ export interface FeedbackResult {github_url?: string | null;}+/** System fields the server would attach to a dispatched report. */+export interface FeedbackContext {+ app_version: string;+ os: string;+ python: string;+}++/**+ * Capability probe (GET /api/feedback/status). `configured: false` is the+ * default on every fresh install — the operator webhook is the maintainer's+ * own credential — and the form then routes to a prefilled GitHub issue.+ */+export interface FeedbackChannelStatus {+ configured: boolean;+ github_url: string;+ context: FeedbackContext;+}+const BASE = "/api/feedback";+export async function fetchFeedbackStatus(): Promise<FeedbackChannelStatus> {+ const res = await fetch(`${BASE}/status`, { cache: "no-store" });+ if (!res.ok) throw new Error(`${res.status} ${res.statusText}`);+ return (await res.json()) as FeedbackChannelStatus;+}+export async function submitFeedback(payload: FeedbackPayload): Promise<FeedbackResult> {const res = await fetch(BASE, {method: "POST",diff --git a/tests/unit/ui/web/test_feedback_routes.py b/tests/unit/ui/web/test_feedback_routes.pyindex f8500559c2..a9c276a6a7 100644--- a/tests/unit/ui/web/test_feedback_routes.py+++ b/tests/unit/ui/web/test_feedback_routes.py@@ -11,6 +11,8 @@ configure a credential that is meaningless for them."""from __future__ import annotations+from pathlib import Path+import pytestfrom fastapi import FastAPIfrom fastapi.testclient import TestClient@@ -75,3 +77,51 @@ def test_no_webhook_configured_does_not_instruct_setting_a_credential(assert "discord_feedback_webhook_url" not in detail_lowerassert "environment variable" not in detail_lowerassert "credential" not in detail_lower+++# ----------------------------------------------------------------------+# GET /api/feedback/status — the capability probe the form renders from+# ----------------------------------------------------------------------+++def test_status_not_configured_offers_github_fallback(client: TestClient, monkeypatch) -> None:+ """Fresh install (no webhook) -> configured=False plus everything the+ frontend needs to compose a prefilled GitHub issue instead."""+ import jarvis.ui.web.feedback_routes as feedback_routes++ monkeypatch.setattr(feedback_routes, "get_secret", lambda *a, **k: None)++ resp = client.get("/api/feedback/status")++ assert resp.status_code == 200+ body = resp.json()+ assert body["configured"] is False+ assert body["github_url"] == GITHUB_ISSUES_URL+ # The same system fields the POST route would attach server-side.+ assert set(body["context"]) == {"app_version", "os", "python"}+ assert all(isinstance(v, str) and v for v in body["context"].values())+++def test_status_configured_never_leaks_the_webhook_url(client: TestClient, monkeypatch) -> None:+ """Operator install (webhook present) -> configured=True; the webhook URL+ itself (an operator credential) must never appear in the response."""+ import jarvis.ui.web.feedback_routes as feedback_routes++ webhook_url = "https://discord.com/api/webhooks/123/abc" # test dummy+ monkeypatch.setattr(feedback_routes, "get_secret", lambda *a, **k: webhook_url)++ resp = client.get("/api/feedback/status")++ assert resp.status_code == 200+ body = resp.json()+ assert body["configured"] is True+ assert webhook_url not in resp.text+++def test_app_version_pyproject_fallback_reads_repo_root() -> None:+ """The pyproject.toml fallback must resolve to the real repo root — it+ regressed once by pointing one directory ABOVE it (parents[4])."""+ import jarvis.ui.web.feedback_routes as feedback_routes++ root = Path(feedback_routes.__file__).resolve().parents[3]+ assert (root / "pyproject.toml").is_file()