Skip to content

Avoid false signed-out detection on MiniMax coding-plan shell pages#508

Open
qipihen wants to merge 1 commit intosteipete:mainfrom
qipihen:fix/minimax-signed-out-detection
Open

Avoid false signed-out detection on MiniMax coding-plan shell pages#508
qipihen wants to merge 1 commit intosteipete:mainfrom
qipihen:fix/minimax-signed-out-detection

Conversation

@qipihen
Copy link

@qipihen qipihen commented Mar 11, 2026

Summary

  • fix the existing MiniMax web fetch path so shell pages are not misclassified as signed out just because login strings appear inside script/style payloads
  • strip non-visible HTML content before checking for sign in / log in / 登录 / 登入
  • add a MiniMax web fetch regression test that exercises the fallback from a __NEXT_DATA__ shell page to the remains API

Scope

This PR does not add MiniMax support as a new provider.
It fixes the MiniMax web-fetch path that already exists in the current upstream codebase.

Why

MiniMax's current Coding Plan page can return an SSR shell where login-related translation strings live inside __NEXT_DATA__, even though the page is not actually the sign-in screen. The previous raw-string check saw 登录 in the script payload and returned invalidCredentials before the fetcher could fall back to coding_plan/remains.

Validation

  • reproduced locally with a live MiniMax web session and confirmed the old logic returned MiniMax credentials are invalid or expired
  • verified the patched local build successfully reports MiniMax usage again from the web source
  • attempted swift test --disable-experimental-prebuilts --filter MiniMax on a clean local checkout; that run is currently blocked here by an unrelated KeyboardShortcuts #Preview macro build issue, not by this diff

@qipihen qipihen changed the title Fix MiniMax signed-out detection for script-only pages Avoid false signed-out detection on MiniMax coding-plan shell pages Mar 11, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4448d5e4ed

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


private static func looksSignedOut(html: String) -> Bool {
let lower = html.lowercased()
let lower = self.visibleText(from: html).lowercased()

Choose a reason for hiding this comment

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

P2 Badge Preserve script-only login detection for signed-out shells

Switching looksSignedOut to only scan visibleText drops all <script> content, so a JS-rendered sign-in shell with no visible login copy now returns false here even when auth has expired. In that case fetchCodingPlanHTML/fetchCodingPlanRemains continue into parse(html:), which can surface parseFailed (or partial script-derived data) instead of invalidCredentials, changing user-facing behavior for expired cookies. Consider keeping a fallback raw-HTML login signal when extracted visible text is empty.

Useful? React with 👍 / 👎.

@ratulsarna
Copy link
Collaborator

Thanks for PR @qipihen !

Small concern: since looksSignedOut now scans only visibleText, a real JS login shell with no visible copy might slip through and become parseFailed instead of invalidCredentials.

Maybe keep a raw-HTML fallback when visible text is empty?

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.

2 participants