Skip to content

fix(google-meet): fall back to manual OAuth paste when callback port is occupied - #96492

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
yetval:fix/google-meet-oauth-port-fallback
Jun 29, 2026
Merged

vincentkoc merged 1 commit into
openclaw:mainfrom
yetval:fix/google-meet-oauth-port-fallback

Conversation

@yetval

@yetval yetval commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes the second half of #54299. The Google Meet OAuth login (openclaw meet auth login) binds a temporary callback listener on a fixed localhost:8085. When that port is already taken by another local service, the listener throws EADDRINUSE and the error propagates straight out of waitForGoogleMeetAuthCode, aborting the whole login. The user cannot complete OAuth at all until they free the port.

The sibling Gemini CLI OAuth path already handles this exact case: it catches listener/port errors and switches to the manual copy/paste flow so login still succeeds. Google Meet was the one-sided gap.

Why This Change Was Made

extensions/google-meet/src/oauth.ts had no recovery around the local listener:

const callback = await waitForLocalOAuthCallback({
  expectedState: params.state,
  timeoutMs: params.timeoutMs,
  port: 8085,
  callbackPath: "/oauth2callback",
  redirectUri: GOOGLE_MEET_REDIRECT_URI,
  successTitle: "Google Meet OAuth complete",
});
return callback.code;

waitForLocalOAuthCallback rejects through its server.once("error", ...) handler when server.listen(8085) fails, so an occupied port becomes a hard login failure.

The fix mirrors the Gemini path in extensions/google/oauth.ts (err.message.includes("EADDRINUSE") || "port" || "listen"). On a listener/port error it now writes a notice and falls back to the manual paste handler, which is the same code already used for the explicit --manual flag:

try {
  const callback = await waitForLocalOAuthCallback({ ... });
  return callback.code;
} catch (error) {
  if (!isLocalCallbackListenerError(error)) {
    throw error;
  }
  params.writeLine("Local callback server failed. Switching to manual mode...");
  return await readManualGoogleMeetAuthCode({
    state: params.state,
    promptInput: params.promptInput,
  });
}

The pre-existing manual-paste branch was extracted into readManualGoogleMeetAuthCode so the explicit --manual path and the automatic fallback share one implementation.

This change deliberately does not touch the conditional client_secret handling raised in the first half of #54299. That is the Gemini public-client PKCE contract and a maintainer product decision (ClawSweeper labeled it needs-product-decision / needs-security-review), not a defect to silently flip here.

Why This Is The Right Boundary

The fix lives in the Google Meet plugin that owns this OAuth flow, reuses the existing manual handler rather than adding a second paste implementation, and does not change the registered redirect URI or port (changing those would require coordinated provider registration and docs, a separate product decision). It only matches the Gemini sibling's already-shipped recovery behavior. Non-listener failures (timeout, state mismatch, OAuth error) still propagate unchanged, so a genuine auth failure is never masked as a manual prompt.

User Impact

openclaw meet auth login now completes via the manual copy/paste flow when port 8085 is occupied, instead of aborting with EADDRINUSE. No new config or env var; behavior with a free port is unchanged.

Verification

  • node scripts/run-vitest.mjs extensions/google-meet/src/oauth.test.ts passes (8 tests). The new test fails on pristine origin/main with listen EADDRINUSE: address already in use and passes with the patch.
  • oxlint and oxfmt --check clean on both changed files.
  • tsgo -p extensions/google-meet/tsconfig.json clean; extension test-types lane shows only unrelated pre-existing errors in acpx and qa-lab, none in google-meet.

Evidence

Drove the real exported waitForGoogleMeetAuthCode against a genuinely occupied port 8085 on pristine main and on the patched tree. Before the fix the login aborts with EADDRINUSE; after it falls back to manual paste and returns the auth code. Details below.

Real behavior proof

Behavior addressed: openclaw meet auth login aborts with EADDRINUSE when localhost:8085 is occupied, instead of falling back to manual paste like the Gemini path.
Real environment tested: drove the real exported waitForGoogleMeetAuthCode from extensions/google-meet/src/oauth.ts via tsx on pristine main 3217165 and on the patched tree, with a real node:http server actually bound to port 8085 to occupy it; the real waitForLocalOAuthCallback listener and the real manual-paste parser stayed real, nothing was stubbed.
Exact steps or command run after this patch: bind a real http server on localhost:8085, then call waitForGoogleMeetAuthCode({ manual: false, state, authUrl, promptInput, writeLine }) where promptInput returns the redirect URL http://localhost:8085/oauth2callback?code=auth-code-123&state=state-token.
Evidence after fix:

# BEFORE (pristine main 3217165be770)
port 8085 is occupied by another local service
[meet login] Open this URL in your browser:

https://accounts.google.com/o/oauth2/v2/auth?x=1

RESULT: login failed with listen EADDRINUSE: address already in use ::1:8085

# AFTER (this patch, identical inputs)
port 8085 is occupied by another local service
[meet login] Open this URL in your browser:

https://accounts.google.com/o/oauth2/v2/auth?x=1

[meet login] Local callback server failed. Switching to manual mode...
RESULT: login succeeded, auth code = auth-code-123

Observed result after fix: with port 8085 occupied, the login now switches to manual paste and returns the authorization code, where before it aborted with an EADDRINUSE listener error.
What was not tested: no live Google OAuth token exchange against Google's servers; the callback-listener failure and manual fallback are driven against a real local listener, and the provider HTTP exchange is out of scope for this change. Full build not run.

@clawsweeper

clawsweeper Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 24, 2026, 12:36 PM ET / 16:36 UTC.

Summary
The PR catches Google Meet local OAuth callback listener errors, reuses the manual paste parser as fallback, and adds occupied-port plus timeout regression tests.

PR surface: Source +32, Tests +66. Total +98 across 2 files.

Reproducibility: yes. at source/proof level. Current main directly awaits the fixed localhost:8085 listener, the shared helper rejects listener errors, and the PR body includes before/after live output with port 8085 occupied.

Review metrics: none identified.

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🦞 diamond lobster
Patch quality: 🐚 platinum hermit
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:

  • none.

Risk before merge

  • [P1] At review time, two CI jobs were still in progress for head 4891649, so merge should wait for required exact-head checks to finish.

Maintainer options:

  1. Decide the mitigation before merge
    Land this plugin-local fallback after exact-head CI completes, while leaving the broader Google OAuth client_secret policy decision in the linked issue.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • [P2] No repair lane is needed; the remaining action is maintainer review and exact-head CI completion.

Security
Cleared: The diff only changes Google Meet OAuth listener fallback behavior and tests; it does not add dependencies, workflows, secret storage, or token-exchange changes.

Review details

Best possible solution:

Land this plugin-local fallback after exact-head CI completes, while leaving the broader Google OAuth client_secret policy decision in the linked issue.

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

Yes at source/proof level. Current main directly awaits the fixed localhost:8085 listener, the shared helper rejects listener errors, and the PR body includes before/after live output with port 8085 occupied.

Is this the best way to solve the issue?

Yes. Reusing the existing manual paste flow inside the Google Meet plugin mirrors the sibling Google OAuth behavior without changing config, registered redirect URI, or token exchange policy.

AGENTS.md: found and applied where relevant.

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

Label changes

Label justifications:

  • P2: The PR fixes a real Google Meet OAuth login failure with limited plugin-level blast radius and focused regression coverage.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body includes before/after live output from the real exported waitForGoogleMeetAuthCode path with a real local server occupying port 8085.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes before/after live output from the real exported waitForGoogleMeetAuthCode path with a real local server occupying port 8085.
Evidence reviewed

PR surface:

Source +32, Tests +66. Total +98 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 51 19 +32
Tests 1 66 0 +66
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 117 19 +98

What I checked:

  • Current Google Meet behavior lacks fallback: Current main writes the auth URL and directly awaits waitForLocalOAuthCallback on fixed port 8085 when --manual is not set, so listener bind errors propagate out of the login flow. (extensions/google-meet/src/oauth.ts:239, f29dbd3ebd1c)
  • Shared callback helper rejects listener errors: waitForLocalOAuthCallback registers server.once("error", ...) and rejects through finish(), which supports the EADDRINUSE failure path described by the PR. (src/plugin-sdk/provider-auth-runtime.ts:274, f29dbd3ebd1c)
  • Sibling Google OAuth fallback exists: The Google/Gemini OAuth path catches EADDRINUSE/port/listen listener failures and switches to manualFlow, supporting the PR's parity boundary. (extensions/google/oauth.ts:61, f29dbd3ebd1c)
  • PR diff adds the focused fallback and robust test setup: The current PR head extracts readManualGoogleMeetAuthCode, catches listener errors, and the occupied-port test now tolerates an already occupied port by returning null from occupyPort. (extensions/google-meet/src/oauth.test.ts:10, 4891649baaab)
  • Related issue remains broader: The linked issue tracks both client_secret policy and the hardcoded callback port; this PR intentionally fixes only the occupied-port login failure and leaves the auth/security policy decision open.
  • History points to the current OAuth implementation: git blame shows the Google Meet OAuth file, shared callback helper, and sibling Google fallback were introduced in commit bfffc77. (extensions/google-meet/src/oauth.ts:16, bfffc77bfc86)

