Skip to content

Fix first-win Send detection, Claude prompt copy, and listing badge alignment - #1319

Merged
kody-bot merged 4 commits into
mainfrom
cursor/onboarding-first-win-and-card-alignment-7c54
Aug 8, 2026
Merged

kody-bot merged 4 commits into
mainfrom
cursor/onboarding-first-win-and-card-alignment-7c54

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 8, 2026 •

Copy link
Copy Markdown
Owner

Intent

Make onboarding's "See it work" Send step, first-win prompts, Claude Desktop setup, and community listing badges match what early users actually see after connecting an agent.

Summary

  • Send completes on email_send or stored outbound mail. Hotmail can already have the welcome message while Kody's mailbox mirror lagged. First-win Send counts a successful UserMeter email_sends_per_day increment or any stored outbound copy, and the waiting copy talks about Kody recording the send.
  • Failed mailbox stores refund the send meter. email_send consumed the daily entitlement before writing the outbound copy; if that store fails, the meter is refunded so onboarding cannot advance to Reply on a rejected send.
  • First-win prompts address the connected Kody server. "Hey Kody, use Kody MCP…" looked like impersonation / prompt injection to Claude. Send and Remember prompts now ask the connected Kody server to send/read mail and save memories (not values).
  • Claude Desktop hint. After connecting, start a new chat and ask Claude to list Kody tools before the first task — Desktop often does not bind MCP tools until that next turn.
  • Listing badges under the title. Trusted / Installed (or Forked) sit on their own row under wrapping @scope/name on community cards and detail, instead of crowding the icon+name row.

Testing

  • packages/worker/src/mcp/onboarding-checklist.node.test.ts
  • packages/worker/src/app/onboarding-data.node.test.ts
  • packages/worker/src/app/handlers/community.frame.node.test.ts
  • packages/worker/src/app/handlers/community-detail.frame.node.test.ts
  • packages/worker/src/email/outbound.workers.test.ts (refund path)
System recap — extends existing primitives (medium risk)

Mode: recap · Base: main · Head: cursor/onboarding-first-win-and-card-alignment-7c54

Classification: extends — first-win Send now composes UserMeter + Mailbox, outbound send refunds the meter on pre-store failure, and onboarding / community UI contracts change.

Primitives touched

Primitive Group Impact
app-ui surfaces extends — first-win copy, Claude Desktop hint, listing badge layout
app-sessions auth extends — Send/Remember prompt strings on /onboarding
mcp-server surfaces extends — userHasSentWelcomeEmail counts email_send or outbound mail
community-listings assistant extends — Trusted/Installed badges under wrapping titles
email assistant extends — refund email_sends_per_day if mailbox store fails before a copy exists
user-meter storage composes — daily email_sends_per_day read / refund for Send-done
mailbox storage composes — outbound message count still counts as Send-done

System map

First-win Send and community listing badges flow from the Remix onboarding/community UI through the onboarding checklist into UserMeter and Mailbox; outbound send refunds the meter if Mailbox storage fails first.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	appUi["app-ui<br/>Browser app (Remix 3)"]:::extended
	appSessions["app-sessions<br/>Browser sessions"]:::extended
	mcpServer["mcp-server<br/>MCP endpoint"]:::extended
	communityListings["community-listings<br/>Community package listings"]:::extended
	email["email<br/>Email primitives"]:::extended
	userMeter["user-meter<br/>UserMeter DO"]:::touched
	mailbox["mailbox<br/>Mailbox DO"]:::touched
	appUi -->|"first-win prompts + Claude hint"| appSessions
	appUi -->|"Trusted/Installed under title"| communityListings
	appSessions -->|"hasSentWelcomeEmail"| mcpServer
	mcpServer -->|"email_sends_per_day"| userMeter
	mcpServer -->|"outbound count"| mailbox
	email -->|"consume then store"| mailbox
	email -->|"refund if store fails"| userMeter
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading

Before / after

