Skip to content

feat: reauthenticate registered accounts during checks - #12

Merged
ygpark80 merged 1 commit into
mainfrom
feat/reauth-on-check
Sep 10, 2026
Merged

ygpark80 merged 1 commit into
mainfrom
feat/reauth-on-check

Conversation

@ygpark80

@ygpark80 ygpark80 commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

User description

Problem

Registered accounts with a missing or rejected credential were reported as incomplete, but the CLI did not guide the user through renewing that account's authentication.

Change

  • On interactive check --account and check --all, reopen the matching first-party OAuth or browser login when authentication is missing or rejected.
  • Require the renewed OAuth identity to match the registered account before replacing its cached credential.
  • Keep JSON checks non-interactive and report the authentication error for automation.
  • Document the renewal behavior and add regression coverage for auth-failure classification and complete OpenAI opt-out state.

Validation

  • go test ./...
  • go test -race ./...
  • go vet ./...
  • Linux amd64 and macOS arm64 builds

CodeAnt-AI Description

Reauthenticate registered accounts when checks detect expired credentials

What Changed

  • Interactive check --account and check --all now reopen the appropriate OAuth or browser sign-in flow when a registered account is missing or has rejected authentication.
  • Renewed credentials are saved only when the signed-in identity matches the registered account.
  • JSON checks remain non-interactive and continue reporting authentication failures for automation.
  • Documentation now explains the renewal behavior.

Impact

✅ Fewer incomplete account checks
✅ Safer credential replacement
✅ Non-interactive JSON checks remain automation-friendly

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

@codeant-ai

codeant-ai Bot commented Sep 10, 2026 •

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR a4e644a Sep 10, 2026 · 07:51 07:54

@codeant-ai

codeant-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: a2b77d1c-5c72-4260-89c7-82e82d17e84f


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.

@codeant-ai codeant-ai Bot added the size:L This PR changes 100-499 lines, ignoring generated files label Sep 10, 2026
@ygpark80
ygpark80 merged commit 93fa0a5 into main Sep 10, 2026
2 checks passed
@ygpark80
ygpark80 deleted the feat/reauth-on-check branch September 10, 2026 07:52
Comment thread main.go
credential, err := registry.LoadCredential(registered.ID)
if err != nil {
return result, errors.New("authentication required (credential cache missing)")
return result, fmt.Errorf("%w: authentication required (credential cache missing)", errRegisteredCredentialMissing)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Every credential-load error is classified as missing, so malformed files, permission errors, and other storage failures trigger login and may overwrite the cached credential. [error handling]

Assessment: 🟠 Major · 🔁 Occurrence: Rarely

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** main.go
**Line:** 589:589
**Comment:**
	*Error Handling: Every credential-load error is classified as missing, so malformed files, permission errors, and other storage failures trigger login and may overwrite the cached credential.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread main.go
Comment on lines +686 to +697
for _, marker := range []string{
"authentication required",
"credential was rejected",
"access token is missing",
"oauth credential was rejected",
"session expired",
"expired session",
"cloudflare block",
"signed-in github account not found",
} {
if strings.Contains(message, marker) {
return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: The Anthropic OAuth check returns “Claude account settings read failed (HTTP 401)”, which matches none of these markers, so expired credentials are not renewed. [incorrect condition logic]

Assessment: 🟠 Major · 🔁 Occurrence: Sometimes

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** main.go
**Line:** 686:697
**Comment:**
	*Incorrect Condition Logic: The Anthropic OAuth check returns “Claude account settings read failed (HTTP 401)”, which matches none of these markers, so expired credentials are not renewed.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@codeant-ai

codeant-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

CodeAnt Nitpicks

1 code suggestion

1. registry.Register writes the new credential before metadata persistence; if metadata writing fails, the command reports an error while leaving a partially renewed credential on disk.

Incomplete implementation · main.go:744

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

Labels

size:L This PR changes 100-499 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant