Skip to content

proposal: log warning when stream error parsing fails#661

Open
dev-punia-altimate wants to merge 1 commit intomainfrom
proposal/message-v2-error-parsing-logging
Open

proposal: log warning when stream error parsing fails#661
dev-punia-altimate wants to merge 1 commit intomainfrom
proposal/message-v2-error-parsing-logging

Conversation

@dev-punia-altimate
Copy link
Copy Markdown

@dev-punia-altimate dev-punia-altimate commented Apr 8, 2026

Proposal

Repo: altimate-code
Category: error-swallowing
Severity: medium
Files: packages/opencode/src/session/message-v2.ts

What I Found

In the toError() method (line 998), when ProviderError.parseStreamError(e) throws an exception during error parsing, the failure is silently caught with catch {}. This means:

  • If the error parser itself fails, there's no visibility into what went wrong
  • The code falls through to NamedError.Unknown which is correct fallback behavior, but the parsing failure is invisible
  • Debugging error handling regressions requires guessing whether errors are unparseable or if the parser is broken

Fix

Changed catch {} to catch (parseErr) { console.warn("[message-v2] Failed to parse stream error:", parseErr) } to log the parsing failure while preserving the existing fallback to NamedError.Unknown.


Auto-generated by QA Autopilot Proposal Monitor. Open for 30-day human review.


Summary by cubic

Add a warning when stream error parsing fails in packages/opencode/src/session/message-v2.ts (MessageV2.toError()). This improves visibility while keeping the fallback to NamedError.Unknown unchanged.

Written for commit 8a771b9. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Improved error diagnostics by capturing and logging stream parsing failures, enabling better troubleshooting of error handling issues while maintaining existing error recovery behavior.

Category: error-swallowing
Severity: medium
Repo: altimate-code

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Hey! Your PR title proposal: log warning when stream error parsing fails doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

This PR doesn't fully meet our contributing guidelines and PR template.

What needs to be fixed:

  • PR description is missing required template sections. Please use the PR template.

Please edit this PR description to address the above within 2 hours, or it will be automatically closed.

If you believe this was flagged incorrectly, please let a maintainer know.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 87ad0155-9f2f-482e-93b5-443821705292

📥 Commits

Reviewing files that changed from the base of the PR and between b66d9f5 and 8a771b9.

📒 Files selected for processing (1)
  • packages/opencode/src/session/message-v2.ts

📝 Walkthrough

Walkthrough

Enhanced error handling in the MessageV2.fromError method by replacing silent error suppression with explicit logging. When stream error parsing fails, the catch block now captures the exception and emits a console warning before returning the fallback error object.

Changes

Cohort / File(s) Summary
Error Handling Enhancement
packages/opencode/src/session/message-v2.ts
Updated catch block in MessageV2.fromError to log parsing failures via console.warn instead of silently ignoring exceptions, improving observability without changing return behavior.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 When errors hide in silence deep,
A warning log makes promises to keep,
No more shadows, no more shhh,
Stream errors parsed with helpful wish!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The description is mostly complete with Summary and context, but is missing the required Test Plan section and lacks the required 'PINEAPPLE' marker for AI-generated contributions. Add the 'PINEAPPLE' marker at the top per the template requirement for AI-generated contributions, and include a Test Plan section explaining how the warning logging change was tested.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding warning logging when stream error parsing fails, which matches the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch proposal/message-v2-error-parsing-logging

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant