fix(a2ui): move history storage from server to client#2675
Conversation
|
📝 WalkthroughWalkthroughThis PR moves conversation memory from server-side threadId-backed storage to a client-supplied ConversationContext, adds validation and size limits, updates service and route signatures to accept conversation context, and updates the playground client to build, send, and apply conversation/data-model payloads. ChangesConversation state migration from server-side threads to client context
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/genui/server/agent/a2ui-validator.ts`:
- Around line 180-182: The current code applies unescapeInvalidJsonEscapes
before the initial JSON.parse which can corrupt valid strings (e.g., "\\\\x");
change the flow so you first build the candidate body from
stripCodeFenceWrapper(text) and unescapeInvalidBackticks(...) and attempt
JSON.parse on that original candidate, and only if the parse fails apply
unescapeInvalidJsonEscapes to the candidate (or to the failing parse input) and
retry parsing; update usages of the body variable and any error handling to
reflect the two-step parse attempt and keep functions
unescapeInvalidJsonEscapes, stripCodeFenceWrapper, and unescapeInvalidBackticks
as referenced symbols.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4820960f-38fe-45f2-8601-425154452c7c
📒 Files selected for processing (12)
packages/genui/a2ui-playground/src/pages/AIChatPage.tsxpackages/genui/server/AGENTS.mdpackages/genui/server/agent/a2ui-agent.tspackages/genui/server/agent/a2ui-prompt.tspackages/genui/server/agent/a2ui-validator.tspackages/genui/server/app/a2ui/_shared.tspackages/genui/server/app/a2ui/action/route.tspackages/genui/server/app/a2ui/action/stream/route.tspackages/genui/server/app/a2ui/chat/route.tspackages/genui/server/app/a2ui/reset/route.tspackages/genui/server/app/a2ui/stream/route.tspackages/genui/server/service/a2ui-agent.ts
💤 Files with no reviewable changes (2)
- packages/genui/server/app/a2ui/reset/route.ts
- packages/genui/server/agent/a2ui-agent.ts
cab3aaa to
772593c
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@packages/genui/server/app/a2ui/action/route.ts`:
- Around line 55-60: The early-return validation for missing action.name in the
route handler currently returns a 200 response; update the conditional that
checks if (!body.action || !body.action.name) to return the same bad-request
status used by the conversation validation branch (i.e., set HTTP status 400)
when calling jsonWithCors so the response indicates a client validation error;
adjust the jsonWithCors call in that block (the one returning { ok: false,
error: 'action.name is required' }) to include the 400 status.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 94866cfc-4f37-4fdd-b737-4cbb9c84006f
📒 Files selected for processing (12)
packages/genui/a2ui-playground/src/pages/AIChatPage.tsxpackages/genui/server/AGENTS.mdpackages/genui/server/agent/a2ui-agent.tspackages/genui/server/agent/a2ui-prompt.tspackages/genui/server/agent/a2ui-validator.tspackages/genui/server/app/a2ui/_shared.tspackages/genui/server/app/a2ui/action/route.tspackages/genui/server/app/a2ui/action/stream/route.tspackages/genui/server/app/a2ui/chat/route.tspackages/genui/server/app/a2ui/reset/route.tspackages/genui/server/app/a2ui/stream/route.tspackages/genui/server/service/a2ui-agent.ts
💤 Files with no reviewable changes (2)
- packages/genui/server/app/a2ui/reset/route.ts
- packages/genui/server/agent/a2ui-agent.ts
✅ Files skipped from review due to trivial changes (1)
- packages/genui/server/agent/a2ui-prompt.ts
Merging this PR will degrade performance by 7.06%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ❌ | transform 1000 view elements |
40 ms | 43 ms | -7.06% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing Sherry-hue:fix/remove-server-history (772593c) with main (bf08205)
Footnotes
-
26 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
React Example#8485 Bundle Size — 237.74KiB (0%).772593c(current) vs bf08205 main#8482(baseline) Bundle metrics
|
| Current #8485 |
Baseline #8482 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
200 |
200 |
|
81 |
81 |
|
44.76% |
44.76% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #8485 |
Baseline #8482 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
91.98KiB |
91.98KiB |
Bundle analysis report Branch Sherry-hue:fix/remove-server-his... Project dashboard
Generated by RelativeCI Documentation Report issue
React External#1600 Bundle Size — 697.9KiB (0%).772593c(current) vs bf08205 main#1597(baseline) Bundle metrics
|
| Current #1600 |
Baseline #1597 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
3 |
3 |
|
17 |
17 |
|
5 |
5 |
|
8.59% |
8.59% |
|
0 |
0 |
|
0 |
0 |
Bundle analysis report Branch Sherry-hue:fix/remove-server-his... Project dashboard
Generated by RelativeCI Documentation Report issue
React MTF Example#1618 Bundle Size — 208.69KiB (0%).772593c(current) vs bf08205 main#1615(baseline) Bundle metrics
|
| Current #1618 |
Baseline #1615 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
3 |
3 |
|
195 |
195 |
|
78 |
78 |
|
44.26% |
44.26% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #1618 |
Baseline #1615 |
|
|---|---|---|
111.23KiB |
111.23KiB |
|
97.46KiB |
97.46KiB |
Bundle analysis report Branch Sherry-hue:fix/remove-server-his... Project dashboard
Generated by RelativeCI Documentation Report issue
React Example with Element Template#754 Bundle Size — 204.53KiB (0%).772593c(current) vs bf08205 main#751(baseline) Bundle metrics
Bundle size by type
|
| Current #754 |
Baseline #751 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
58.78KiB |
58.78KiB |
Bundle analysis report Branch Sherry-hue:fix/remove-server-his... Project dashboard
Generated by RelativeCI Documentation Report issue
Web Explorer#10059 Bundle Size — 903.53KiB (0%).772593c(current) vs bf08205 main#10056(baseline) Bundle metrics
Bundle size by type
|
| Current #10059 |
Baseline #10056 |
|
|---|---|---|
499.15KiB |
499.15KiB |
|
402.16KiB |
402.16KiB |
|
2.22KiB |
2.22KiB |
Bundle analysis report Branch Sherry-hue:fix/remove-server-his... Project dashboard
Generated by RelativeCI Documentation Report issue
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Chores
Checklist