Skip to content

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

Merged
eshurakov merged 1 commit intomainfrom
session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f
May 6, 2026
Merged

fix(app-builder): route sessions through cloud-agent-next#3021
eshurakov merged 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

  • Verified locally

Comment thread apps/web/src/lib/app-builder/app-builder-service.ts Outdated
@kilo-code-bot
Copy link
Copy Markdown
Contributor Author

kilo-code-bot Bot commented May 4, 2026

Code Review Summary

Status: 1 Issue Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
apps/web/src/lib/app-builder/app-builder-service.ts 549 Active prepared v1 sessions are treated as R2-only history, so existing prepared v1 sessions can lose cloud-agent replay/history and uninitiated prepared v1 sessions may never start.
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
N/A N/A None
Files Reviewed (20 files)
  • apps/web/src/components/app-builder/ProjectManager.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/__tests__/messages.test.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/__tests__/streaming.test.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/__tests__/websocket-streaming.test.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/sessions/v1/messages.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/sessions/v1/streaming.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/sessions/v1/v1-session.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/sessions/v1/websocket-streaming.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/sessions/v2/streaming.ts - 0 issues
  • apps/web/src/components/app-builder/project-manager/sessions/v2/v2-session.ts - 0 issues
  • apps/web/src/lib/app-builder/app-builder-service.ts - 1 issue
  • apps/web/src/lib/app-builder/types.ts - 0 issues
  • apps/web/src/routers/app-builder-router.ts - 0 issues
  • apps/web/src/routers/app-builder/schemas.ts - 0 issues
  • apps/web/src/routers/organizations/organization-app-builder-router.ts - 0 issues
  • dev/local/scripts/start-app-builder-tunnel.ts - 0 issues
  • packages/db/src/migrations/0114_steep_hercules.sql - 0 issues
  • packages/db/src/migrations/meta/0114_snapshot.json - 0 issues
  • packages/db/src/migrations/meta/_journal.json - 0 issues
  • packages/db/src/schema.ts - 0 issues

No new inline comments were added in this incremental pass; the existing App Builder legacy-session warning remains the only active finding.

Fix these issues in Kilo Cloud


Reviewed by gpt-5.5-2026-04-23 · 2,858,519 tokens

@eshurakov eshurakov force-pushed the session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f branch 2 times, most recently from 1a6067b to 4f208a9 Compare May 5, 2026 09:24
Comment thread apps/web/src/components/app-builder/ProjectManager.ts
Comment thread apps/web/src/components/app-builder/project-manager/sessions/v1/v1-session.ts Outdated
@eshurakov eshurakov force-pushed the session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f branch 2 times, most recently from 87f291c to 7347276 Compare May 5, 2026 20:43
Comment thread apps/web/src/lib/app-builder/app-builder-service.ts
…treaming

- 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.
- Restore preview polling on v2 stream completion: active v2 sessions
  built from existing project data were missing the onStreamComplete
  callback, so follow-up messages on an established v2 session would
  not restart preview polling after streaming transitioned to idle.
- Drop redundant workerVersion parameter from onSessionChanged since
  App Builder is always on cloud-agent-next now.
- Fix dev app-builder tunnel script to write APP_BUILDER_URL to
  apps/web/.env.development.local, which is what Next.js dev actually
  reads (the repo-root file is ignored when vercel env pull has created
  the apps/web copy as a real file instead of a symlink).
@eshurakov eshurakov force-pushed the session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f branch from 7347276 to 31d1ca9 Compare May 6, 2026 07:01
@eshurakov eshurakov merged commit 2c7e5c3 into main May 6, 2026
41 checks passed
@eshurakov eshurakov deleted the session/agent_f1ad3e6a-fe7f-4657-b188-bb76a2412e0f branch May 6, 2026 08:52
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.

2 participants