fix(studio): Code Agent stream interruptions when navigating Studio - #552
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (4)
📝 WalkthroughWalkthroughClaude Code streaming now tracks explicit stream completion, the backend emits SSE keepalives on idle queue waits, and the custom assistant runtime reuses a named ChangesClaude Code streaming onDone handling
MCP keepalive emission
convertMessage extraction
Sequence Diagram(s)sequenceDiagram
participant UI
participant handleRun
participant streamClaudeCodeMessage
UI->>handleRun: trigger run
handleRun->>streamClaudeCodeMessage: stream(studioPathnameRef.current, handlers)
streamClaudeCodeMessage-->>handleRun: onDone()
alt onDone missing and not aborted
handleRun->>UI: throw interruption Error
end
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.test.ts (1)
247-251: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRepeated inline handler types instead of shared interfaces.
These tests redefine
{ onPermissionRequest/onInputRequest; onDone }inline, duplicating the already-definedPermissionRequestTestHandlers/InputRequestTestHandlersinterfaces used elsewhere in this file.Also applies to: 304-308, 417-421, 550-554, 654-658
🤖 Prompt for 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. In `@web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.test.ts` around lines 247 - 251, The test callbacks in useClaudeCodeChatRuntime.test.ts are repeating inline handler object types instead of reusing the existing shared interfaces. Update the affected async handler signatures to use the already-defined PermissionRequestTestHandlers and InputRequestTestHandlers types (and their shared onDone shape where applicable) so the tests stay consistent and avoid duplicated type definitions.web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.ts (1)
393-396: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRef sync during render — minor nit.
Assigning
studioPathnameRef.currentin the render body works but technically mutates outside the commit phase. Fine in practice for this "latest ref" pattern; consider moving to a layout effect if strict-mode purity ever becomes a concern.🤖 Prompt for 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. In `@web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.ts` around lines 393 - 396, The latest-value ref sync for studioPathnameRef is being done during render, which mutates state outside the commit phase. Update useClaudeCodeChatRuntime to keep the ref in sync inside a layout effect instead of assigning studioPathnameRef.current directly in the render body, and preserve the existing onSessionIdChange/studioPathname handling around that ref.
🤖 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.
Nitpick comments:
In
`@web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.test.ts`:
- Around line 247-251: The test callbacks in useClaudeCodeChatRuntime.test.ts
are repeating inline handler object types instead of reusing the existing shared
interfaces. Update the affected async handler signatures to use the
already-defined PermissionRequestTestHandlers and InputRequestTestHandlers types
(and their shared onDone shape where applicable) so the tests stay consistent
and avoid duplicated type definitions.
In
`@web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.ts`:
- Around line 393-396: The latest-value ref sync for studioPathnameRef is being
done during render, which mutates state outside the commit phase. Update
useClaudeCodeChatRuntime to keep the ref in sync inside a layout effect instead
of assigning studioPathnameRef.current directly in the render body, and preserve
the existing onSessionIdChange/studioPathname handling around that ref.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: e58ac827-acf1-4946-9afc-bae363cf4208
📒 Files selected for processing (3)
web/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.test.tsweb/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useClaudeCodeChatRuntime.tsweb/packages/studio/src/routes/agents/ClaudeCodeChatRoute/useCustomAssistantChatRuntime.ts
|
57c3b2f to
19e4366
Compare
Signed-off-by: Henrique Tolentino <htolentino@nvidia.com>
Signed-off-by: Henrique Tolentino <htolentino@nvidia.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Henrique Tolentino <htolentino@nvidia.com>
19e4366 to
9ace72f
Compare
…552) * Fix Code Agent stream interruptions when navigating Studio Signed-off-by: Henrique Tolentino <htolentino@nvidia.com> * Add keep alive Signed-off-by: Henrique Tolentino <htolentino@nvidia.com> * Fix lint formatting in coding_agents.py Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Henrique Tolentino <htolentino@nvidia.com> --------- Signed-off-by: Henrique Tolentino <htolentino@nvidia.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary by CodeRabbit