Skip to content

Ollama: surface browser cookie access errors - #2249

Merged
steipete merged 1 commit into
mainfrom
codex/issue-2072-ollama-cookie-hints
Jul 17, 2026
Merged

Ollama: surface browser cookie access errors#2249
steipete merged 1 commit into
mainfrom
codex/issue-2072-ollama-cookie-hints

Conversation

@steipete

Copy link
Copy Markdown
Owner

Summary

  • preserve unambiguous Safari Full Disk Access and Chromium Keychain failures from Ollama cookie import
  • surface localized recovery hints instead of the generic sign-in message
  • explain exact-browser cooldowns conservatively while keeping manual-refresh retries functional

Verification

  • swift test --filter OllamaUsageFetcherTests — 26 tests passed
  • swift test --filter OllamaUIErrorMapperTests — 4 tests passed
  • node Scripts/check-app-locales.mjs --test — passed
  • node Scripts/check-app-locales.mjs — 22 catalogs matched 1,166 English keys
  • make check — SwiftFormat clean; SwiftLint 0 violations; script/docs/locale checks passed
  • make test — 664 selections completed; one full group recovered on retry; zero timeouts or isolated retries
  • autoreview — clean after fixing its manual-refresh cooldown finding

Refs #2072. Keep the issue open until the reporter confirms the fix.

@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: 067f4617db

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

do {
return try self.selectSessionInfos(from: fallbackCandidates, logger: log)
} catch OllamaUsageError.noSessionCookie {
throw accessError ?? OllamaUsageError.noSessionCookie

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 Preserve no-session errors after accessible preferred browsers

When the default Chrome import is accessible but simply has no recognized Ollama session, fallback probing still includes Safari (which BrowserDetection.isCookieSourceAvailable(.safari) treats as available), and a Safari Full Disk Access failure captured in accessError makes this line throw the Safari permission hint instead of noSessionCookie. In that common Chrome-default scenario, the user is told to grant Safari Full Disk Access even though signing into Chrome would fix the issue, so the access error should only replace noSessionCookie when all relevant candidates were blocked by access, not when an accessible preferred browser was just unauthenticated.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P1 Urgent regression or broken agent/channel workflow affecting real users now. merge-risk: 🚨 auth-provider 🚨 Merging this PR could break OAuth, tokens, provider routing, model choice, or credentials. labels Jul 17, 2026
@clawsweeper

clawsweeper Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge. Reviewed July 16, 2026, 9:56 PM ET / July 17, 2026, 01:56 UTC.

Summary
The PR preserves Ollama browser-cookie access failures, adds localized recovery messages, and makes Keychain cooldown reporting browser-specific.

Reproducibility: yes. A focused importer test can use an accessible Chrome source with no recognized Ollama session followed by Safari access denial and assert that the result remains noSessionCookie; the supplied review comment traces that current-head path directly.

Review metrics: 3 noteworthy metrics.

  • Patch surface: 29 files, +374/-29. The behavioral change is concentrated in three implementation files while most touched paths are localization catalogs.
  • Localization coverage: 22 catalogs changed. All shipped translations receive the new browser-access recovery messages.
  • Reported focused tests: 30 tests passed. The PR reports 26 importer tests and 4 UI-mapper tests, though the mixed accessible/blocked-browser scenario remains the key missing assertion.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🌊 off-meta tidepool
Patch quality: 🦐 gold shrimp
Result: ready for maintainer review.

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

Rank-up moves:

  • [P2] Fix the mixed accessible/blocked-browser precedence and add a focused regression test for Chrome-without-session plus Safari-access-denied.

Risk before merge

  • [P1] Merging the current candidate precedence can direct a Chrome user to grant Safari Full Disk Access even though signing into Ollama in the accessible preferred browser is the relevant recovery action.

Maintainer options:

  1. Preserve accessible-browser precedence (recommended)
    Update candidate accounting so an accessible browser without an Ollama session retains the normal sign-in guidance instead of inheriting a blocked fallback browser's permission error.
  2. Accept fallback-error precedence
    Merge only if maintainers explicitly intend any fallback browser access failure to override an accessible browser's missing-session result.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Preserve the no-session result whenever any relevant browser was accessible, surface cookie-access errors only when all relevant candidates were blocked, and add the mixed Chrome/Safari regression test.

Next step before merge

  • [P2] The remaining blocker is a narrow importer-precedence repair with a concrete regression test and no unresolved product or security decision.

Security
Cleared: The patch changes local cookie-error classification and presentation without broadening permissions, secret access, dependency sources, workflows, or executable supply-chain inputs.

Review findings

  • [P2] Preserve no-session errors after accessible browser checks — Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:103
Review details

Best possible solution:

Track whether any relevant browser was successfully accessible and surface a stored access error only when all relevant candidates were access-blocked; cover both that mixed-result case and manual-refresh cooldown retries with focused tests.

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

Yes. A focused importer test can use an accessible Chrome source with no recognized Ollama session followed by Safari access denial and assert that the result remains noSessionCookie; the supplied review comment traces that current-head path directly.

Is this the best way to solve the issue?

Not yet. Typed errors and localized mapping are appropriate, but access failures should override no-session guidance only when every relevant browser candidate was blocked.

Full review comments:

  • [P2] Preserve no-session errors after accessible browser checks — Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift:103
    When the preferred Chrome import is accessible but contains no recognized Ollama session, probing fallback Safari can still record a Full Disk Access failure and throw that error instead of noSessionCookie. This tells the user to change Safari permissions even though signing into the accessible preferred browser is the relevant recovery path; only replace the no-session result when all relevant candidates were access-blocked.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.94

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add P1: Incorrect recovery guidance can keep affected users from restoring the Ollama provider flow despite having an accessible supported browser.
  • add merge-risk: 🚨 auth-provider: The changed browser-candidate precedence can route users toward the wrong permission or sign-in recovery action.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this owner-authored PR; the reported focused tests and repository checks remain useful supplemental validation.

Label justifications:

  • P1: Incorrect recovery guidance can keep affected users from restoring the Ollama provider flow despite having an accessible supported browser.
  • merge-risk: 🚨 auth-provider: The changed browser-candidate precedence can route users toward the wrong permission or sign-in recovery action.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The external-contributor proof gate does not apply to this owner-authored PR; the reported focused tests and repository checks remain useful supplemental validation.
Evidence reviewed

Acceptance criteria:

  • [P1] swift test --filter OllamaUsageFetcherTests.
  • [P1] swift test --filter OllamaUIErrorMapperTests.
  • [P1] node Scripts/check-app-locales.mjs --test.
  • [P1] node Scripts/check-app-locales.mjs.
  • [P1] make check.

What I checked:

Likely related people:

  • steipete: The repository owner authored the current implementation and is the clearest routing candidate for the intended Ollama cookie-import precedence. (role: feature owner; confidence: high; commits: 067f4617dbc1; files: Sources/CodexBarCore/Providers/Ollama/OllamaUsageFetcher.swift, Sources/CodexBarCore/BrowserCookieAccessGate.swift, Sources/CodexBar/Providers/Ollama/OllamaUIErrorMapper.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.

@steipete
steipete merged commit 7f2c596 into main Jul 17, 2026
8 checks passed
@steipete

Copy link
Copy Markdown
Owner Author

Verified and merged.

  • Reviewed implementation commit 067f4617dbc143ea0c94096075cd4b5a46919625 and the surrounding Safari/Chromium cookie error paths.
  • swift test --filter OllamaUsageFetcherTests: 26 tests passed.
  • swift test --filter OllamaUIErrorMapperTests: 4 tests passed.
  • node Scripts/check-app-locales.mjs --test: passed.
  • node Scripts/check-app-locales.mjs: passed; 22 localized catalogs matched 1,166 English keys.
  • make check: passed; locale/script/docs checks, SwiftFormat, and SwiftLint completed with 0 violations across 1,473 files.
  • make test: exit 0; 664 selections completed. 55 groups passed first attempt and one full-group retry recovered; no timeouts or isolated retries.
  • Exact-head CI was fully green: changes, lint, Linux x64, Linux arm64, macOS shard 0/2, macOS shard 1/2, rollup, and GitGuardian.
  • Merge commit: 7f2c5965cd4ae9840c8933a6dab1f80c5efae7cf.

axisrow added a commit to axisrow/CodexBar that referenced this pull request Aug 9, 2026
ClawSweeper (P1) and Codex both flagged that fetchBrowserOrRethrow
swallows every fetchBrowser failure — including the specific,
actionable diagnoses (safariCookieAccessDenied,
browserCookieDecryptionDenied, browserCookieDecryptionDisabled) — and
always substitutes the generic stale cached-cookie auth error. On a
user-initiated refresh this replaces a fixable diagnosis (grant Full
Disk Access, retry a declined Keychain prompt) with a misleading
'please sign in again', undoing the explicit-retry guidance shipped in
steipete#2249/steipete#2595.

fetchBrowserOrRethrow now re-throws an actionable browser-access error
as-is instead of substituting the original cached error; a non-
actionable recovery failure (no candidates found, network error, etc.)
still falls back to the original error as before.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqBGFKF9M8etkRpgz2bk2Z
steipete pushed a commit that referenced this pull request Aug 13, 2026
Fixes #2072.

ollama.com rotates its session cookie independently of the user's
signed-in state. When a background refresh (5-minute timer) sees the
cached cookie fail with an auth error, fetchAutomatic cleared the
cache and unconditionally fell through to a browser cookie read to
recover — but BrowserCookieAccessGate denies that read in a
background context (no interactive Keychain prompt outside a
user-initiated action). The browser read then returned no candidates,
surfacing as the misleading 'No Ollama session cookie found. Please
sign in...' error, even though the user was still signed in and the
cache had simply been cleared a moment earlier by this same call. The
cache stayed empty, so every subsequent background tick repeated the
same failure until the next manual refresh repopulated it — the
reported flicker.

fetchAutomatic now re-throws the original auth error instead of
falling through to a browser read when the interaction context is
.background, deferring recovery to the next user-initiated refresh
(which already has the explicit-retry path from #2249/#2595).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqBGFKF9M8etkRpgz2bk2Z
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. P1 Urgent regression or broken agent/channel workflow affecting real users now. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant