Skip to content

fix(cliproxyapi): only hydrate auths into an empty cache - #3064

Merged
shunkakinoki merged 1 commit into
mainfrom
fix/cliproxy-hydrate-empty-only
Oct 13, 2026
Merged

shunkakinoki merged 1 commit into
mainfrom
fix/cliproxy-hydrate-empty-only

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • hydrateCliproxyAuths ran aws s3 sync s3://.../auths/ -> local on every home-manager switch. s3 sync overwrites any local file whose size differs, regardless of which side is newer.
  • The S3 copies lag the server's rotated Claude refresh tokens (the auth backup can't read some root-owned files the container writes), so on Oct 13 18:00 UTC kyber's three Claude auths were reverted to already-rotated refresh tokens -> invalid_grant: Refresh token not found or invalid -> full re-auth.
  • Hydrate now only pulls when the local auth cache is empty, matching start.sh.

Test plan

  • shellspec spec/cliproxyapi_backup_spec.sh (new case fails without the fix)
  • shellcheck on hydrate.sh

Follow-up not in this PR: root-owned 0600 auth files written by the container are skipped by cliproxyapi-backup-auth, so S3 can still go stale.

🤖 Generated with Claude Code


Summary by cubic

Prevents Cliproxy API auth hydration from overwriting live credentials with stale S3 copies.

s3 sync ran on every home-manager switch and rewrote any local auth file whose size differed, even when the local file was newer. Because S3 can lag behind the server's rotated Claude refresh tokens, a single switch reverted all Claude auths to revoked tokens and forced a full re-auth. Hydration now pulls from S3 only when the local auth cache is empty, matching start.sh.

Written for commit 2fca61f. Summary will update on new commits.

View guided diff Turn on auto-fix

Every home-manager switch ran `aws s3 sync` from S3 into the live auth
directory. sync overwrites any local file whose size differs, and S3 can
lag behind the server's rotated Claude refresh tokens, so a switch on
kyber reverted all Claude auths to revoked tokens (invalid_grant) and
forced a re-login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pullfrog

pullfrog Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

This run was cancelled 🛑

The workflow was cancelled before completion. Please check the link below for details.

Pullfrog  | View workflow run | via Pullfrog | 𝕏

@indent

indent Bot commented Oct 13, 2026

Copy link
Copy Markdown

Warning

This organization's free trial has ended, so Indent couldn't start this review. Manage billing to resume reviews on this repository.

Review agents

Select any unchecked box below to run or rerun that agent.

Pending (1)
  • Indent Review Agent · This agent has not run.
Full results

Indent Review Agent

  • Summary: This agent has not run.
  • Latest resultNo result — this agent has not run.

@coderabbitai

coderabbitai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 29 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 559f4f73-dd62-426f-8aac-54b14c7b4eed
📥 Commits

Reviewing files that changed from the base of the PR and between bb57fde and 2fca61f.

📒 Files selected for processing (2)
  • home-manager/services/cliproxyapi/scripts/hydrate.sh
  • spec/cliproxyapi_backup_spec.sh
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

No issues found across 2 files

View guided diff | Turn on auto-fix | Re-trigger cubic

@shunkakinoki
shunkakinoki enabled auto-merge (squash) October 13, 2026 18:36
@shunkakinoki
shunkakinoki disabled auto-merge October 13, 2026 18:37
@shunkakinoki
shunkakinoki merged commit b0214f3 into main Oct 13, 2026
26 of 33 checks passed
@shunkakinoki
shunkakinoki deleted the fix/cliproxy-hydrate-empty-only branch October 13, 2026 18:37
@linear-code

linear-code Bot commented Oct 13, 2026

Copy link
Copy Markdown

SHUN-16121

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant