Skip to content

fix(mistral): expand cookie import to Safari, Chrome, and Firefox - #1985

Merged
steipete merged 7 commits into
steipete:mainfrom
djsavvy:fix/mistral-firefox-cookie-import
Jul 17, 2026
Merged

fix(mistral): expand cookie import to Safari, Chrome, and Firefox#1985
steipete merged 7 commits into
steipete:mainfrom
djsavvy:fix/mistral-firefox-cookie-import

Conversation

@djsavvy

@djsavvy djsavvy commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Expand Mistral Automatic import through a bounded Chrome → Firefox → Safari order while preserving Chrome-first behavior.
  • Recognize Firefox Developer Edition as the same shared Firefox profile source, including Developer Edition-only installs.
  • Retry later browser/profile sessions after 401/403 instead of repeatedly selecting an earlier stale session, then cache the first successful source.
  • Keep empty/default and explicit browser overrides bounded, import only unexpired cookies from exact Mistral domains, and document the behavior.

Proof

  • Focused Mistral/browser detection suite on current main: 55 tests across 3 suites; provider-settings coverage: 37 tests in 1 suite.
  • make check: format, lint, locale, package, CI-path, repository-size, shell, and documentation gates clean.
  • Source-blind behavior validation: 29/29 BrowserDetection cases passed, including the Developer Edition-only shared profile contract.
  • Structured autoreview: product patch clean at 0.98 confidence; current-main rebase and adjacent lint split clean at 0.99.
  • No live browser-cookie, provider, or Keychain probe was run; coverage uses synthetic stores and transport fixtures to avoid macOS prompts.

Thanks @djsavvy for the original Firefox import contribution.

@clawsweeper

clawsweeper Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codex review: needs real behavior proof before merge. Reviewed July 17, 2026, 12:36 AM ET / 04:36 UTC.

Summary
The branch expands Mistral Automatic cookie import to a bounded Chrome → Firefox → Safari order, retries later sessions after authentication failures, adds Firefox Developer Edition discovery, and updates tests and documentation.

Reproducibility: yes. from source: a Developer Edition-only setup with /Applications/Firefox Developer Edition.app and abc.dev-edition-default/cookies.sqlite is filtered because the Gecko profile predicate requires .default in the directory name. This was not executed locally, so the structured status is source-reproducible rather than reproduced.

Review metrics: 2 noteworthy metrics.

  • Patch surface: 10 files; 249 additions, 42 deletions. The change spans browser discovery, credential selection, provider behavior, tests, and user documentation rather than a single importer constant.
  • Automatic browser sources: 1 → 3 sources. Automatic Mistral discovery expands from Chrome-only behavior to Chrome, Firefox, and Safari, making upgrade and credential-selection behavior merge-relevant.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🦐 gold shrimp
Result: blocked until real behavior proof from a real setup is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Update Gecko profile detection and its fixture to cover *.dev-edition-default.
  • [P2] Add redacted live macOS proof for Developer Edition-only import and stale Chrome/Firefox fallback to a valid later source.

Proof guidance:

  • [P1] Needs real behavior proof before merge: Only tests, fixtures, source-blind cases, and CI are provided; before merge, add redacted terminal output, logs, or a recording from a real macOS setup showing Developer Edition-only import and stale-source fallback, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review, while redacting cookies, account details, private endpoints, and other sensitive data.

Risk before merge

  • [P1] Automatic Mistral import now traverses additional browser sources and changes session selection and caching after authentication failures, so upgrade behavior can affect which stored credential is used.
  • [P2] Without live macOS proof, tests do not establish that Developer Edition-only discovery and stale-source fallback work with real browser profiles, cookie databases, permissions, and Keychain behavior.

