Skip to content

fix(app-builder): route sessions through cloud-agent-next#3021

Open
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f
Open

fix(app-builder): route sessions through cloud-agent-next#3021
kilo-code-bot[bot] wants to merge 1 commit intomainfrom
session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f

Conversation

@kilo-code-bot
Copy link
Copy Markdown
Contributor

@kilo-code-bot kilo-code-bot Bot commented May 4, 2026

Summary

  • Remove the App Builder PostHog rollout gate and legacy cloud-agent routing so new and continued execution uses cloud-agent-next.
  • Load legacy v1 App Builder session history from R2 and upgrade those sessions to cloud-agent-next on the next message.
  • Remove App Builder prepareLegacySession endpoints and set new App Builder session rows to default to v2.

Verification

  • Not manually verified; the local app and test database are unavailable in this container.

Visual Changes

N/A

Reviewer Notes

  • Legacy v1 sessions are kept displayable via R2-backed message history, but they no longer connect to legacy cloud-agent WebSockets.
  • Targeted Jest verification could not run because Docker/Postgres is unavailable in this container.

const sessions = await getProjectSessions(projectId);

// Session state for the active session (populated below)
const legacyMessageEntries = await Promise.all(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

WARNING: Legacy histories are loaded eagerly for every session

This pulls the full R2 message history for every legacy session on each getProject call, including collapsed/ended sessions the user may never open. Projects with several long legacy sessions can now allocate and return all histories at once, which risks high memory usage and slow page loads; consider loading only the active legacy session here and fetching ended-session history lazily when expanded.

@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented May 4, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (13 files)
  • apps/web/src/components/app-builder/ProjectManager.ts
  • apps/web/src/components/app-builder/project-manager/__tests__/messages.test.ts
  • apps/web/src/components/app-builder/project-manager/__tests__/streaming.test.ts
  • apps/web/src/components/app-builder/project-manager/__tests__/websocket-streaming.test.ts
  • apps/web/src/components/app-builder/project-manager/sessions/v1/messages.ts
  • apps/web/src/components/app-builder/project-manager/sessions/v1/streaming.ts
  • apps/web/src/components/app-builder/project-manager/sessions/v1/v1-session.ts
  • apps/web/src/components/app-builder/project-manager/sessions/v1/websocket-streaming.ts
  • apps/web/src/lib/app-builder/app-builder-service.ts
  • apps/web/src/lib/app-builder/types.ts
  • apps/web/src/routers/app-builder-router.ts
  • apps/web/src/routers/app-builder/schemas.ts
  • apps/web/src/routers/organizations/organization-app-builder-router.ts

Previous warning about eager legacy R2 history loading was resolved by lazy-loading ended legacy sessions.


Reviewed by gpt-5.5-2026-04-23 · 925,809 tokens

@eshurakov eshurakov force-pushed the session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f branch from e510047 to 1a6067b Compare May 5, 2026 09:12
…etire v1 streaming

- Default app_builder_project_sessions.worker_version to 'v2' and remove
  the PostHog feature-flag gate so every new project runs on cloud-agent-next.
- Drop the v1 cloud-agent branches from the send/start/interrupt service
  paths; legacy v1 sessions are now read-only and the backend always
  upgrades to a fresh v2 session when the user sends a message.
- Remove the prepareLegacySession tRPC endpoint and WebSocket streaming
  coordinator on the client. Ended v1 sessions load their R2 history
  lazily via a new getLegacySessionMessages tRPC query (fired from the
  ExpandableSessionBlock via loadMessages), so getProject no longer
  fans out N R2 reads on every project load.
- Simplify v1 session plumbing: v1 messages.ts keeps only the helpers
  the upgrade path uses; streaming.ts destructures cloudAgentSessionId
  and drops the partial-message bookkeeping that was only meaningful
  while v1 had a live WebSocket.
@eshurakov eshurakov force-pushed the session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f branch from 1a6067b to 4f208a9 Compare May 5, 2026 09:24
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.

0 participants