Skip to content

fix(macos): finish ChatGPT login after Gateway reconnect - #134268

Merged
obviyus merged 2 commits into
mainfrom
codex/issue-134182
Aug 31, 2026
Merged

obviyus merged 2 commits into
mainfrom
codex/issue-134182

Conversation

@obviyus

@obviyus obviyus commented Aug 31, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #134182

What Problem This Solves

Fixes an issue where users who started ChatGPT Login during macOS onboarding could receive a generic Gateway transport error after the socket reconnected. The callback was rejected before dispatch, but the app cancelled the live wizard session and left the visible Submit control unable to send another request.

Why This Change Was Made

The native onboarding owner now retries only the typed notDispatched failure, which proves the callback did not reach the Gateway. It reacquires the same route, preserves the existing wizard session and answer, and sends one replacement request.

Post-dispatch failures, provider errors, cancellation, route changes, and a failed replacement request keep their existing cancellation and reconciliation behavior. The retry never starts a second provider login.

User Impact

ChatGPT Login can finish after a same-route Gateway socket reconnect during the browser flow. Users still see the provider's real error when the provider rejects the callback.

Evidence

Proof Result
Exact-main macOS run at 2278fbc9df879d52efbb6a0b81f7798a9f7c16c1 plus the regression test The replacement socket received no wizard.next; onboarding sent wizard.cancel, showed OpenClawChatTransportSendError error 0, and stayed disconnected.
Exact-head pull request CI at a603799a69a9d230d34de146769174ffe3e169b5 Swift lint, native release build, existing onboarding tests, and the focused stale-lease regression passed. All required checks are green.

The regression rotates the physical socket after provider auth starts. It verifies that one replacement wizard.next carries the same session ID, step ID, and callback value, and that no wizard cancellation occurs.

Production LOC: +52/-33, net +19. Of these additions, 25 are a pure move of existing non-localized helpers into the existing support file so the owner stays under its enforced file-length limit without changing the string inventory. The remaining growth implements the typed, same-route, exactly-once recovery boundary.

@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added app: macos App: macos size: S maintainer Maintainer-authored PR labels Aug 31, 2026
@obviyus
obviyus force-pushed the codex/issue-134182 branch from dc8dc1d to a603799 Compare August 31, 2026 16:27
@clawsweeper clawsweeper Bot added P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 31, 2026
@clawsweeper

clawsweeper Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 31, 2026, 12:34 PM ET / 16:34 UTC.

ClawSweeper review

What this changes

The branch lets macOS onboarding resend a provider-auth callback once after a pre-dispatch Gateway socket reconnect, retaining the same Gateway route and wizard session.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open. The PR repairs a source-proven first-run macOS onboarding failure with a narrow same-route retry, while the current main branch and v2026.8.1 still cancel the wizard immediately; the protected maintainer item should proceed through normal exact-head CI and maintainer handling.

Priority: P0
Reviewed head: a603799a69a9d230d34de146769174ffe3e169b5

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary fix with a meaningful reconnect regression harness and no identified correctness or security defect.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: repository state identifies this as a maintainer PR, for which the external-contributor proof gate does not apply; its included harness still directly covers the production onboarding owner and injected socket-reconnect scenario.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: repository state identifies this as a maintainer PR, for which the external-contributor proof gate does not apply; its included harness still directly covers the production onboarding owner and injected socket-reconnect scenario.
Evidence reviewed 7 items Shipped failure path: The v2026.8.1 source sends wizard.next on the captured lease and immediately cancels the known wizard session for every thrown error, which matches the reported stale-lease failure.
Release provenance: The reported release commit is exactly tagged v2026.8.1.
Retry safety contract: The shared transport defines notDispatched as a request rejected before reaching its request channel; the Gateway lease wrapper emits it only before invoking the socket request, while the underlying stale-generation request emits CancellationError.
Findings None None.
Security None None.

How this fits together

macOS onboarding sends a browser-returned provider callback to the Gateway wizard. The onboarding model holds the authenticated socket lease so that the callback reaches the same Gateway session or fails safely without crossing to a different route.

flowchart LR
  Browser[Browser OAuth callback] --> Onboarding[macOS onboarding]
  Onboarding --> Lease{Server lease current?}
  Lease -->|Yes| Wizard[Gateway wizard callback]
  Lease -->|No| Reconnect[Reacquire same Gateway route]
  Reconnect --> Wizard
  Wizard --> Setup[Connected provider setup]
Loading

Before merge

  • Resolve merge risk (P1) - Production code is net +19 lines for a bug fix; the added branch is justified by retaining the replacement lease for the exactly-once retry and subsequent cleanup, but should remain limited to the wrapper-proven pre-dispatch case.
  • Resolve merge risk (P1) - Exact-head macOS checks were still in progress in the supplied review state.
  • Complete next step (P2) - This protected maintainer PR has no concrete repair finding; await the exact-head macOS checks and complete normal maintainer merge handling.
Agent review details

Security

None.

PR surface

Other +96. Total +96 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 129 33 +96
Total 3 129 33 +96

Review metrics

Metric Value Why it matters
Production versus test delta production +19 net (52 added, 33 removed); tests +77 The production growth implements one lease-reacquisition boundary; the test addition exercises the socket-reconnect path through the onboarding owner.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #134182
Summary: This PR is the linked candidate fix for the reported macOS OAuth callback failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the recovery confined to the typed pre-dispatch error, preserve same-route and current-attempt checks, retain the boundary regression, and merge only after the current head's relevant macOS checks complete.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the recovery confined to the typed pre-dispatch error, preserve same-route and current-attempt checks, retain the boundary regression, and merge only after the current head's relevant macOS checks complete.

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

Yes—source inspection gives a high-confidence reproduction shape: invalidate the captured server lease after wizard start, then submit the callback. The added boundary harness encodes that sequence, though this review did not execute it.

Is this the best way to solve the issue?

Yes. Retrying only the wrapper-proven pre-dispatch result, on a route-identical replacement lease and with existing attempt guards, avoids duplicating a callback that might have reached the Gateway.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P0: This fixes a first-time provider setup path that can leave a macOS user unable to finish onboarding after completing browser authentication.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: repository state identifies this as a maintainer PR, for which the external-contributor proof gate does not apply; its included harness still directly covers the production onboarding owner and injected socket-reconnect scenario.

Label justifications:

  • P0: This fixes a first-time provider setup path that can leave a macOS user unable to finish onboarding after completing browser authentication.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: repository state identifies this as a maintainer PR, for which the external-contributor proof gate does not apply; its included harness still directly covers the production onboarding owner and injected socket-reconnect scenario.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

@obviyus

obviyus commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

ClawSweeper rank-up moves are resolved on a603799a69a9d230d34de146769174ffe3e169b5:

  • Production remains net +19 lines because the owner now has one explicit recovery branch for the only transport result that proves no dispatch. It does not add a generic retry, fallback, or second login path.
  • Exact-head pull request CI is green, including the macOS native tests and localization inventory check.
  • LandPR Autoreview passed on this head with no accepted or actionable findings. Normal maintainer merge handling is complete.

@obviyus
obviyus merged commit b75d04d into main Aug 31, 2026
64 checks passed
@obviyus
obviyus deleted the codex/issue-134182 branch August 31, 2026 17:40
@obviyus

obviyus commented Aug 31, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @Sedrak-Hovhannisyan!

Proof: macOS onboarding now keeps the same ChatGPT Login wizard and submits the callback once after a same-route Gateway socket reconnect. Exact-head CI passed the native macOS tests.

  • Bug: A stale pre-dispatch socket lease cancelled the live wizard, showed a generic transport error, and left Submit unable to retry.
  • Fix: The native onboarding owner now reacquires the same route and retries exactly once only when transport proves the first callback was not dispatched.
  • Landed: b75d04d016171a55b876ee053a0979cfd852e36b
Before After
Callback cancelled and onboarding stayed blocked after a socket reconnect. The same wizard session completes through one safe replacement Submit.

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

Labels

app: macos App: macos maintainer Maintainer-authored PR P0 Emergency: data loss, security bypass, crash loop, or unusable core runtime. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: macOS ChatGPT OAuth callback fails with generic Gateway transport error

1 participant