Maintainer options:

  1. Fix detection and prove both flows (recommended)
    Accept real Firefox Developer Edition profile names, add the corresponding regression fixture, and provide redacted live proof of Developer Edition-only import plus stale-source fallback before merge.
  2. Narrow the advertised support
    Remove the Developer Edition claim and bundle-name behavior if that profile shape is intentionally outside this PR, while retaining the correctly tested browser fallback work.
  3. Pause pending credential-environment proof
    Keep the PR open without merging until a contributor or maintainer can validate the cookie-import behavior in a real macOS setup.

Next step before merge

  • [P1] The contributor should correct the remaining profile predicate and supply proof from a real credential environment; automated repair cannot satisfy the external-PR proof gate.

Security
Cleared: The diff changes sensitive cookie-selection code but adds no dependency, workflow, permission, secret-access, or supply-chain expansion, and it bounds imported records to exact Mistral domains and unexpired cookies.

Review findings

  • [P2] Recognize Developer Edition profile directories — Sources/CodexBarCore/BrowserDetection.swift:249
Review details

Best possible solution:

Preserve the bounded Chrome-first fallback, update Gecko profile detection and its regression test to cover a real *.dev-edition-default cookie store, then provide redacted live macOS evidence for both Developer Edition-only import and stale-earlier-source fallback.

Do we have a high-confidence way to reproduce the issue?

Yes, from source: a Developer Edition-only setup with /Applications/Firefox Developer Edition.app and abc.dev-edition-default/cookies.sqlite is filtered because the Gecko profile predicate requires .default in the directory name. This was not executed locally, so the structured status is source-reproducible rather than reproduced.

Is this the best way to solve the issue?

No, not yet: adding the Developer Edition bundle name without accepting its normal profile-directory convention leaves the documented behavior incomplete. The narrow maintainable fix is to update the existing Gecko cookie-store predicate and test that exact profile shape.

Full review comments:

  • [P2] Recognize Developer Edition profile directories — Sources/CodexBarCore/BrowserDetection.swift:249
    Adding the Developer Edition bundle name is insufficient because Firefox availability still passes through the Gecko profile predicate, which accepts only directory names containing .default. A normal *.dev-edition-default profile is therefore rejected, and the new test misses this by using abc.default-release; update the predicate and fixture to exercise the real Developer Edition profile convention.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against d9cae08c7e69.

Label changes

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P2: This is a bounded provider integration defect with a clear affected path, but it is not a core-runtime emergency or broad regression.
  • merge-risk: 🚨 compatibility: Existing Automatic-mode users can encounter additional browser/profile access and a changed fallback sequence after upgrading.
  • merge-risk: 🚨 auth-provider: The patch changes which Mistral browser session is selected, rejected, retried, and cached after 401/403 responses.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: Only tests, fixtures, source-blind cases, and CI are provided; before merge, add redacted terminal output, logs, or a recording from a real macOS setup showing Developer Edition-only import and stale-source fallback, update the PR body to trigger review, or ask a maintainer to comment @clawsweeper re-review, while redacting cookies, account details, private endpoints, and other sensitive data.
Evidence reviewed

What I checked:

  • Developer Edition profile filtering remains: The branch adds the Firefox Developer Edition application bundle name, but the downstream Gecko cookie-store predicate still accepts only profile directory names containing .default; normal *.dev-edition-default profiles can therefore be rejected before cookie import. (Sources/CodexBarCore/BrowserDetection.swift:249, 05090d06398e)
  • Regression fixture does not exercise the failing profile name: The new Developer Edition-only test uses abc.default-release, so it passes the existing .default predicate instead of covering a normal abc.dev-edition-default directory. (Tests/CodexBarTests/BrowserDetectionTests.swift:690, 05090d06398e)
  • Prior blocker remains unresolved: The latest completed ClawSweeper cycle raised the Developer Edition profile-name problem at head b29d86f; the subsequent head still shows no corresponding profile-predicate change. (Sources/CodexBarCore/BrowserDetection.swift:249, b29d86f4aea4)
  • Real behavior proof is absent: The PR body and owner proof comment explicitly report synthetic stores, fixtures, source-blind cases, and CI only, with no live browser-cookie, provider, account, or Keychain run. (05090d06398e)
  • Authentication fallback has focused coverage: The branch adds coverage for stale Chrome and Firefox sessions followed by a valid Safari session, supporting the new retry behavior independently of the remaining Developer Edition defect. (Tests/CodexBarTests/MistralVibeUsageTests.swift:68, 05090d06398e)
  • Mistral hardening history: Recent branch history attributes the multi-session retry, token-flow clarification, and Developer Edition detection work to steipete, making them the strongest routing candidate for this review. (Sources/CodexBarCore/Providers/Mistral/MistralProviderDescriptor.swift:55, 84a085c1a5f4)

Likely related people:

  • steipete: Reviewed the PR, supplied exact-head validation, and authored the recent Mistral retry, token-flow, browser-detection, and test-splitting commits. (role: reviewer and recent area contributor; confidence: high; commits: dbb6c91324d7, 84a085c1a5f4, d830cbe60ed2; files: Sources/CodexBarCore/BrowserDetection.swift, Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift, Sources/CodexBarCore/Providers/Mistral/MistralProviderDescriptor.swift)
  • welcoMattic: Repository release history credits this contributor with the original Mistral provider integration, making them relevant to the intended authentication and cookie-import contract. (role: introduced provider behavior; confidence: medium; files: Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift, Sources/CodexBarCore/Providers/Mistral/MistralProviderDescriptor.swift)
  • bald-ai: Repository history credits this contributor with Gecko profile matching work underlying Firefox cookie-source availability. (role: introduced adjacent browser detection behavior; confidence: medium; files: Sources/CodexBarCore/BrowserDetection.swift, Tests/CodexBarTests/BrowserDetectionTests.swift)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-07-08T05:08:27.734Z sha 3a37002 :: needs real behavior proof before merge. :: [P1] Keep Chrome ahead of new Mistral fallbacks | [P2] Do not scan the full default order for empty preferences
  • reviewed 2026-07-08T05:36:52.880Z sha 525aabd :: needs real behavior proof before merge. :: [P2] Keep empty Mistral preferences off the full browser order
  • reviewed 2026-07-17T03:03:13.995Z sha b29d86f :: needs real behavior proof before merge. :: [P2] Recognize Developer Edition profile directories
  • reviewed 2026-07-17T03:47:52.391Z sha b29d86f :: needs real behavior proof before merge. :: [P2] Accept Developer Edition profile directories

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

Copy link
Copy Markdown

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: 3a37002ec3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Sources/CodexBarCore/Providers/Providers.swift Outdated
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal priority bug or improvement with limited blast radius. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 8, 2026
djsavvy added a commit to djsavvy/CodexBar that referenced this pull request Jul 8, 2026
Avoids regression where a stale Safari session could block a valid
Chrome or Firefox session (Codex review feedback on steipete#1985). Chrome
first preserves the original Chrome-only behavior; Firefox still
detected; Safari follows for Full Disk Access users.
@djsavvy

djsavvy commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

made chrome first

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 8, 2026

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

Copy link
Copy Markdown

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: 9e2da946b9

ℹ️ 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".

Comment thread Sources/CodexBarCore/Providers/Mistral/MistralCookieImporter.swift

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

Copy link
Copy Markdown

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: efe2e40e4f

ℹ️ 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".

/// import to avoid scanning the full default order.
public static var mistralCookieImportOrder: BrowserCookieImportOrder? {
#if os(macOS)
[.chrome, .firefox, .safari]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Include Firefox Developer Edition in auto import

When the Mistral session is only in Firefox Developer Edition, this order never probes it: it contains only .firefox, and BrowserDetection.isCookieSourceAvailable filters non-Safari entries through hasInstalledApplication before reading profile data. On a machine with Firefox Developer Edition.app but no regular Firefox.app, .firefox is filtered out, so Automatic mode falls through to Safari/noCookies despite the new docs claiming Developer Edition support; include that browser/app in the automatic path or stop advertising it.

Useful? React with 👍 / 👎.

steipete pushed a commit to djsavvy/CodexBar that referenced this pull request Jul 17, 2026
Avoids regression where a stale Safari session could block a valid
Chrome or Firefox session (Codex review feedback on steipete#1985). Chrome
first preserves the original Chrome-only behavior; Firefox still
detected; Safari follows for Full Disk Access users.
@steipete
steipete force-pushed the fix/mistral-firefox-cookie-import branch from efe2e40 to b29d86f Compare July 17, 2026 02:16

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

Copy link
Copy Markdown

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: b29d86f4ae

ℹ️ 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".

browser.appBundleName
private func applicationNames(for browser: Browser) -> [String] {
if browser == .firefox {
return [browser.appBundleName, "Firefox Developer Edition"]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Support Developer Edition profile names

Fresh evidence beyond the earlier Firefox Developer Edition app-detection comment is that this adds the Developer Edition bundle name, but the .firefox candidate still has to pass hasValidCookieStore, which only accepts Gecko profile directories containing .default. On a Developer-Edition-only setup the normal profile name is *.dev-edition-default/dev-edition-default, so automatic Mistral import is still filtered out before SweetCookieKit can read the cookies when the user is signed in only there.

Useful? React with 👍 / 👎.

@steipete

Copy link
Copy Markdown
Owner

Maintainer proof for exact head b29d86f4aea47b45a26b23ef4a05cf0148aad454:

  • Firefox Developer Edition-only discovery is covered by the shared Firefox cookie-store regression.
  • Focused parser/browser tests: 59 tests across 4 suites, all green.
  • Source-blind browser behavior validation: 29/29 green.
  • make check: formatting, lint, locale, documentation, packaging, and repository gates green.
  • Autoreview: clean, 0.98 confidence.
  • Hosted CI: exact-head run green.

No live browser, provider, account, or Keychain probe was used.

djsavvy and others added 7 commits July 16, 2026 21:26
Mistral's importSession hardcoded preferredBrowsers to [.chrome], bypassing
the descriptor's browserCookieOrder. Users signed in via Firefox or Firefox
Developer Edition saw "No Mistral session cookies found in browsers."

Add a mistralCookieImportOrder preset ([.safari, .chrome, .firefox]) matching
the MiMo steipete#1304 precedent, wire it through the descriptor, and change
importSession/hasSession to use the descriptor order when no explicit
preferredBrowsers are passed (matching the Manus/Perplexity pattern).

Also update docs/providers.md and add a focused test.
Avoids regression where a stale Safari session could block a valid
Chrome or Firefox session (Codex review feedback on steipete#1985). Chrome
first preserves the original Chrome-only behavior; Firefox still
detected; Safari follows for Full Disk Access users.
@steipete
steipete force-pushed the fix/mistral-firefox-cookie-import branch from b29d86f to 05090d0 Compare July 17, 2026 04:30
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 17, 2026
@steipete

Copy link
Copy Markdown
Owner

Maintainer proof for exact current-main head 05090d06398e10c0e889ea99ce663c18123783b2:

  • Firefox Developer Edition-only discovery is covered by the shared Firefox cookie-store regression.
  • Focused Mistral/browser tests: 55 tests across 3 suites, all green; provider-settings coverage: 37 tests in 1 suite, green.
  • Source-blind browser behavior validation: 29/29 green.
  • make check: formatting, lint, locale, documentation, packaging, and repository gates green.
  • Autoreview: product patch clean at 0.98; current-main rebase and adjacent lint split clean at 0.99.
  • Hosted CI: exact-head run green.

No live browser, provider, account, or Keychain probe was used.

@steipete
steipete merged commit b7920f1 into steipete:main Jul 17, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 Merging this PR could break existing users, config, migrations, defaults, or upgrades. P2 Normal priority bug or improvement with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants