Conversation
Contributor
Code Review SummaryStatus: 2 Issues Found | Recommendation: Address before merge Overview
Fix these issues in Kilo Cloud Issue Details (click to expand)WARNING
Other Observations (not in diff)None. Files Reviewed (2 files)
Reviewed by gpt-5.4-20260305 · 237,777 tokens |
jeanduplessis
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When navigating to a non-existent session URL, the cloud agent UI would repeatedly query the server and show "Session not found" / "Failed to load session" toasts. This happened because
loadedDbSessionIdRefwas only set on the success path of theloadFromDbeffect — when the session wasn't found, the ref stayed unset, so any dependency change in the effect (12 dependencies in the next version) would re-trigger it, firing another query and another toast.The fix moves
loadedDbSessionIdRef.current = sessionIdFromParamsinto thefinallyblock so it's set regardless of success or failure, ensuring the effect runs exactly once per session ID.Applied to both
cloud-agent-nextandcloud-agent(legacy) implementations.Verification
pnpm typecheck— passed (all workspace projects)prettier --check— passedeslint— passed (all workspace projects)Visual Changes
N/A
Reviewer Notes
The fix is intentionally minimal — a one-line move in each file. The
finallyblock guarantees the ref is always set, which is the correct guard behavior: we've already attempted loading this session ID, so there's no reason to retry it on re-renders.