Conversation
📝 WalkthroughWalkthroughThe changes refactor how ACP debug sessions handle payload overrides for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/main/presenter/llmProviderPresenter/providers/acpProvider.ts (1)
665-676: Consider sharing cwd validation logic withloadSessionfor consistency.
newSessionnow blocks empty/whitespacecwd, butloadSessionstill accepts any string override. A shared helper would prevent behavior drift.♻️ Suggested refactor
+const resolvePayloadCwd = (value: unknown): string | undefined => + typeof value === 'string' && value.trim() ? value : undefined + // in newSession - if (typeof request.payload.cwd === 'string' && request.payload.cwd.trim()) { - body.cwd = request.payload.cwd - } + const payloadCwd = resolvePayloadCwd(request.payload.cwd) + if (payloadCwd) { + body.cwd = payloadCwd + } // in loadSession - if (typeof payloadOverrides.cwd === 'string') { - body.cwd = payloadOverrides.cwd - } + const payloadCwd = resolvePayloadCwd(payloadOverrides.cwd) + if (payloadCwd) { + body.cwd = payloadCwd + }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/main/presenter/llmProviderPresenter/providers/acpProvider.ts` around lines 665 - 676, The cwd validation in newSession is stricter than loadSession; extract the logic into a shared helper (e.g., validateOrNormalizeCwd) and call it from both newSession and loadSession so both reject or normalize empty/whitespace-only cwd the same way; update the places that set body.cwd (the body construction in newSession and the analogous assignment in loadSession) to use this helper and preserve existing type checks (isPlainObject/request.payload checks) and behavior for mcpServers and _meta.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/main/presenter/llmProviderPresenter/providers/acpProvider.ts`:
- Around line 665-676: The cwd validation in newSession is stricter than
loadSession; extract the logic into a shared helper (e.g.,
validateOrNormalizeCwd) and call it from both newSession and loadSession so both
reject or normalize empty/whitespace-only cwd the same way; update the places
that set body.cwd (the body construction in newSession and the analogous
assignment in loadSession) to use this helper and preserve existing type checks
(isPlainObject/request.payload checks) and behavior for mcpServers and _meta.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: c86ac910-ebac-41b2-8684-0b3bb0abce0a
📒 Files selected for processing (3)
src/main/presenter/llmProviderPresenter/providers/acpProvider.tssrc/renderer/settings/components/AcpDebugDialog.vuetest/main/presenter/acpProvider.test.ts
Summary by CodeRabbit
Bug Fixes
Tests