-
Notifications
You must be signed in to change notification settings - Fork 2.6k
fix: Handle long Claude code messages #5072
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
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
Implements async generator pattern and ProcessState management to properly handle incomplete JSON chunks from Claude Code CLI, preventing parsing failures with long outputs. Based on Cline PR #4287 by @BarreiroT
|
✅ No security or compliance issues detected. Reviewed everything up to 097dbd3. Security Overview
Detected Code Changes
Reply to this PR with |
Member
Author
|
Fixing the unit test... |
- Add workspace.workspaceFolders mock to VSCode mock in registerCommands.spec.ts - Fixes test failure where claude-code modules access vscode.workspace at module level - Resolves 'No workspace export is defined on the vscode mock' error
mrubens
approved these changes
Jun 24, 2025
cte
pushed a commit
that referenced
this pull request
Jun 24, 2025
Alorse
pushed a commit
to Alorse/Roo-Code
that referenced
this pull request
Jun 27, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
lgtm
This PR has been approved by a maintainer
PR - Needs Review
size:XXL
This PR changes 1000+ lines, ignoring generated files.
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.
Problem
Long Claude code messages were being truncated or causing parsing failures because JSON chunks could be split across multiple data events, leading to incomplete JSON parsing errors.
Solution
Implements improvements from Cline PR #4287 by @BarreiroT to fix handling of incomplete messages when using Claude Code.
Key Changes
readlineinterfacepartialDataaccumulationthinking,redacted_thinking, andtool_usecontent types--disallowedTools, increased output token limits, and improved timeoutsTest Coverage
Added comprehensive test suite with 20 tests:
Files Changed
src/api/providers/claude-code.ts- Main handler with async generator patternsrc/integrations/claude-code/run.ts- Process management with ProcessStatesrc/integrations/claude-code/types.ts- Updated type definitionssrc/integrations/claude-code/message-filter.ts- New image filtering utilitypackages/types/src/providers/claude-code.ts- Model configuration updatesCredits
Based on Cline PR #4287 "fix: Handle long Claude code messages" by @BarreiroT
Testing
✅ All 20 tests passing
✅ Type checking passed
✅ Linting passed
Fixes issues with long-lived, complex tasks that generate longer outputs from Claude Code CLI.
Important
Fixes handling of long Claude code messages by implementing async generator pattern, improving chunk parsing, and enhancing error handling.
claude-code.ts.run.ts.message-filter.ts.thinking,redacted_thinking, andtool_usecontent types.--disallowedToolsand increased output token limits.claudeCodeModelsinclaude-code.tsto disable unsupported features for Claude Code models.runClaudeCodeto use async generator pattern inrun.ts.types.ts.This description was created by
for 097dbd3. You can customize this summary. It will automatically update as commits are pushed.