Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/dev-deploy-vercel-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ jobs:
- name: Build Project Artifacts
run: vercel build --target=staging --token=${{ secrets.VERCEL_TOKEN }}
working-directory: echo/frontend
env:
POSTHOG_SOURCEMAPS: "1"

# Best-effort: symbolication is a nice-to-have, so a PostHog outage must
# never block a deploy. The cleanup step below always strips maps from
# the bundle, so nothing leaks even if upload fails.
- name: Upload source maps to PostHog
continue-on-error: true
working-directory: echo/frontend
env:
POSTHOG_CLI_HOST: https://eu.posthog.com
POSTHOG_CLI_PROJECT_ID: "197841"
POSTHOG_CLI_API_KEY: ${{ secrets.POSTHOG_CLI_API_KEY }}
run: |
pnpm dlx @posthog/cli@0.16.0 sourcemap inject --directory .vercel/output/static
pnpm dlx @posthog/cli@0.16.0 sourcemap upload --directory .vercel/output/static

- name: Remove source maps from deploy bundle
if: always()
working-directory: echo/frontend
run: find .vercel/output/static -name '*.map' -type f -delete || true

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --target=staging --token=${{ secrets.VERCEL_TOKEN }}
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/prod-deploy-vercel-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,27 @@ jobs:
- name: Build Project Artifacts
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
working-directory: echo/frontend
env:
POSTHOG_SOURCEMAPS: "1"

# Best-effort: symbolication is a nice-to-have, so a PostHog outage must
# never block a release. The cleanup step below always strips maps from
# the bundle, so nothing leaks even if upload fails.
- name: Upload source maps to PostHog
continue-on-error: true
working-directory: echo/frontend
env:
POSTHOG_CLI_HOST: https://eu.posthog.com
POSTHOG_CLI_PROJECT_ID: "160282"
POSTHOG_CLI_API_KEY: ${{ secrets.POSTHOG_CLI_API_KEY }}
run: |
pnpm dlx @posthog/cli@0.16.0 sourcemap inject --directory .vercel/output/static
pnpm dlx @posthog/cli@0.16.0 sourcemap upload --directory .vercel/output/static

- name: Remove source maps from deploy bundle
if: always()
working-directory: echo/frontend
run: find .vercel/output/static -name '*.map' -type f -delete || true

- name: Deploy Project Artifacts to Vercel
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
Expand Down
3 changes: 2 additions & 1 deletion echo/frontend/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ PostHog is the only analytics tool (Plausible was migrated and removed). Pagevie
- Grep for `posthog.capture(` to see the live event set; auth, project, chat, report, conversation, and workspace-request flows are covered
- Dashboard + insights live in the PostHog EU projects (production id 160282, echo-next id 197841). Don't add new dashboards from code; wire the event and let analytics own the visualization
- Insights, cohorts, and other PostHog artifacts must always be created in both projects (echo production and echo-next), never just one
- One-off error reports use `posthog.captureException`, not a capture event (see `ErrorBoundary`, participant audio interruption)
- One-off error reports use `posthog.captureException`, not a capture event (see `ErrorBoundary`, participant audio interruption). Don't report expected server rejections: a handled 4xx already shown to the user as a toast just churns error tracking. See `captureUnexpectedError` in `src/components/conversation/hooks/index.ts` (reports only 5xx, network, and non-Axios errors)
- Source maps upload to PostHog during the dashboard deploy, so minified frames symbolicate and issue fingerprints stay stable across deploys. `vite build` emits maps only when `POSTHOG_SOURCEMAPS=1` (set by the deploy workflows); the workflow injects and uploads via `@posthog/cli`, then strips the maps from the bundle. Needs the `POSTHOG_CLI_API_KEY` repo secret (personal API key, `error_tracking:write` scope)

## Modal conventions

Expand Down
23 changes: 19 additions & 4 deletions echo/frontend/src/components/conversation/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ import {
} from "@/lib/api";
import { bff } from "@/lib/bff";

// The chat-context mutations already tell the user what went wrong. The server
// answers expected rejections (conversation already attached, too long, or over
// the context budget) with a 4xx and a `detail` string that the onError handlers
// show as a toast. Filing those as exceptions only floods error-tracking triage.
// Report only failures we cannot explain to the user: 5xx responses, network
// errors, and non-Axios errors.
const captureUnexpectedError = (error: unknown) => {
const status =
error instanceof AxiosError ? error.response?.status : undefined;
if (status !== undefined && status >= 400 && status < 500) {
return;
}
posthog.captureException(error);
};

