Skip to content

Conversation

tingwai
Copy link
Collaborator

@tingwai tingwai commented Oct 7, 2025

Description

[ What changed? Feel free to be brief. ]

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

[ When applicable, please include a short screen recording or screenshot - this makes it much easier for us as contributors to review and understand your changes. See this PR as a good example. ]

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Detects and cleans up corrupted VSCode auth cache files so authentication can recover without manual intervention. Addresses Linear CON-4270 by improving error handling for session retrieval and login.

  • Bug Fixes
    • SecretStorage: validate minimum data size, catch decryption errors, delete corrupted files, and return undefined to restart auth flow.
    • WorkOsAuthProvider: handle retrieval/parse failures, log with context, and return empty sessions instead of throwing.
    • Auth: switch login to async/await, log failures, and surface request errors to the caller.

@tingwai tingwai requested a review from a team as a code owner October 7, 2025 22:24
@tingwai tingwai requested review from Patrick-Erichsen and removed request for a team October 7, 2025 22:24
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Oct 7, 2025
Copy link

github-actions bot commented Oct 7, 2025

✅ Review Complete

Code Review Summary

⚠️ Continue configuration error. Please verify that the assistant exists in Continue Hub.


Copy link
Contributor

@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.

1 issue found across 3 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="extensions/vscode/src/stubs/SecretStorage.ts">

<violation number="1" location="extensions/vscode/src/stubs/SecretStorage.ts:69">
Wrapping decrypt() in a broad try/catch and rethrowing a new Error discards the original stack trace, making future failures much harder to diagnose. Please rethrow the original error (or use ErrorOptions.cause) so callers retain full context.</violation>
</file>

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

// Validate minimum data size to detect corruption early
const minSize = this.saltLength + this.ivLength + this.tagLength;
if (data.length < minSize) {
throw new Error(
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Oct 7, 2025

Choose a reason for hiding this comment

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

Wrapping decrypt() in a broad try/catch and rethrowing a new Error discards the original stack trace, making future failures much harder to diagnose. Please rethrow the original error (or use ErrorOptions.cause) so callers retain full context.

Prompt for AI agents
Address the following comment on extensions/vscode/src/stubs/SecretStorage.ts at line 69:

<comment>Wrapping decrypt() in a broad try/catch and rethrowing a new Error discards the original stack trace, making future failures much harder to diagnose. Please rethrow the original error (or use ErrorOptions.cause) so callers retain full context.</comment>

<file context>
@@ -59,31 +59,50 @@ export class SecretStorage {
+      // Validate minimum data size to detect corruption early
+      const minSize = this.saltLength + this.ivLength + this.tagLength;
+      if (data.length &lt; minSize) {
+        throw new Error(
+          `Corrupted cache file: insufficient data (${data.length} bytes, expected at least ${minSize})`,
+        );
</file context>

✅ Addressed in 21b987b

@tingwai tingwai force-pushed the tingwai/con-4270-auth-cache-corrupt branch from 21b987b to a58149c Compare October 8, 2025 22:32
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 8, 2025
@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Oct 9, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Oct 9, 2025
@RomneyDa RomneyDa merged commit bcd6c27 into main Oct 9, 2025
55 checks passed
@RomneyDa RomneyDa deleted the tingwai/con-4270-auth-cache-corrupt branch October 9, 2025 15:41
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Oct 9, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Oct 9, 2025
@sestinj
Copy link
Contributor

sestinj commented Oct 12, 2025

🎉 This PR is included in version 1.24.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Oct 14, 2025

🎉 This PR is included in version 1.28.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sestinj
Copy link
Contributor

sestinj commented Oct 15, 2025

🎉 This PR is included in version 1.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

lgtm This PR has been approved by a maintainer released size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants