Skip to content

Onboarding: auto-create the recurring task and cut clicks-to-activation #1941

Open

Description

@sweetmantech

Tracking issue for reducing clicks-to-activation in the /setup onboarding wizard, plus the defects found in a full cold-start walkthrough on prod (2026-08-06). The wizard shipped #1888 → #1895 (2026-07-23 → 2026-07-28) and works end-to-end today — a brand-new account reached a measured catalog and an enabled weekly task in ~7 minutes. The problem is no longer breakage, it's drop-off: 12 signups since the wizard went live, 0 activated.

Definition of "fully onboarded" (Sweets, 2026-08-06): an account has both a measured catalog and a recurring task. Task creation should be automatic — no explicit click — to raise activation rate.

Decision — cadence is monthly, anchored to creation time (Sweets, 2026-08-06). The auto-created task runs once per month, on the same date and time it was created — a task created 2026-08-14 at 15:20 UTC gets 20 15 14 * *. This supersedes the shipped wizard's weekly default (0 9 * * 1, verified on the walkthrough account), which was hardcoded to Monday 9am regardless of when the user onboarded. Row 1 therefore changes the default cron and all "every Monday" copy, not just the click.

Goal

A new signup reaches catalog-measured + recurring-task-enabled without clicking a task-creation button. Today /setup/tasks renders a Get this every Monday? prompt with Yes, every Monday / Not now; the task row in scheduled_actions is only written after that click, and the schedule is hardcoded weekly-Monday-9am. Target end state: the task is created as part of the first-report run, on a monthly cron anchored to the creation date/time, with the prompt demoted to an undo/opt-out affordance rather than a gate.

Secondary: remove the friction found alongside it — wrong empty-state copy on the first screen, a raw agent-log wall during report generation, and an error toast on cold load.

PRs (updated 2026-08-06)

PR Item State
chat#TBD Auto-create the recurring task on first-report completion — monthly cron anchored to creation date/time (m H D * *); demote the confirm prompt to opt-out ⏳ not started
chat#TBD Fix /setup/artists zero-artist copy (Add another artist → Add your first artist; disabled primary CTA) ⏳ not started
chat#TBD Replace raw bash/tool-log stream on /setup/tasks with progress states ⏳ not started
chat#TBD Fix An error occurred, please try again! toast on every page load — GET /api/accounts/undefined/credits 400s twice ⏳ not started
chat#TBD Render ask_user_question in the chat UI + wire addToolResult reply path ⏳ not started
api#TBD Default multiSelect in the ask_user_question schema so first calls stop being rejected ⏳ not started
api#TBD Record accountId + rejection reason in logEmailAttempt on the rejected path ⏳ not started
chat#TBD Instrument /setup step transitions so drop-off is measurable per step ⏳ not started

Merge sequencing: rows 2–4 are independent and can land in any order. Row 1 depends on the cadence decision above. Row 5 depends on row 6 (fix the schema before building the UI against it). Row 7 is independent and should land first of the api rows — it is the prerequisite for diagnosing the delivery failures in the "Delivery" bucket.

What shipped (context)

The wizard is four steps under app/setup/: artists → socials → valuation → tasks. Shipped across four PRs, 2026-07-23 → 2026-07-28:

  • #1888 a2d8cf8b — add /setup pages for welcome-email links
  • #1887 7168ac66 — retire /onboarding/* into /setup/*
  • #1890 830b6eb7 — converge home onto /setup at the derived step
  • #1895 d0913d1e — end setup on the catalog valuation

Cohort since the wizard went live (Privy signups joined to scheduled_actions, internal/test addresses excluded):

Cutoff Signups With enabled task
since 2026-07-23 (wizard live) 12 0
since 2026-07-28 (on home) 5 0

For contrast, historical activation: of 48 real customers who ever created a task, 17 did it within 7 days of signup. The last same-week activation was info@justpushplay.co.uk on 2026-03-23.

Done

  • Verify the wizard works end-to-end on prod from a cold start.
    ✅ Verified 2026-08-06 on chat.recoupable.dev, brand-new Privy account sweetman+aug520261141@recoupable.com (account 8ea115ef-14b4-4b2a-b6e1-405e0a89cdb6).
    Cleared storage, confirmed logged out on both recoupable.dev and chat.recoupable.dev, signed up via Privy OTP, then walked all four steps. Spotify search returned the correct artist (Del Water Gap, 319.3K followers) as the first result; 1 social profile matched; valuation returned $2.1M (range $1.4M–$2.9M, 67 tracks measured); the first weekly report generated and emailed successfully; Yes, every Monday created the task.
    Verified in scheduled_actions: title="Weekly Catalog Report: Del Water Gap", schedule="0 9 * * 1", enabled=true. Three distinct emails sent, no duplicates: Welcome to Recoup (00:52:03), Your catalog valuation is ready (00:53:08), Del Water Gap - Weekly Streaming Report (00:56:01, Resend 67aa2cf3-8a39-4533-8099-dd7b5385d9a7). Test task subsequently disabled via PATCH /api/tasks {enabled:false}.

  • Rule out "the April migration deleted the task tool" as the cause of the activation gap.
    ✅ Verified 2026-08-06. create_task is live on the production MCP server — tools/list against https://api.recoupable.dev/mcp with a valid recoup_sk_ key returns 36 tools including create_task, update_task, delete_task, correctly schema'd. The tool was never lost in the #1697 lib/tools/ deletion; task creation via API works.

Open — activation (reduce clicks)

  • Auto-create the recurring task when the first report finishes, monthly on the creation date/time. (row 1)

    • Why: /setup/tasks gates task creation behind Get this every Monday? → Yes, every Monday. The user has already clicked Set up your weekly report to get there and waited ~4 minutes for the report — the second confirmation asks them to opt in to the thing they just asked for. Per the 2026-08-06 decision, catalog + recurring task is the definition of onboarded, so the click is pure funnel loss. The schedule is also currently hardcoded to Monday 9am (0 9 * * 1) regardless of when the user onboards.
    • Fix:
      1. On successful first-report completion, create the scheduled_actions row automatically — no click.
      2. Derive the cron from creation time: m H D * * where D/H/m are the day-of-month, hour, and minute the task was created. Created 2026-08-14 15:20 UTC → 20 15 14 * *.
      3. Replace the prompt with a confirmation + undo (Runs monthly on the 14th · Change / Turn off).
      4. Update all "every Monday" / "weekly report" copy on /setup/tasks and the valuation CTA to the monthly wording.
      5. Ensure Skip for now still exits without creating a task.
    • Done when: a fresh account that completes /setup/tasks has an enabled=true row in scheduled_actions with zero clicks after the CTA; its schedule matches the creation timestamp's day/hour/minute; and the confirmation UI turns it off in one click.
    • Edge case to decide: creation on the 29th/30th/31st. A literal 0 9 31 * * only fires in 7 months of the year, and 29/30 skip February — so an account onboarding late in the month would silently get a task that rarely (or never, for Feb 30/31) runs. Options: clamp D to 28, or clamp to the last valid day of each month at run time. Pick one before implementing; do not ship the naive value.
  • Fix the zero-artist empty state on /setup/artists. (row 2)

    • Why: with an empty roster the screen reads No artists on your roster yet. Add your first artist below… but the button underneath says Add another artist (there is no first one) and the primary CTA says This is my artist, continue while disabled (there is no artist). The copy was written for the pre-populated case. It self-corrects once an artist is added — but the broken version is the literal first screen a new account sees.
    • Fix: branch the empty state — button Add your first artist, and either hide the primary CTA or relabel it until artists.length > 0.
    • Done when: a fresh account at /setup/artists sees no copy referring to an artist that doesn't exist, and no disabled primary CTA.
  • Replace the raw agent-log stream on /setup/tasks with progress states. (row 3)

    • Why: after Set up your weekly report, the user watches ~4 minutes of raw tool output — repeated bash / Data processed blocks interleaved with "Let me check the response structure more carefully:" and "Let me use curl to get track data:". This is the highest-intent moment in the funnel rendered as a debug console. Strongest candidate for the 12→0 drop-off.
    • Fix: map agent steps to user-facing progress (Measuring 36 albums…, Gathering audience metrics…, Building your report…), keep the raw log behind a Show details disclosure.
    • Done when: no raw bash invocation or tool-name text is visible on /setup/tasks by default, and the step indicator advances at least 3 times during generation.
  • Fix the An error occurred, please try again! toast that fires on every page load. (row 4) — affects all customers, not just new signups

    • Why: reported by Sweets 2026-08-06 as happening "every time I land on the home page of the chat app". Confirmed on both paths: logged-out cold load (storage cleared, reproduced 2026-08-05 and 2026-08-06) and authenticated load — polled the DOM at 250ms intervals on a signed-in load of chat.recoupable.dev and the toast was present from 0ms through 2250ms (10 consecutive samples). It is not an onboarding-only bug; every customer eats it on every visit.
    • Root cause (traced 2026-08-06): the page fires GET https://api.recoupable.dev/api/accounts/**undefined**/credits and gets a 400 — twice per load (once before and once after POST /api/accounts resolves). The account id in the path is the literal string undefined.
      • The only builder for that URL is lib/recoup/getAccountCredits.ts L21, whose sole caller is hooks/useCredits.ts.
      • That hook has a guard — enabled: authenticated && !!userData?.account_id — so a genuinely undefined value would disable the query. The guard passing while the URL renders undefined means userData.account_id is the string "undefined", which is truthy. The as string cast on L18 hides it from the type checker.
    • Fix: 1) Find where userData.account_id is assigned the string "undefined" (suspect a template-literal or storage round-trip in the account-bootstrap path around providers/UserProvder.tsx / POST /api/accounts) and stop producing it. 2) Harden the useCredits guard to reject non-UUID values rather than relying on truthiness, and drop the as string cast. 3) Confirm the failed credits fetch is what surfaces the toast, and make a credits failure non-blocking regardless.
    • Done when: a hard reload of chat.recoupable.dev — logged in and logged out — shows zero /api/accounts/undefined/credits requests in the network panel and no error toast at any point during load.
  • Instrument /setup step transitions. (row 8)

    • Why: 12 signups since the wizard shipped and 0 activated, but there is no per-step data — we cannot tell whether people bounce at the artist search, the 4-minute report wait, or the final prompt. Every fix above is currently a hypothesis.
    • Fix: emit an event per step entry/exit (setup_artists_viewed, setup_tasks_report_started, setup_tasks_report_completed, setup_task_created, setup_skipped with the step it was skipped from).
    • Done when: a funnel query returns counts per step for a date range, and the biggest single drop is identifiable.

Open — free-form chat path to task creation

The wizard routes around this, but a user who asks for a recurring report in chat instead of via /setup hits a dead end.

  • Render ask_user_question in the chat UI and wire the reply path. (row 5)

    • Why: api offers ask_user_question to the agent whenever interactive is true, which defaults to true (api/lib/agent/buildAgentTools.ts L43-58). The file's own docblock states the contract: "no server execute; chat UI fulfills it and the next workflow turn sees the answer in messages." The chat repo has zero references to ask_user_question, and zero to addToolResult/onToolCall (the AI SDK mechanism for answering client-side tools). components/VercelChat/ToolComponents.tsx dispatches on 26 tool names; this is not one of them, and there is no fallback branch. The tool can never be fulfilled.
    • Reproduced 2026-08-06 on prod against a fresh account (agent+aug5onboardprobe@recoupable.com) via POST /api/chat with the prompt "Send me a weekly email report about my catalog every Monday morning." Trace: skill ✓ → ask_user_question (input error) → ask_user_question (accepted) → error: "Tool result is missing for tool call toolu_01QWzbNjEsshfcvPEZ1hhyuX." ×4 → turn dies. Final state tasks: []; create_task was never called.
    • Fix: add a renderer for ask_user_question in ToolComponents.tsx and submit the selection back via addToolResult so the next workflow turn sees the answer.
    • Done when: in chat, asking for a recurring report produces an answerable question UI, and answering it results in an enabled=true row in scheduled_actions.
  • Default multiSelect in the ask_user_question schema. (row 6)

    • Why: in the same trace the model's first ask_user_question call was rejected with tool-input-error for omitting the required multiSelect field; it self-corrected on retry. A required boolean with an obvious default costs a round trip on every question.
    • Fix: give multiSelect a default of false in the tool's input schema so omission is valid.
    • Done when: a question payload without multiSelect validates, and the retry disappears from traces.

Open — delivery (separate concern, blocks diagnosis)

  • Record accountId and the rejection reason in logEmailAttempt. (row 7)
    • Why: email_send_log shows 434 sent / 891 rejected over 2026-07-22 → 2026-08-05, but every rejected row has account_id = NULL and no error — because the reject path logs attempt = { status: "rejected" } with neither field (api/lib/emails/sendEmailHandler.ts L59; EmailAttemptLog in api/lib/emails/logEmailAttempt.ts). The NULL is an artifact of the logging code, not a signal. We currently cannot determine why a single one of the 891 failed.
    • Rejects cluster in daily bursts at ~10:00–10:08 UTC. Sample window 2026-07-30 09:55–10:20 UTC: 60 attempts, 0 sent, 60 rejected, first at 10:00:10, last at 10:07:38 — multiple different customers' tasks failing together, none delivered. Interleaved with the real payloads are the agent's own probes (test, auth test, auth test 2, auth test 3, ping, Auth probe), i.e. the sandbox agent reverse-engineering a failing endpoint and burning credits doing it.
    • Two candidates ruled out by reading the code: recipient case-sensitivity is handled (assertRecipientsAllowed.ts L31-33 lowercases both sides), and missing to is not a failure — to is optional in sendEmailBodySchema and defaults to the account's own address.
    • Fix: pass accountId (when auth resolved) and a reason code / first Zod issue into logEmailAttempt on the rejected path; add a column or reuse raw_body sidecar for the reason.
    • Done when: a new rejected row in email_send_log carries a non-null reason, and the 10:00 UTC cluster can be attributed to a specific failure class.

Architecture decisions

  • create_task is server-side and healthy; the gap is UI. The MCP server exposes create_task correctly and POST /api/tasks works. Every activation failure traced in this issue is a client-side gap (a missing renderer, a gating button, a log wall) — not a missing capability. Fixes belong in chat, not api, except rows 6 and 7.
  • ask_user_question is a client-fulfilled tool by design. It intentionally has no server execute so only a streaming UI can answer it, and it is withheld from headless runs (interactive: false) precisely because it would hang. That design is sound; the bug is that the interactive client was never built. Do not "fix" this by giving it a server execute.
  • The wizard deliberately bypasses ask_user_question. /setup/tasks uses purpose-built buttons rather than the generic question tool. Keep it that way — the wizard's conversion path should not depend on generic agent tooling.

Source references

  • Wizard pages: chat/app/setup/{artists,socials,valuation,tasks}
  • Tool dispatch: chat/components/VercelChat/ToolComponents.tsx
  • Agent tool assembly: api/lib/agent/buildAgentTools.ts, api/lib/chat/setupToolsForRequest.ts
  • Email logging: api/lib/emails/{sendEmailHandler,logEmailAttempt,validateSendEmailBody,assertRecipientsAllowed}.ts
  • Prior onboarding tracker: chat#1889 / chat#1911

Test debris from the 2026-08-06 walkthrough (not auto-cleaned): accounts 8ea115ef-14b4-4b2a-b6e1-405e0a89cdb6 (sweetman+aug520261141@…, task disabled) and fd1c6962-5fb7-4ee8-9dc7-b15b7d7ff534 (agent+aug5onboardprobe@…, no tasks), plus their auto-provisioned repos recoupable/8ea115ef-… and recoupable/fd1c6962-… — repo deletion needs a token with delete_repo scope.

Activity

  1. sidneyswift commented on Nov 6, 2026

    @sidneyswift
    Collaborator

    The cold-load error toast is fixed (#1950), and the empty roster step now reads "Add your first artist".

    The ask_user_question schema already defaults multiSelect to false; re-check whether that row is still real.

    Still open: the task is not auto-created (onboarding still asks to confirm and schedules weekly on Mondays), chat has no UI for ask_user_question, rejected sends log no reason (same gap as #1949), and step instrumentation.

  2. sidneyswift commented on Nov 8, 2026

    @sidneyswift
    Collaborator

    Status: the recurring task is now created without a click (live).

    Shipped in #2392, #2393 and #2394 (production e22f99a):

    • When the first report finishes, /setup/tasks schedules it monthly, on the creation date and time (Sweets' 2026-08-06 decision; confirmed by Sidney 2026-11-06). The 29th–31st become the 28th so it runs every month. With no browser timezone, the cron is built in UTC to match the API.
    • "Get this every Monday?" is gone. The step shows the next run and a Turn off button, which pauses the task. A paused task counts as the onboarding task step done, so home doesn't send the account back into setup to recreate it.
    • Setup decides "already set up" only after the tasks list has loaded, and creates at most one task automatically. If the account already has an active report, it asks "Get this report every month too?" instead of creating another.
    • Report prompt, email subject and copy are monthly; gains compare against a capture about a month earlier.

    Still open from this issue:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions