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(support): only append the Sentry ref where the destination consumes it\n\ntinysweeper's review point on #5953: the crash screen appends\n`?ref=<sentryEventId>` to SUPPORT_URL, and a Discord invite renders a join\npage and drops the query. The link still resolves — verified, 200, and the ref\neven survives the redirect to discord.com — but nothing consumes it, so the\ncorrelation the ref exists for silently stops happening while the URL still\nlooks like it carries the crash id.\n\nAdds SUPPORT_URL_ACCEPTS_REF, true only when VITE_SUPPORT_URL names a real\nsupport endpoint. The crash screen opens the bare URL when it is false; the\nSentry `support_url` tag is omitted entirely rather than degraded to a\nconstant string on every event, which would be noise rather than a deep link.\nThe Error ID stays copyable on the crash screen, so the path into a Discord\nthread is unchanged — what goes away is the false promise.\n\nAlso imports DISCORD_INVITE_URL from links.ts instead of repeating the literal\n(links.ts has no imports, so there is no cycle), and rewrites the doc comment,\nwhich still described a correlation mechanism the new default cannot honour.\n\nCoverage: the existing tests both `vi.mock` utils/config, so nothing observed\nthe shipped constant — reverting it to the dead /support URL left the suite\ngreen. supportUrl.test.ts reads the real module (dynamic import after an\nexplicit unmock, since a sibling file's mock of the same path otherwise reaches\nit) and closes that. Verified: 50 passed across the three files; with the URL\nreverted, 2 fail.\n
M3gA-Mind6e5816aafbb3
diff --git a/app/src/components/ErrorFallbackScreen.test.tsx b/app/src/components/ErrorFallbackScreen.test.tsxindex ee53f93e95..9d55a7b212 100644--- a/app/src/components/ErrorFallbackScreen.test.tsx+++ b/app/src/components/ErrorFallbackScreen.test.tsx@@ -10,6 +10,10 @@ const hoisted = vi.hoisted(() => ({openUrl: vi.fn(),safeInvoke: vi.fn().mockResolvedValue(undefined),isAnalyticsEnabled: vi.fn(() => true),+ // Whether the configured support destination can consume `?ref=`. True in+ // the default fixture because the mocked SUPPORT_URL models a real support+ // endpoint (an env override); flipped false by the Discord-default test.+ supportUrlAcceptsRef: { value: true },}));vi.mock('../utils/openUrl', () => ({ openUrl: hoisted.openUrl }));@@ -18,6 +22,9 @@ vi.mock('../services/analytics', () => ({ isAnalyticsEnabled: hoisted.isAnalyticvi.mock('../utils/config', () => ({SUPPORT_URL: 'https://support.example/help',LATEST_APP_DOWNLOAD_URL: 'https://downloads.example/latest',+ get SUPPORT_URL_ACCEPTS_REF() {+ return hoisted.supportUrlAcceptsRef.value;+ },}));const baseProps = {@@ -27,6 +34,7 @@ const baseProps = {};afterEach(() => {+ hoisted.supportUrlAcceptsRef.value = true;vi.clearAllMocks();hoisted.isAnalyticsEnabled.mockReturnValue(true);});@@ -74,6 +82,20 @@ describe('ErrorFallbackScreen', () => {);});+ test('does not append a ref when the destination cannot consume one', () => {+ // The shipped default is a Discord invite: it renders a join page and+ // drops the query, so a `?ref=` there would look like it carried the crash+ // id while doing nothing (tinysweeper on #5953). The Error ID is still+ // rendered above for the user to copy into the thread.+ hoisted.supportUrlAcceptsRef.value = false;+ render(<ErrorFallbackScreen {...baseProps} eventId="id/with space" />);+ fireEvent.click(screen.getByText('app.errorFallback.contactSupport'));+ expect(hoisted.openUrl).toHaveBeenCalledWith('https://support.example/help');+ expect(hoisted.openUrl).not.toHaveBeenCalledWith(+ expect.stringContaining('ref=')+ );+ });+test('reveals the logs folder via the tauri command', () => {render(<ErrorFallbackScreen {...baseProps} eventId="x" />);fireEvent.click(screen.getByText('app.errorFallback.revealLogs'));diff --git a/app/src/components/ErrorFallbackScreen.tsx b/app/src/components/ErrorFallbackScreen.tsxindex 0678423429..4e9fac0fcb 100644--- a/app/src/components/ErrorFallbackScreen.tsx+++ b/app/src/components/ErrorFallbackScreen.tsx@@ -2,7 +2,7 @@ import { useState } from 'react';import { useT } from '../lib/i18n/I18nContext';import { isAnalyticsEnabled } from '../services/analytics';-import { LATEST_APP_DOWNLOAD_URL, SUPPORT_URL } from '../utils/config';+import { LATEST_APP_DOWNLOAD_URL, SUPPORT_URL, SUPPORT_URL_ACCEPTS_REF } from '../utils/config';import { openUrl } from '../utils/openUrl';import { safeInvoke as invoke } from '../utils/tauriCommands/common';@@ -71,6 +71,15 @@ export default function ErrorFallbackScreen({const openSupport = () => {if (!hasEventId) return;+ // Only a configured support endpoint can consume the ref. The default+ // destination is a Discord invite, which renders a join page and drops the+ // query — appending one there would look like it carried the crash id+ // while doing nothing (tinysweeper on #5953). The Error ID stays copyable+ // above, which is how it reaches a Discord thread.+ if (!SUPPORT_URL_ACCEPTS_REF) {+ openUrl(SUPPORT_URL);+ return;+ }// `&` when SUPPORT_URL already carries a query (env override) so the ref// never produces a malformed double-`?` link.const sep = SUPPORT_URL.includes('?') ? '&' : '?';diff --git a/app/src/services/__tests__/analytics.test.ts b/app/src/services/__tests__/analytics.test.tsindex 4f8924daf9..0df4f31b33 100644--- a/app/src/services/__tests__/analytics.test.ts+++ b/app/src/services/__tests__/analytics.test.ts@@ -74,6 +74,9 @@ vi.mock('../../utils/config', () => ({SENTRY_RELEASE: 'openhuman@test+abc',SENTRY_SMOKE_TEST: false,SUPPORT_URL: 'https://support.example/help',+ // The mocked SUPPORT_URL models a configured endpoint (an env override),+ // which is the case that can consume `?ref=`.+ SUPPORT_URL_ACCEPTS_REF: true,TAURI_CARGO_VERSION: '0.57.4',// analytics.ts now imports CoreRpcError from coreRpcClient, whose// dependency chain reads CORE_RPC_URL and CORE_RPC_TIMEOUT_MS. Providediff --git a/app/src/services/analytics.ts b/app/src/services/analytics.tsindex 19f9f92a6d..c675a07ca5 100644--- a/app/src/services/analytics.ts+++ b/app/src/services/analytics.ts@@ -33,6 +33,7 @@ import {SENTRY_RELEASE,SENTRY_SMOKE_TEST,SUPPORT_URL,+ SUPPORT_URL_ACCEPTS_REF,TAURI_CARGO_VERSION,} from '../utils/config';import { startInteractionTracking } from './analyticsInteractions';@@ -229,7 +230,12 @@ export function initSentry(): void {// event id is known here and tags survive. The URL carries only the// event's own id + a static base (no PII). Mirrors the id the user// sees + copies on `ErrorFallbackScreen`.- if (event.event_id) {+ // Only a configured support endpoint can consume the ref. The default+ // destination is a Discord invite that ignores the query, and this tag+ // exists to carry the correlation — without one it degrades to the same+ // constant string on every event, which is noise rather than a deep+ // link, so it is omitted instead (#5953).+ if (event.event_id && SUPPORT_URL_ACCEPTS_REF) {const sep = SUPPORT_URL.includes('?') ? '&' : '?';event.tags.support_url = `${SUPPORT_URL}${sep}ref=${event.event_id}`;}diff --git a/app/src/utils/config.ts b/app/src/utils/config.tsindex e66b5d1b3a..114b846597 100644--- a/app/src/utils/config.ts+++ b/app/src/utils/config.ts@@ -1,3 +1,5 @@+import { DISCORD_INVITE_URL } from './links';+import packageJson from '../../package.json';const APP_ENV = (import.meta.env.VITE_OPENHUMAN_APP_ENV as string | undefined)@@ -246,10 +248,36 @@ export const OPENHUMAN_GITHUB_REPO_URL = ((): string => {}})();-/** Support page base URL. The crash screen appends `?ref=<sentryEventId>` so support can correlate a user's pasted Error ID to the exact Sentry event. Override via VITE_SUPPORT_URL for deployment-specific support endpoints. */-export const SUPPORT_URL =- (import.meta.env.VITE_SUPPORT_URL as string | undefined)?.trim() ||- 'https://discord.tinyhumans.ai';+const SUPPORT_URL_OVERRIDE = (import.meta.env.VITE_SUPPORT_URL as string | undefined)?.trim();++/**+ * Where "Contact Support" on the crash screen sends the user.+ *+ * The default is the community Discord — `https://tinyhumans.ai/support` 404s+ * (#5870). It is the same value as `links.ts`'s `DISCORD_INVITE_URL` and is+ * imported from there rather than repeated, so moving the vanity domain is one+ * edit and not two.+ *+ * Override with `VITE_SUPPORT_URL` for a deployment that runs a real support+ * endpoint. See {@link SUPPORT_URL_ACCEPTS_REF} for why that distinction is+ * load-bearing rather than cosmetic.+ */+export const SUPPORT_URL = SUPPORT_URL_OVERRIDE || DISCORD_INVITE_URL;++/**+ * Whether {@link SUPPORT_URL} is a destination that can consume+ * `?ref=<sentryEventId>`.+ *+ * Only an explicitly configured endpoint can: a Discord invite renders a join+ * page and ignores the query entirely, so appending a ref there produces a+ * link that looks like it carries the crash id and does not — the correlation+ * the ref exists for silently stops happening (tinysweeper on #5953).+ *+ * The crash screen still surfaces the Error ID as copyable text+ * (`ErrorFallbackScreen`), so the user can carry it into the Discord thread by+ * hand; what this flag removes is the *false* promise, not the path.+ */+export const SUPPORT_URL_ACCEPTS_REF = Boolean(SUPPORT_URL_OVERRIDE);/*** Set `VITE_SENTRY_SMOKE_TEST=true` in one build (or in `.env.local`) todiff --git a/app/src/utils/supportUrl.test.ts b/app/src/utils/supportUrl.test.tsnew file mode 100644index 0000000000..2bc7f87862--- /dev/null+++ b/app/src/utils/supportUrl.test.ts@@ -0,0 +1,53 @@+import { beforeEach, describe, expect, test, vi } from 'vitest';++import { DISCORD_INVITE_URL } from './links';++/**+ * These read the REAL `config.ts`, deliberately.+ *+ * Every other test that touches `SUPPORT_URL` mocks the module+ * (`ErrorFallbackScreen.test.tsx` and `analytics.test.ts` both `vi.mock`+ * `../utils/config`, which resolves to this same file), so none of them can+ * observe the shipped value — reverting the constant to the dead+ * `https://tinyhumans.ai/support` would leave the whole suite green. This file+ * is what makes that a failing test (#5870, #5953).+ *+ * The import is dynamic, after an explicit unmock and module reset, because a+ * sibling file's `vi.mock` of the same path otherwise reaches this one and the+ * assertions run against the stub instead of the real constant — which would+ * make them vacuous in exactly the way they exist to prevent.+ */+async function realConfig() {+ vi.resetModules();+ vi.doUnmock('./config');+ vi.doUnmock('../utils/config');+ return import('./config');+}++describe('SUPPORT_URL (real config)', () => {+ beforeEach(() => {+ vi.resetModules();+ });++ test('defaults to the community Discord, not the retired /support page', async () => {+ // `https://tinyhumans.ai/support` 404s — that is the bug #5870 reported.+ const { SUPPORT_URL } = await realConfig();+ expect(SUPPORT_URL).not.toContain('tinyhumans.ai/support');+ expect(SUPPORT_URL).toBe(DISCORD_INVITE_URL);+ });++ test('is a single source of truth shared with links.ts', async () => {+ // Not merely equal by coincidence: config.ts imports the constant, so the+ // vanity domain moves in one edit rather than two that can drift.+ const { SUPPORT_URL } = await realConfig();+ expect(SUPPORT_URL).toBe('https://discord.tinyhumans.ai');+ });++ test('does not claim to consume a ref by default', async () => {+ // With no VITE_SUPPORT_URL override the destination is a Discord invite,+ // which ignores the query. Callers key the `?ref=<sentryEventId>` append on+ // this flag, so a default build must not advertise it.+ const { SUPPORT_URL_ACCEPTS_REF } = await realConfig();+ expect(SUPPORT_URL_ACCEPTS_REF).toBe(false);+ });+});