Skip to content

fix: log errors in VSCode extension connection retry loop#664

Open
dev-punia-altimate wants to merge 1 commit intomainfrom
proposal/vscode-extension-retry-silent-catch
Open

fix: log errors in VSCode extension connection retry loop#664
dev-punia-altimate wants to merge 1 commit intomainfrom
proposal/vscode-extension-retry-silent-catch

Conversation

@dev-punia-altimate
Copy link
Copy Markdown

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

Proposal

Repo: altimate-code
Category: silent-catch
Severity: high
Files: sdks/vscode/src/extension.ts

What I Found

In the VSCode extension's activate() function (line 81), the retry loop that waits for the opencode terminal server to become ready silently swallows all fetch errors with catch (e) {}. The loop retries 10 times with 200ms delays, but if it fails:

  • Users see no terminal output and no indication of what went wrong
  • Network errors, port conflicts, and server startup failures are all invisible
  • Debugging requires manually adding console.log to the extension source

Fix

Added console.warn() inside the catch block to log the attempt number and error message. The retry logic and fallback behavior are preserved unchanged — this only adds visibility into connection failures via the VSCode Output panel.


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


Summary by cubic

Logs connection errors during the VSCode extension’s startup retry loop so failures are visible in the Output panel. No change to retry behavior; this only adds diagnostics.

  • Bug Fixes
    • Added console.warn in sdks/vscode/src/extension.ts activate() fetch loop to log attempt number and error when hitting http://localhost:${port}/app.

Written for commit 954f321. Summary will update on new commits.

Summary by CodeRabbit

  • Bug Fixes
    • Connection retry failures during startup are now reported to the console, displaying attempt numbers and error details to aid troubleshooting.

Category: silent-catch
Severity: high
Repo: altimate-code
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

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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 8, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

📝 Walkthrough

Walkthrough

The extension's terminal startup connection retry loop now captures and reports failures for each fetch attempt. Previously errors were silently ignored; now each retry failure emits a console.warn message including an attempt counter and error details, improving visibility without altering control flow.

Changes

Cohort / File(s) Summary
Error Reporting in Retry Loop
sdks/vscode/src/extension.ts
Added error logging to the fetch retry catch block, emitting console.warn with attempt counter and error details instead of silently ignoring failures.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A silent catch once swallowed all the pain,
Now whispers warn through logs like gentle rain,
Each failed attempt, a number and a message clear—
The rabbit's eyes grow bright when errors appear! 🌙

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description is missing the required 'PINEAPPLE' keyword at the top that must be included for AI-generated contributions per the repository template. Add 'PINEAPPLE' at the very beginning of the PR description before any other content, as required by the repository template for AI-generated contributions.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely describes the main change: adding error logging to the connection retry loop in the VSCode extension.

✏️ 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/vscode-extension-retry-silent-catch

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

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
sdks/vscode/src/extension.ts (1)

81-83: Good fix for silent retries; consider preserving full error context and removing magic-number attempt math.

This is a solid visibility improvement. As a small refinement, logging the full error object (not only message) keeps stack/cause details, and computing attempt explicitly is easier to maintain.

Suggested tweak
-      } catch (e) {
-        console.warn(`[opencode-vscode] connection attempt ${11 - tries}/10 failed:`, e instanceof Error ? e.message : e)
-      }
+      } catch (e) {
+        const attempt = 10 - tries + 1
+        console.warn(`[opencode-vscode] connection attempt ${attempt}/10 failed`, e)
+      }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@sdks/vscode/src/extension.ts` around lines 81 - 83, Replace the terse catch
logging that prints only the error message and a magic-number attempt calc;
compute an explicit attempt counter (e.g., const totalAttempts = 10; const
attempt = totalAttempts - tries + 1) and log that, and pass the full error
object to the logger instead of e instanceof Error ? e.message : e so
stack/cause info is preserved (update the catch block that references tries and
the console.warn/console.warn `[opencode-vscode] connection attempt ...` call).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@sdks/vscode/src/extension.ts`:
- Around line 81-83: Replace the terse catch logging that prints only the error
message and a magic-number attempt calc; compute an explicit attempt counter
(e.g., const totalAttempts = 10; const attempt = totalAttempts - tries + 1) and
log that, and pass the full error object to the logger instead of e instanceof
Error ? e.message : e so stack/cause info is preserved (update the catch block
that references tries and the console.warn/console.warn `[opencode-vscode]
connection attempt ...` call).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 85fa9bf7-26d6-4efc-9564-9898eb8f0269

📥 Commits

Reviewing files that changed from the base of the PR and between b66d9f5 and 954f321.

📒 Files selected for processing (1)
  • sdks/vscode/src/extension.ts

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