Likely related people:

  • vincentkoc: Git blame and file history show the current Google Meet OAuth flow, shared callback helper, and sibling Google OAuth fallback came from the merged BYOK provider parity work. (role: feature owner / recent area contributor; confidence: high; commits: bfffc77bfc86; files: extensions/google-meet/src/oauth.ts, extensions/google-meet/src/oauth.test.ts, extensions/google/oauth.ts)
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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. labels Jun 24, 2026
…is occupied

The Google Meet OAuth login binds a fixed localhost:8085 callback listener
and let listener failures propagate, so meet auth login aborted entirely when
port 8085 was already in use. The sibling Gemini CLI OAuth path already
recovers by switching to the manual copy/paste flow on EADDRINUSE/listen
errors; bring Google Meet to parity by catching listener errors and reusing
the existing manual-paste handler instead of failing the login.
@yetval
yetval force-pushed the fix/google-meet-oauth-port-fallback branch from 1904fd0 to 4891649 Compare June 24, 2026 16:28
@yetval

yetval commented Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 24, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

@vincentkoc
vincentkoc merged commit 38ab207 into openclaw:main Jun 29, 2026
85 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 30, 2026
…is occupied (openclaw#96492)

The Google Meet OAuth login binds a fixed localhost:8085 callback listener
and let listener failures propagate, so meet auth login aborted entirely when
port 8085 was already in use. The sibling Gemini CLI OAuth path already
recovers by switching to the manual copy/paste flow on EADDRINUSE/listen
errors; bring Google Meet to parity by catching listener errors and reusing
the existing manual-paste handler instead of failing the login.
chenyangjun-xy pushed a commit to chenyangjun-xy/openclaw that referenced this pull request Jul 1, 2026
…is occupied (openclaw#96492)

The Google Meet OAuth login binds a fixed localhost:8085 callback listener
and let listener failures propagate, so meet auth login aborted entirely when
port 8085 was already in use. The sibling Gemini CLI OAuth path already
recovers by switching to the manual copy/paste flow on EADDRINUSE/listen
errors; bring Google Meet to parity by catching listener errors and reusing
the existing manual-paste handler instead of failing the login.
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Jul 5, 2026
…is occupied (openclaw#96492)

The Google Meet OAuth login binds a fixed localhost:8085 callback listener
and let listener failures propagate, so meet auth login aborted entirely when
port 8085 was already in use. The sibling Gemini CLI OAuth path already
recovers by switching to the manual copy/paste flow on EADDRINUSE/listen
errors; bring Google Meet to parity by catching listener errors and reusing
the existing manual-paste handler instead of failing the login.

(cherry picked from commit 38ab207)
Rorqualx pushed a commit to Rorqualx/cortex that referenced this pull request Jul 8, 2026
…is occupied (openclaw#96492)

The Google Meet OAuth login binds a fixed localhost:8085 callback listener
and let listener failures propagate, so meet auth login aborted entirely when
port 8085 was already in use. The sibling Gemini CLI OAuth path already
recovers by switching to the manual copy/paste flow on EADDRINUSE/listen
errors; bring Google Meet to parity by catching listener errors and reusing
the existing manual-paste handler instead of failing the login.

(cherry picked from commit 38ab207)
wheakerd pushed a commit to wheakerd/clawdbot that referenced this pull request Jul 15, 2026
…is occupied (openclaw#96492)

The Google Meet OAuth login binds a fixed localhost:8085 callback listener
and let listener failures propagate, so meet auth login aborted entirely when
port 8085 was already in use. The sibling Gemini CLI OAuth path already
recovers by switching to the manual copy/paste flow on EADDRINUSE/listen
errors; bring Google Meet to parity by catching listener errors and reusing
the existing manual-paste handler instead of failing the login.

(cherry picked from commit 38ab207)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. plugin: google-meet proof: sufficient ClawSweeper judged the real behavior proof convincing. 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.

2 participants