Conversation
Code Review SummaryStatus: 12 Issues Found | Recommendation: Address before merge Overview
Issue Details (click to expand)WARNING
Fix these issues in Kilo Cloud Other Observations (not in diff)Issues found in unchanged code that cannot receive inline comments:
Files Reviewed (1 files)
Reviewed by gpt-5.4-20260305 · 298,417 tokens |
3c374e4 to
f6588e5
Compare
d7193d8 to
e57695d
Compare
| if (!store.get(isLoadingAtom)) return; | ||
| // Fallback: clear loading state when events start flowing even if | ||
| // no root session.created was replayed (e.g. CLI snapshot failure). | ||
| store.set(sessionConfigAtom, { |
There was a problem hiding this comment.
WARNING: Fallback session swap leaves stale per-session UI state behind
This branch swaps in jotaiStorage without the clearAllAtoms() reset used by the root onSessionCreated path. If the previous session had a standalone question/permission, request-id maps, or failedPromptAtom populated, those values survive into the new session whenever session.created never arrives, so the UI can keep showing prompts from the old session.
| // no root session.created was replayed (e.g. CLI snapshot failure). | ||
| // Reset all per-session atoms first, same as the onSessionCreated | ||
| // path, so stale UI state from the previous session doesn't leak. | ||
| clearAllAtoms(); |
There was a problem hiding this comment.
WARNING: Fallback reset drops the request-id mapping for restored questions
processConnected() repopulates questionRequestIdsAtom before the first service-state notification so resumed tool questions can still be answered. Calling clearAllAtoms() inside that first notification wipes the map again, while this callback only restores questionAtom from state. In the snapshot-failure fallback, the question card still renders but QuestionToolCard can no longer resolve toolPart.callID to a request id, so submitting the answer fails.
b291379 to
5ad284d
Compare
5ad284d to
fbe887f
Compare
Summary
Self-contained Cloud Agent SDK at
src/lib/cloud-agent-sdk/— a pure library replacing the callback-based event-processor with a structured, testable architecture.ChatEvent | ServiceEventdiscriminated union with strict validationChatEvent → StorageMutation[]pure mappingmemory.ts) and Jotai-backed (jotai.ts) implementations ofSessionStorageinterfaceServiceEventstreambase-connection.ts(generic WebSocket lifecycle with reconnect/backoff),connection.ts(Cloud Agent-specific),cli-live-transport.ts,cli-historical-transport.ts,cloud-agent-transport.tsconnecting | streaming | idle | stopped | retrying)opencode.gen.tsreduced from 5,449 → 576 lines (only directly-used types retained)400+ tests across 15 test files covering normalizer, reducer, storage, connection, session phases, transports, and fixture-based integration.
This is PR 1 of 5 in a stacked series. Independent — no dependencies on other PRs.
Verification
pnpm test -- src/lib/cloud-agent-sdk— 400+ tests passingVisual Changes
N/A
Reviewer Notes
ascast boundary — all downstream code is properly typeduseSyncExternalStorereference stabilitySessionPhasestate machine replaces 4 overlapping lifecycle callbacks with a single discriminated union