Surface Before After
First-win Send any stored outbound mail email_send meter or stored outbound mail
Failed outbound store meter stayed consumed meter refunded before throw
Send / Remember prompts "Hey Kody, use Kody MCP…" "Ask the connected Kody server…" + save memories
Claude Desktop tab connector URL only also: new chat, list Kody tools first
Listing / detail badges same row as wrapping @scope/name own row under the title
Open in Web Open in Cursor 

Summary by CodeRabbit

  • New Features

    • Community listings and detail pages display Trusted, Installed, and Forked badges beneath package names with improved wrapping.
    • Claude Desktop onboarding explains how to start a chat and discover available tools.
    • First-win onboarding prompts more clearly describe sending, replying, and saving memories.
  • Bug Fixes

    • Welcome-email completion recognizes successful sends or stored outbound email activity.
    • Failed outbound email storage restores the daily sending allowance and cleans up attachments.
  • Documentation

    • Clarified community badges, featured listings, Claude Desktop setup, and email-status behavior.

…dges

Count a successful email_send (or stored outbound mail) as Send-done, rewrite first-win prompts to address the connected Kody server and save memories, hint Claude Desktop to list tools in a new chat, and put Trusted/Installed badges on their own row under wrapping package names.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Aug 8, 2026 •

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 3dbc79b5-e0b7-4bb6-971c-af2e3e803b7b

📥 Commits

Reviewing files that changed from the base of the PR and between d94111f and 704c947.

📒 Files selected for processing (2)
  • packages/worker/src/email/outbound.ts
  • packages/worker/src/email/outbound.workers.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/worker/src/email/outbound.workers.test.ts
  • packages/worker/src/email/outbound.ts

📝 Walkthrough

Walkthrough

The change moves community status badges below listing titles. It adds Claude Desktop tool guidance, revises first-win prompts, centralizes welcome-email completion detection, and refunds daily email entitlements after persistence failures.

Changes

Community badge placement

Layer / File(s) Summary
Badge layout and documentation
packages/worker/src/app/community-*-content.tsx, docs/.../community-packages.md
Listing and detail views render status badges below titles. Badge wrapping and heading alignment were updated. Documentation describes the new placement.
Badge rendering tests
packages/worker/src/app/handlers/community*.test.ts
Tests verify that installation controls render after the listing and detail headings.

Onboarding guidance and completion

Layer / File(s) Summary
Welcome-email completion signal
packages/worker/src/mcp/onboarding-checklist.ts, packages/worker/src/app/handlers/onboarding.ts, packages/worker/src/mcp/onboarding-checklist.node.test.ts, packages/worker/universal/loader-data.ts
A shared helper checks outbound mailbox messages and current-day email_sends_per_day usage. Tests cover date and user isolation.
Claude Desktop and first-win instructions
packages/worker/client/routes/onboarding-mcp-clients.ts, packages/worker/client/routes/onboarding-mcp-client-tabs.tsx, packages/worker/client/routes/onboarding.tsx, packages/worker/src/app/onboarding-data.ts, packages/worker/src/app/onboarding-data.node.test.ts, docs/use/connect-your-agent.md
Claude Desktop instructions request a new chat and Kody tool listing. First-win steps and email prompts describe sending, replying, and saving memories through the connected agent.

Outbound email entitlement handling

Layer / File(s) Summary
Send persistence and entitlement refund
packages/worker/src/email/outbound.ts, packages/worker/src/email/outbound.workers.test.ts
The send flow refunds the daily email entitlement when mailbox persistence fails. The regression test verifies quota restoration and the absence of a stored outbound message.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • kentcdodds/kody#1115: Both changes address daily email entitlement consumption and refunds in outbound email handling.
  • kentcdodds/kody#1266: Both changes modify onboarding components and welcome-email completion logic.
  • kentcdodds/kody#1290: Both changes extend the first-win onboarding flow and welcome-email detection.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main changes to Send detection, Claude guidance, and community badge alignment.
Description check ✅ Passed The description includes the required Intent, Summary, and Testing sections and provides detailed, relevant coverage of the changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/onboarding-first-win-and-card-alignment-7c54

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds marked this pull request as ready for review August 8, 2026 16:02

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 770c6a2. Configure here.

Comment thread packages/worker/src/mcp/onboarding-checklist.ts
@github-actions

github-actions Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1319.kody-a99.workers.dev

Worker: kody-pr-1319
D1: kody-pr-1319-db
KV: kody-pr-1319-oauth-kv

Mocks:

Static failed on unformatted community docs. Bugbot was right that email_sends_per_day could increment before a mailbox copy existed; refund that consume when outbound storage fails so first-win Send cannot advance on a rejected send.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
packages/worker/src/email/outbound.ts (1)

660-679: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider emitting the reporting event after persistence succeeds.

Line 669 records an email_send reporting event right after the entitlement is consumed. If the guarded block at lines 684-754 fails, the code refunds the entitlement but keeps the reporting data point. The analytics stream then counts sends that were never stored. Move the call below the try/catch block to keep the meter and the reporting stream consistent.

♻️ Proposed reordering
 		})
-		recordEmailReportingEvent(input.env, {
-			userId: input.userId,
-			eventType: 'email_send',
-		})
 
 		const now = entitlementNow.toISOString()

Then add the call immediately after the try/catch block ends (after line 793):

recordEmailReportingEvent(input.env, {
	userId: input.userId,
	eventType: 'email_send',
})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/src/email/outbound.ts` around lines 660 - 679, Move the
recordEmailReportingEvent call out of the pre-persistence flow and place it
immediately after the guarded try/catch block completes in the outbound email
path. Keep entitlement consumption before persistence, and emit the email_send
event only after the persistence operations succeed; preserve the existing event
payload.
packages/worker/src/email/outbound.workers.test.ts (1)

1103-1117: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Strengthen the assertion so it proves the refund ran.

Lines 1103 and 1117 both assert a counter value of 0. The test passes if the refund works, and it also passes if consumeDailyEntitlement is never reached for this path. Add an assertion that the counter reaches 1 before the failure, or assert that a later send still succeeds after the plan limit would otherwise be exhausted. Either change makes the test fail when the refund is removed.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/worker/src/email/outbound.workers.test.ts` around lines 1103 - 1117,
The outbound email test around sendOutboundEmail currently cannot prove
consumeDailyEntitlement was reached before the missing-thread failure. Add an
assertion that the daily counter becomes 1 before the failed send, then retain
the final zero assertion to verify the refund occurred; alternatively, verify a
subsequent send succeeds after the refund.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/worker/src/email/outbound.ts`:
- Around line 660-679: Move the recordEmailReportingEvent call out of the
pre-persistence flow and place it immediately after the guarded try/catch block
completes in the outbound email path. Keep entitlement consumption before
persistence, and emit the email_send event only after the persistence operations
succeed; preserve the existing event payload.

In `@packages/worker/src/email/outbound.workers.test.ts`:
- Around line 1103-1117: The outbound email test around sendOutboundEmail
currently cannot prove consumeDailyEntitlement was reached before the
missing-thread failure. Add an assertion that the daily counter becomes 1 before
the failed send, then retain the final zero assertion to verify the refund
occurred; alternatively, verify a subsequent send succeeds after the refund.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: f644fb15-a1c4-4fdc-8452-02b9bd9627df

📥 Commits

Reviewing files that changed from the base of the PR and between 770c6a2 and d94111f.

📒 Files selected for processing (5)
  • docs/contributing/community-packages.md
  • docs/use/community-packages.md
  • packages/worker/src/email/outbound.ts
  • packages/worker/src/email/outbound.workers.test.ts
  • packages/worker/src/mcp/onboarding-checklist.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • docs/contributing/community-packages.md
  • packages/worker/src/mcp/onboarding-checklist.ts

Move the email_send reporting event past outbound persistence, and prove the meter refund by seeding at limit-1 then sending successfully afterward.

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kody-bot
kody-bot merged commit cd0a5ce into main Aug 8, 2026
10 checks passed
@kody-bot
kody-bot deleted the cursor/onboarding-first-win-and-card-alignment-7c54 branch August 8, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants