mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-11-10 12:51:43 -10:00
### Why / What / How **Why:** The app collects almost no feedback at the moments that matter. Today there is the Tally form in the account menu, thumbs on Otto replies and a Sentry "Report Error". Nothing asks why someone cancels a trial, leaves checkout, or found a finished task disappointing. **What:** Six feedback prompts, live in the app with no feature flag, reshaped after the PM review (trial checkout and brain dump skip prompts cut, trial cancel back to one dialog). This PR started as Storybook prototypes and now wires them in, saving every answer through our backend. **How:** One `FeedbackPrompt` table records each showing, and an atomic `claim` applies the limits, so they hold across tabs and devices. Page-level prompts claim, then save each tap, and the backend forwards to PostHog. The browser PostHog client sends nothing until someone accepts analytics cookies, so answers never go that way. Two new Otto tools claim on the model's behalf and render chat cards, whose ratings use the existing reply-feedback path. A prompt never blocks what someone came to do: if saving fails, the trial still cancels, onboarding still moves on, and no toast appears. Linear: SECRT-3217 ### Changes 🏗️ | Prompt | Where it shows | Limit | Where the answer goes | |---|---|---|---| | Trial cancel | Inside the one "Cancel your trial?" dialog: optional reason chips, Keep trial and Cancel trial always shown | None | Database + PostHog, and Stripe `cancellation_details` | | Left upgrade checkout | On return to Billing. Only "My card didn't go through" offers "Try another card", which reopens the same checkout | None | Database + PostHog | | Work check | Under the reply that finished the work, once the turn ends, in Otto and expert chats | Shared wait | `$ai_metric`, as a `work_check` score | | Otto mistake | Inside the reply when Otto decides it got something wrong; no card when the user already said what went wrong | Once per chat | `$ai_metric`, as an `otto_mistake` score, plus `otto_mistake_flagged` | | Top-up | Inside the out-of-credits dialog, after "Not now" | Every 30 days, plus the shared wait | Database + PostHog | | Day 14 NPS | Any page, from day 14, for paying accounts that finished a workflow run or an Otto chat that week | Once, plus the shared wait | Database + PostHog | **Shared wait:** work check, top-up and NPS share one 7-day wait, and two "Not now"s in a row among them mean 30 days quiet. One advisory lock covers all three, so two tabs cannot both pass it. **Backend** - New `FeedbackPrompt` table and migration; a nullable `reason` column on `ChatMessageFeedback`. - `POST /api/feedback-prompts/claim`, `PATCH /api/feedback-prompts/{id}`, `GET /api/feedback-prompts/{id}`. - `data/feedback_prompts.py`: every query is scoped by `userId`, and another user's row returns 404. - New Otto tools `request_work_check` and `flag_mistake`, eager so they can render cards, and available in expert chats. `flag_mistake` takes an optional `reason` from the shared list; with one, no card asks again (the tool schema budget rises by 150 characters for it). Work checks are off on chat platforms, automation and delegated sessions. Mistake flags still reach PostHog there, with no card. - `POST /api/credits/trial/cancel` takes an optional `{reason, comment}` and passes it to Stripe as `cancellation_details` (`too_expensive`, `low_quality`, `missing_features`, `unused`, `other`). - New PostHog events: `feedback_prompt_shown`, `feedback_prompt_answered`, `otto_mistake_flagged`. An admin acting as a user creates no rows or events. **Frontend** - Prompts in `organisms/FeedbackPrompts/` take real callbacks. Options now have fixed values, so code no longer compares labels. - Mounted in the trial dialog, Billing, the top-up dialog, the chat and a new `PlatformShell`, which keeps an open NPS card alive across route changes. - The billing cancel URL now carries `plan` and `cycle`, so "Try another card" can reopen the same checkout. - Chat rating requests run in order per prompt and mark the card answered only after the rating saves. Delayed-write and failed-request tests cover both paths. - Review fixes: scores follow each prompt kind; unattended turns do not claim weekly work checks; mistake analytics omit free-form chat content; pending microphone starts cannot replace skip reasons; checkout prompts record dismissal and close on account changes; notes stop at 2,000 characters; cancellation attempts claim separate showings. - Polish pass: no pixel change. Checked the JSX and className diff: styles and layout are unchanged. The fixes change behavior, form limits, link destinations, generic tool labels, tests and generated docs. - Pixels: the PM review changes the look of the trial cancel dialog (one step), the out-of-credits dialog (a "Not now" button and a question step) and the NPS card (two rows of scores under 640px). Screenshots still to attach. ### Agents and large language models used - Claude Code with Claude Opus 5.5 - Codex with GPT-6 ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [ ] I have tested my changes according to the test plan: - [x] `black`, `isort`, `ruff` and `pyright` on the changed backend files - [x] `prettier`, `oxlint` and `eslint` on the changed frontend files - [x] 424 targeted frontend tests across 19 files pass locally (one worker) - [x] Backend route/tool registry: 25 tests pass; feedback route/tool/rating checks: 105 tests pass locally - [x] Required backend architecture and block tests: 4,175 pass, 84 known skips - [x] Full backend and E2E CI suites pass on `39d1ac5619`; repo review approved - [x] Review fixes (`6d9fdd7637`): 79 feedback route/chat tests pass; required backend architecture/block sweep passes 4,175 tests with 84 known skips (local ClamAV disabled); frontend format/lint/types and targeted Python format/lint/types pass. Full CI is running. - [ ] Each prompt checked by hand in a running app #### For frontend changes (design system, see `docs/engineering/design-system.md`): - [x] `pnpm format`, `pnpm lint` and `pnpm types` pass locally, including the `design-system/*` rules; I did not raise any count in `scripts/eslint-rules/design-system-baseline.json` except for a moved, renamed or split file (explained under **Changes**) - [x] No `dark:`/`light:` classes, raw palette classes (`bg-zinc-200`) or hex/`rgb()` colours (`bg-[#fff]`); colours use role tokens (`bg-surface`, `text-foreground-secondary`) - [x] No imports from `src/components/__legacy__`, `legacy/` paths or `@/components/ui`, and no `LegacyButton` / `legacy-*` Button variants - [x] Copy uses the `Text` atom with a `variant`/`tone`; primitives get a `variant`/`size`. `className` holds layout, plus on `Text` only truncation, line clamping, wrapping, breaking, `text-balance`/`text-pretty` and alignment - [ ] Before/after screenshots at 1440 and 390 px are attached for changes to `src/components/**`, `globals.css` or `tailwind*.ts`, or I wrote "no pixel change" and how I checked - [x] User-facing copy says workflow and Otto, never agent or graph (root `AGENTS.md`, "User-facing copy") #### For configuration changes: - [x] `.env.default` is updated or already compatible with my changes - [x] `docker-compose.yml` is updated or already compatible with my changes - [x] I have included a list of my configuration changes in the PR description (under **Changes**) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]> Co-authored-by: GPT-6 (Codex) <[email protected]>