Skip to content

Login fixes#1

Merged
Fizzadar merged 2 commits into
mainfrom
nick/login-diagnostics
Jun 25, 2026
Merged

Login fixes#1
Fizzadar merged 2 commits into
mainfrom
nick/login-diagnostics

Conversation

@Fizzadar

Copy link
Copy Markdown
Member

No description provided.

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: cb728a43-6b8f-45ce-9409-d11133bda78d

📥 Commits

Reviewing files that changed from the base of the PR and between cde2006 and 475a7ba.

📒 Files selected for processing (4)
  • pkg/connector/login.go
  • pkg/redditchat/auth.go
  • pkg/redditchat/login.go
  • pkg/redditchat/login_test.go

Disabled knowledge base sources:

  • Linear integration is disabled

You can enable these sources in your CodeRabbit configuration.


📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Improved login handling to carry browser/client version details during captcha-based sign-in, helping login requests match expected app behavior.
  • Bug Fixes

    • Login flows now better handle captcha and OTP retries.
    • Enhanced feedback when login attempts fail, with clearer rejection handling and more informative error reporting.
  • Chores

    • Updated internal login flow contracts to support the new captcha response format.
    • Removed outdated automated test coverage.

Walkthrough

Reddit login CAPTCHA handling now carries an optional client version from connector cookies through captcha providers into login requests. The session stores the resolved version, request headers use it, and login success now depends on parsing the response body; status errors include more response details.

Changes

Reddit login captcha client version

Layer / File(s) Summary
Captcha result contract
pkg/redditchat/login.go, pkg/redditchat/auth.go
CaptchaResult replaces raw captcha tokens, RedditSession stores an optional client version with a default fallback, StaticCaptchaTokenProvider returns the new shape, and the Chrome-debug provider wrapper emits CaptchaResult.
Connector captcha capture
pkg/connector/login.go
The connector adds client_version cookie handling, includes it in CAPTCHA step fields, and forwards token plus client version through SubmitCookies.
Connector login callbacks
pkg/connector/login.go
runLogin and restartWithOTP now surface captcha responses as redditchat.CaptchaResult values instead of raw tokens.
Client-version headers
pkg/redditchat/login.go
RedditLoginOptions.captchaToken, chat-token refresh, and postLoginForm now propagate X-Reddit-Client-Version from the session or captcha provider result, and the chat-token refresh path adds debug logging around the cookie jar.
Login response handling
pkg/redditchat/login.go, pkg/redditchat/login_test.go
Password and OTP submission now store returned client versions, parse successful 200 responses, and expand status errors; the login test file was removed.

Sequence Diagram(s)

sequenceDiagram
  participant runLogin
  participant CaptchaTokenProvider
  participant SubmitCookies
  participant RedditSession
  runLogin->>CaptchaTokenProvider: request CaptchaResult
  SubmitCookies->>CaptchaTokenProvider: send token and clientVersion
  CaptchaTokenProvider-->>runLogin: CaptchaResult
  runLogin->>RedditSession: store ClientVersion
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

✨ 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 nick/login-diagnostics

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

Nick Mills-Barrett and others added 2 commits June 25, 2026 11:55
- redditStatusError: include status code, content-type, location, and
  cf-ray/cf-mitigated/x-ratelimit-remaining (when present) in the error.
- submitPassword: inspect the 200 body via checkLoginResponseBody; log a
  preview and surface JSON failure payloads (success:false / error /
  reason) instead of silently proceeding to the token call.
- RefreshChatToken: log csrf presence + jar cookie names before the POST,
  and send X-Original-Referer + X-Reddit-Client-Version like the real
  shreddit token POST.
- Hardening: replace the stale hardcoded X-Reddit-Client-Version with a
  shared RedditClientVersion constant used by both login form and token
  requests.
- tests: remove login tests that don't actually test anything
@Fizzadar Fizzadar force-pushed the nick/login-diagnostics branch from bc046c0 to 475a7ba Compare June 25, 2026 16:55
@linear-code

linear-code Bot commented Jun 25, 2026

Copy link
Copy Markdown

PLAT-37676

@Fizzadar Fizzadar merged commit 475a7ba into main Jun 25, 2026
8 of 9 checks passed
@Fizzadar Fizzadar deleted the nick/login-diagnostics branch June 25, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant