fix(webapp): clamp oversized toast messages and quiet expected pause errors#4077
Conversation
PauseEnvironmentService threw for the expected "cannot resume, the environment is paused by a billing limit" condition. The service catch logs every throw at error level, so an expected, user-actionable state was reported as an error. Return it as a failure result so genuine errors still report and this one does not.
Toast messages are flashed into the __message session cookie, which the session store rejects once the serialized cookie exceeds the browser's ~4KB limit. A call site flashing a raw caught error (a verbose database or validation message, for example) therefore turned a toast into a failed request. Clamp the message length in setErrorMessage / setSuccessMessage so a toast can never overflow the cookie.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📜 Recent review details⏰ Context from checks skipped due to timeout. (13)
🧰 Additional context used📓 Path-based instructions (8)**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
{packages/core,apps/webapp}/**/*.{ts,tsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.{ts,tsx,js,jsx}📄 CodeRabbit inference engine (.github/copilot-instructions.md)
Files:
**/*.ts📄 CodeRabbit inference engine (.cursor/rules/otel-metrics.mdc)
Files:
apps/webapp/**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursor/rules/webapp.mdc)
Files:
apps/webapp/**/*.server.ts📄 CodeRabbit inference engine (apps/webapp/CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
**/*.{ts,tsx,js,jsx,mts,cts,mjs,cjs,md,mdx}📄 CodeRabbit inference engine (CLAUDE.md)
Files:
🧠 Learnings (12)📚 Learning: 2026-03-22T13:26:12.060ZApplied to files:
📚 Learning: 2026-03-22T19:24:14.403ZApplied to files:
📚 Learning: 2026-05-18T08:21:27.694ZApplied to files:
📚 Learning: 2026-05-18T08:21:27.694ZApplied to files:
📚 Learning: 2026-06-13T19:53:13.759ZApplied to files:
📚 Learning: 2026-06-17T17:13:49.929ZApplied to files:
📚 Learning: 2026-06-23T13:04:21.413ZApplied to files:
📚 Learning: 2026-05-05T09:38:02.512ZApplied to files:
📚 Learning: 2026-05-12T21:04:05.815ZApplied to files:
📚 Learning: 2026-06-25T18:21:51.905ZApplied to files:
📚 Learning: 2026-06-04T18:16:35.386ZApplied to files:
📚 Learning: 2026-06-09T17:58:04.699ZApplied to files:
🔇 Additional comments (1)
WalkthroughTwo independent fixes are made. In 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 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 |
Code-unit clamping still let multibyte messages overflow the __message cookie after serialization. Budget the clamp in UTF-8 bytes instead so a toast can never exceed the cookie limit.
Summary
Two robustness fixes in the dashboard's error handling, found while testing the billing-limit pause/resume flow.
Toast cookie overflow
Toast messages are flashed into the
__messagesession cookie, which the session store rejects once the serialized cookie passes the browser's ~4KB limit. Any call site that flashes a raw caught error (a verbose database or validation message, for example) could turn a toast into a failed request.setErrorMessage/setSuccessMessagenow clamp the message length, so a toast can never overflow the cookie. This protects every toast helper at once.Pause/resume reporting
Resuming an environment that is paused by a billing limit is an expected, user-actionable state, but
PauseEnvironmentServicethrew it, and the service's catch reports every throw at error level. It now returns that case as a failure result, so callers still surface the message to the user while genuine errors keep reporting.