type ConversationBffListParams = {
search_text?: string;
sort?:
Expand Down Expand Up @@ -276,7 +291,7 @@ export const useAddChatContextMutation = () => {
}),
mutationKey: ["chat-context", "add"],
onError: (error, variables, context) => {
posthog.captureException(error);
captureUnexpectedError(error);
const mutationContext = context as
| AddChatContextMutationContext
| undefined;
Expand Down Expand Up @@ -387,7 +402,7 @@ export const useDeleteChatContextMutation = () => {
deleteChatContext(payload.chatId, payload.conversationId),
mutationKey: ["chat-context", "delete"],
onError: (error, variables, context) => {
posthog.captureException(error);
captureUnexpectedError(error);
// Only rollback the failed optimistic entry
const conversationId = (context as { conversationId?: string })
?.conversationId;
Expand Down Expand Up @@ -517,7 +532,7 @@ export const useClearChatContextMutation = () => {
},
mutationKey: ["chat-context", "clear"],
onError: (error) => {
posthog.captureException(error);
captureUnexpectedError(error);
toast.error(t`Failed to clear conversations`);
},
onSettled: (_, __, variables) => {
Expand All @@ -531,7 +546,7 @@ export const useClearChatContextMutation = () => {
return;
}
for (const failure of failed) {
posthog.captureException(failure.reason);
captureUnexpectedError(failure.reason);
}
if (cleared === 0) {
toast.error(t`Failed to clear conversations`);
Expand Down
24 changes: 12 additions & 12 deletions echo/frontend/src/locales/cs-CZ.po
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,7 @@ msgstr "Clear filters"
msgid "Clear search"
msgstr "Clear search"

#: src/components/conversation/hooks/index.ts:540
#: src/components/conversation/hooks/index.ts:555
msgid "Cleared {cleared} of {total} conversations"
msgstr ""

Expand Down Expand Up @@ -2605,7 +2605,7 @@ msgstr "conversation"
msgid "Conversation"
msgstr "Conversation"

#: src/components/conversation/hooks/index.ts:378
#: src/components/conversation/hooks/index.ts:393
msgid "Conversation added to chat"
msgstr "Conversation added to chat"

Expand All @@ -2614,7 +2614,7 @@ msgstr "Conversation added to chat"
msgid "participant.conversation.ended"
msgstr "Conversation Ended"

#: src/components/conversation/hooks/index.ts:494
#: src/components/conversation/hooks/index.ts:509
msgid "Conversation removed from chat"
msgstr "Conversation removed from chat"

Expand Down Expand Up @@ -2645,7 +2645,7 @@ msgstr "conversations"
msgid "Conversations"
msgstr "Conversations"

#: src/components/conversation/hooks/index.ts:530
#: src/components/conversation/hooks/index.ts:545
msgid "Conversations cleared"
msgstr ""

Expand Down Expand Up @@ -4089,12 +4089,12 @@ msgstr ""
msgid "Failed"
msgstr "Failed"

#: src/components/conversation/hooks/index.ts:313
#: src/components/conversation/hooks/index.ts:328
msgid "Failed to add conversation to chat"
msgstr "Failed to add conversation to chat"

#. placeholder {0}: error.response?.data?.detail ? `: ${error.response.data.detail}` : ""
#: src/components/conversation/hooks/index.ts:308
#: src/components/conversation/hooks/index.ts:323
msgid "Failed to add conversation to chat{0}"
msgstr "Failed to add conversation to chat{0}"

Expand All @@ -4108,8 +4108,8 @@ msgstr "Failed to add conversations to context"
msgid "Failed to approve outcome. Please try again."
msgstr "Failed to approve outcome. Please try again."

#: src/components/conversation/hooks/index.ts:521
#: src/components/conversation/hooks/index.ts:537
#: src/components/conversation/hooks/index.ts:536
#: src/components/conversation/hooks/index.ts:552
msgid "Failed to clear conversations"
msgstr ""

Expand Down Expand Up @@ -4206,12 +4206,12 @@ msgstr "Failed to reload. Please try again."
msgid "Failed to remove avatar"
msgstr "Failed to remove avatar"

#: src/components/conversation/hooks/index.ts:439
#: src/components/conversation/hooks/index.ts:454
msgid "Failed to remove conversation from chat"
msgstr "Failed to remove conversation from chat"

#. placeholder {0}: error.response?.data?.detail ? `: ${error.response.data.detail}` : ""
#: src/components/conversation/hooks/index.ts:434
#: src/components/conversation/hooks/index.ts:449
msgid "Failed to remove conversation from chat{0}"
msgstr "Failed to remove conversation from chat{0}"

Expand All @@ -4223,7 +4223,7 @@ msgstr "Failed to remove logo"
msgid "Failed to reschedule. Please choose a time further in the future and try again."
msgstr "Failed to reschedule. Please choose a time further in the future and try again."

#: src/components/conversation/hooks/index.ts:637
#: src/components/conversation/hooks/index.ts:652
msgid "Failed to retranscribe conversation. Please try again."
msgstr "Failed to retranscribe conversation. Please try again."

Expand Down Expand Up @@ -5655,7 +5655,7 @@ msgstr "loading..."

#: src/components/conversation/ProjectConversationsPanel.tsx:164
#: src/components/conversation/ConversationAccordion.tsx:119
#: src/components/conversation/hooks/index.ts:351
#: src/components/conversation/hooks/index.ts:366
msgid "Loading..."
msgstr "Loading..."

Expand Down
24 changes: 12 additions & 12 deletions echo/frontend/src/locales/de-DE.po
Original file line number Diff line number Diff line change
Expand Up @@ -2354,7 +2354,7 @@ msgstr ""
msgid "Clear search"
msgstr ""

#: src/components/conversation/hooks/index.ts:540
#: src/components/conversation/hooks/index.ts:555
msgid "Cleared {cleared} of {total} conversations"
msgstr ""

Expand Down Expand Up @@ -2606,7 +2606,7 @@ msgstr "Gespräch"
msgid "Conversation"
msgstr "Gespräch"

#: src/components/conversation/hooks/index.ts:378
#: src/components/conversation/hooks/index.ts:393
msgid "Conversation added to chat"
msgstr "Gespräch zum Chat hinzugefügt"

Expand All @@ -2615,7 +2615,7 @@ msgstr "Gespräch zum Chat hinzugefügt"
msgid "participant.conversation.ended"
msgstr "Gespräch beendet"

#: src/components/conversation/hooks/index.ts:494
#: src/components/conversation/hooks/index.ts:509
msgid "Conversation removed from chat"
msgstr "Gespräch aus dem Chat entfernt"

Expand Down Expand Up @@ -2646,7 +2646,7 @@ msgstr "Gespräche"
msgid "Conversations"
msgstr "Gespräche"

#: src/components/conversation/hooks/index.ts:530
#: src/components/conversation/hooks/index.ts:545
msgid "Conversations cleared"
msgstr ""

Expand Down Expand Up @@ -4090,12 +4090,12 @@ msgstr ""
msgid "Failed"
msgstr "Fehlgeschlagen"

#: src/components/conversation/hooks/index.ts:313
#: src/components/conversation/hooks/index.ts:328
msgid "Failed to add conversation to chat"
msgstr "Fehler beim Hinzufügen des Gesprächs zum Chat"

#. placeholder {0}: error.response?.data?.detail ? `: ${error.response.data.detail}` : ""
#: src/components/conversation/hooks/index.ts:308
#: src/components/conversation/hooks/index.ts:323
msgid "Failed to add conversation to chat{0}"
msgstr "Fehler beim Hinzufügen des Gesprächs zum Chat{0}"

Expand All @@ -4109,8 +4109,8 @@ msgstr "Fehler beim Hinzufügen von Unterhaltungen zum Kontext"
msgid "Failed to approve outcome. Please try again."
msgstr "Ergebnis konnte nicht freigegeben werden. Bitte versuchen Sie es erneut."

#: src/components/conversation/hooks/index.ts:521
#: src/components/conversation/hooks/index.ts:537
#: src/components/conversation/hooks/index.ts:536
#: src/components/conversation/hooks/index.ts:552
msgid "Failed to clear conversations"
msgstr ""

Expand Down Expand Up @@ -4207,12 +4207,12 @@ msgstr "Neu laden fehlgeschlagen. Bitte versuchen Sie es erneut."
msgid "Failed to remove avatar"
msgstr "Avatar konnte nicht entfernt werden"

#: src/components/conversation/hooks/index.ts:439
#: src/components/conversation/hooks/index.ts:454
msgid "Failed to remove conversation from chat"
msgstr "Fehler beim Entfernen des Gesprächs aus dem Chat"

#. placeholder {0}: error.response?.data?.detail ? `: ${error.response.data.detail}` : ""
#: src/components/conversation/hooks/index.ts:434
#: src/components/conversation/hooks/index.ts:449
msgid "Failed to remove conversation from chat{0}"
msgstr "Fehler beim Entfernen des Gesprächs aus dem Chat{0}"

Expand All @@ -4224,7 +4224,7 @@ msgstr "Logo konnte nicht entfernt werden"
msgid "Failed to reschedule. Please choose a time further in the future and try again."
msgstr "Neuplanung fehlgeschlagen. Bitte wahlen Sie einen spateren Zeitpunkt und versuchen Sie es erneut."

#: src/components/conversation/hooks/index.ts:637
#: src/components/conversation/hooks/index.ts:652
msgid "Failed to retranscribe conversation. Please try again."
msgstr "Fehler beim Hertranskribieren des Gesprächs. Bitte versuchen Sie es erneut."

Expand Down Expand Up @@ -5656,7 +5656,7 @@ msgstr "wird geladen..."

#: src/components/conversation/ProjectConversationsPanel.tsx:164
#: src/components/conversation/ConversationAccordion.tsx:119
#: src/components/conversation/hooks/index.ts:351
#: src/components/conversation/hooks/index.ts:366
msgid "Loading..."
msgstr "Laden..."

Expand Down
Loading
Loading