Repository navigation
Fix first-win Send detection, Claude prompt copy, and listing badge alignment - #1319
Conversation
…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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📝 WalkthroughWalkthroughThe 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. ChangesCommunity badge placement
Onboarding guidance and completion
Outbound email entitlement handling
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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.
|
🔎 Preview deployed: https://kody-pr-1319.kody-a99.workers.dev Worker: 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>
There was a problem hiding this comment.
🧹 Nitpick comments (2)
packages/worker/src/email/outbound.ts (1)
660-679: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider emitting the reporting event after persistence succeeds.
Line 669 records an
email_sendreporting 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 thetry/catchblock 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/catchblock 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 winStrengthen 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
consumeDailyEntitlementis 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
📒 Files selected for processing (5)
docs/contributing/community-packages.mddocs/use/community-packages.mdpackages/worker/src/email/outbound.tspackages/worker/src/email/outbound.workers.test.tspackages/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>

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
email_sendor stored outbound mail. Hotmail can already have the welcome message while Kody's mailbox mirror lagged. First-win Send counts a successful UserMeteremail_sends_per_dayincrement or any stored outbound copy, and the waiting copy talks about Kody recording the send.email_sendconsumed 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.@scope/nameon community cards and detail, instead of crowding the icon+name row.Testing
packages/worker/src/mcp/onboarding-checklist.node.test.tspackages/worker/src/app/onboarding-data.node.test.tspackages/worker/src/app/handlers/community.frame.node.test.tspackages/worker/src/app/handlers/community-detail.frame.node.test.tspackages/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-7c54Classification: 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
app-uiapp-sessions/onboardingmcp-serveruserHasSentWelcomeEmailcountsemail_sendor outbound mailcommunity-listingsemailemail_sends_per_dayif mailbox store fails before a copy existsuser-meteremail_sends_per_dayread / refund for Send-donemailboxSystem 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).
Before / after
email_sendmeter or stored outbound mail@scope/nameSummary by CodeRabbit
New Features
Bug Fixes
Documentation