Skip to content

fix(google-meet): classify gateway CLI fallback with typed guards instead of message matching - #125495

Merged
steipete merged 2 commits into
mainfrom
steipete/beautiful-hopper-dceecf
Aug 18, 2026
Merged

steipete merged 2 commits into
mainfrom
steipete/beautiful-hopper-dceecf

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

extensions/google-meet/src/cli-shared.ts classified gateway failures for its local-runtime fallback by message substrings (ECONNREFUSED, ECONNRESET, EHOSTUNREACH, ENOTFOUND, "gateway not connected", "unknown method: X") — the same fragile pattern #125458 replaces in the voice-call CLI. String matching breaks silently when error wording changes and classifies arbitrary error text that merely embeds an errno.

Why This Change Was Made

The classifier now uses the typed structural guards isGatewayTransportError / isGatewayClientRequestError, with google-meet's decision surface chosen deliberately per arm:

  • Unreachable socket errors → local fallback (kept, now typed). Connect-time socket failures surface as GatewayTransportError kind "closed" with no WS close code. This also covers ETIMEDOUT/ENETUNREACH, which the old string list missed.
  • Connect-time ECONNRESET → fixed at the producer. It was missing from GATEWAY_UNREACHABLE_SOCKET_CODES in src/gateway/call.ts, so it escaped as a raw Node error no typed guard could see. Added to the set: it now wraps into the same actionable unreachable transport error, preserving google-meet's historical ECONNRESET fallback (and restoring voice-call's once fix(voice-call): survive gateway in-process restart and stop CLI dead-ends #125458 lands).
  • Coded closes incl. 1006 → still no fallback (deliberate divergence from voice-call). A coded close means a live gateway answered and may still own Meet browser sessions; falling back would split session ownership into a second local Chrome. Voice-call retries 1006 because its calls live in Twilio, not in whoever launched the browser.
  • unknown method: <exact method> → fallback kept, tightened. Must now be a structural GatewayClientRequestError (the server replies with the shared INVALID_REQUEST code, so the message check itself must stay), no longer arbitrary error text.
  • "gateway not connected" race arm dropped (plain-Error race between hello and request; same accepted tradeoff as fix(voice-call): survive gateway in-process restart and stop CLI dead-ends #125458).

Deliberately not migrated (different purpose, not provably behavior-preserving):

  • qa-lab (extensions/qa-lab/src/suite-runtime-gateway.ts, gateway-child-readiness.ts): retry classifiers partly consume pre-formatted strings and child-gateway log text across a process boundary, where typed guards cannot reach.
  • doctor (src/commands/doctor-gateway-health.ts, doctor-gateway-daemon-flow.ts): the outer "gateway closed" gate deliberately tolerates wrapped/stringified errors; the inner formatGatewayClosedDiagnostic already uses the typed guard.

Overlap note: three hunks (the isGatewayClientRequestError extraction in src/gateway/call.ts, the plugin-sdk/gateway-runtime barrel export, the +2 SDK surface-budget bumps) are intentionally verbatim-identical to open #125458 so whichever PR lands second rebases trivially.

User Impact

openclaw googlemeet ... CLI fallback to the local runtime now keys off typed error structure instead of error prose. Behavior changes: unreachable-host timeouts (ETIMEDOUT/ENETUNREACH) now correctly fall back to local; connect-time ECONNRESET gets an actionable "Gateway not reachable" message everywhere instead of a raw Node error.

Evidence

  • New boundary test extensions/google-meet/src/cli-shared.gateway-fallback.test.ts covers the full decision surface through the exported callGoogleMeetGateway (10 cases incl. the deliberate 1006-no-fallback and the dropped string arms; the uncoded-close and dropped-arm cases fail on pre-migration code).
  • node scripts/run-vitest.mjs extensions/google-meet — 345/345 passed.
  • node scripts/run-vitest.mjs src/gateway/call.test.ts — passed, incl. new ECONNRESET case in the unreachable-rendering it.each.
  • pnpm plugin-sdk:surface:check — passed at 4330/2574.
  • node scripts/check-changed.mjs — passed.
  • Codex autoreview (--mode uncommitted) — clean.

Production LOC delta: core +~30 (guard extraction is restructuring; ECONNRESET +2), google-meet classifier net −2; the SDK surface growth (+2 exports) is the named seam shared with #125458.

@clawsweeper

clawsweeper Bot commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@steipete
steipete marked this pull request as ready for review August 18, 2026 01:31
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime scripts Repository scripts plugin: google-meet size: S maintainer Maintainer-authored PR labels Aug 18, 2026
@clawsweeper clawsweeper Bot added 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. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Aug 18, 2026
@clawsweeper

clawsweeper Bot commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 11:33 PM ET / August 18, 2026, 03:33 UTC.

ClawSweeper review

What this changes

The PR changes Google Meet CLI local fallback from error-text matching to typed Gateway errors, adds ECONNRESET classification at the Gateway producer, and makes a Linux process-supervisor test recognize zombie processes as terminated.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness or security defect was found. This protected maintainer PR remains open for the deliberate fallback-compatibility choice and completion of exact-head CI.

Priority: P2
Reviewed head: 27932a80ad3e5566e6445525fdd6b2e36ce0b95d
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch follows the Gateway producer contract and has focused boundary coverage; final merge readiness depends on the explicit compatibility decision and exact-head CI.
Proof confidence 🌊 off-meta tidepool Not applicable: This member-owned PR is outside the external-contributor proof gate; its discussion supplies focused Docker and test evidence, but no additional contributor proof is required.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-owned PR is outside the external-contributor proof gate; its discussion supplies focused Docker and test evidence, but no additional contributor proof is required.
Evidence reviewed 7 items Current main still uses string matching: Current main classifies local fallback from raw error text, so the central Google Meet change is not already implemented.
Producer and consumer contract align: The branch converts connect-time ECONNRESET into an uncoded closed Gateway transport error, and the Google Meet caller falls back only for that typed unavailable shape while preserving coded-close handling.
Gateway server contract: The Gateway emits INVALID_REQUEST with the exact unknown method: &lt;method> message when no handler is registered; the typed request guard prevents arbitrary plain errors from taking the local-runtime path.
Findings None None.
Security None None.

How this fits together

Google Meet CLI commands first call the Gateway-owned Meet runtime and start a local runtime only when the Gateway is genuinely unavailable. The PR also adjusts a supervisor test helper that determines whether child processes have exited.

flowchart LR
  A[Google Meet CLI command] --> B[Gateway RPC client]
  B --> C[Typed Gateway result]
  C --> D{Gateway unavailable?}
  D -->|yes| E[Local Meet runtime]
  D -->|no| F[Gateway result or actionable error]
Loading

Decision needed

Question Recommendation
Should this protected maintainer PR land with the deliberate typed-only Google Meet fallback policy once exact-head CI is green? Accept typed-only fallback: Land after exact-head CI is green, preserving local fallback only for uncoded typed transport absence and exact unknown-method responses.

Why: The fallback determines whether an existing Gateway-owned browser session is preserved or a separate local runtime starts, which is an operator-compatibility choice beyond mechanical review.

Before merge

  • Resolve merge risk (P2) - This intentionally narrows compatibility: generic plain errors such as gateway not connected no longer trigger a local Meet runtime, so maintainers should explicitly accept the typed-only fallback policy for existing operators.
  • Complete next step (P2) - A protected maintainer-labelled PR needs explicit acceptance of its compatibility policy and exact-head CI completion; no mechanical repair was identified.
Agent review details

Security

None.

PR surface

Source +8, Tests +107. Total +115 across 6 files.

View PR surface stats
Area Files Added Removed Net
Source 3 20 12 +8
Tests 3 109 2 +107
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 6 129 14 +115

Review metrics

Metric Value Why it matters
Production versus test LOC production +15/-11 (net +4); tests/test support +114/-3 (net +111) The small production increase is limited to typed fallback classification and ECONNRESET ownership; most added surface is focused regression and CI-stability coverage.

Merge-risk options

  • The current head has not yet completed all required checks; merge should wait for exact-head green CI.

Maintainer options:

  1. Accept the typed-only fallback boundary (recommended)
    Confirm that surfacing plain or coded Gateway failures is preferable to starting a second local Meet runtime, then merge after exact-head CI is green.
  2. Preserve a legacy compatibility arm
    Restore a specifically justified plain-error fallback only if maintainers identify an existing supported Gateway path that cannot emit the typed contract.

Technical review

Best possible solution:

Keep one typed fallback policy: use a local Meet runtime only when the Gateway is unambiguously absent, while retaining the Linux zombie-aware lifecycle assertion as test-only reliability coverage.

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

No live Google Meet reproduction was run in this read-only review; yes, the owner-boundary behavior is source-reproducible through the focused typed-error cases in extensions/google-meet/src/cli-shared.gateway-fallback.test.ts.

Is this the best way to solve the issue?

Yes. The producer now records connection absence as a typed Gateway transport error and the Google Meet owner consumes that fact, avoiding the old arbitrary-message fallback while preserving its intentional coded-close policy.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P2: This is a bounded CLI fallback and test-reliability fix with compatibility implications, not an emergency user outage.
  • merge-risk: 🚨 compatibility: The branch deliberately stops treating several legacy plain-error messages as permission to start a local Meet runtime.
  • 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: This member-owned PR is outside the external-contributor proof gate; its discussion supplies focused Docker and test evidence, but no additional contributor proof is required.

Evidence

What I checked:

Likely related people:

  • steipete: Recent Google Meet feature work, the merged typed-Gateway guard seam, and this branch’s process-test repair all trace to this contributor. (role: recent feature and Gateway contributor; confidence: high; commits: 7d4066639ef0, 75fcaba9191e, 27932a80ad3e; files: extensions/google-meet/src/cli-shared.ts, src/gateway/call.ts, src/process/supervisor/adapters/child.service-lifecycle.test.ts)
  • Darren2030: Recent Gateway history includes the coded-close/1006 behavior that this PR deliberately distinguishes from the Google Meet fallback policy. (role: adjacent Gateway behavior contributor; confidence: medium; commits: 7c0d11eac124; files: src/gateway/call.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Let the exact-head checks complete successfully.
  • Confirm the typed-only fallback policy for existing Google Meet operators.

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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-08-18T01:36:39.216Z sha ddf8a26 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T02:08:43.966Z sha ddf8a26 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-18T02:31:42.431Z sha 8bb262d :: needs maintainer review before merge. :: none

@steipete

Copy link
Copy Markdown
Contributor Author

Addressing the rank-up moves before landing:

  • Explicit acceptance of the additive Plugin SDK contract: accepted. isGatewayTransportError and isGatewayClientRequestError are generic structural guards over the existing GatewayTransportError/GatewayClientRequestError classes already exported (as constructible types) from core — they classify shape, not Meet-specific behavior, so the plugin-runtime seam is the right owner boundary rather than duplicating the classification in every plugin. This is also the identical seam already proposed in open fix(voice-call): survive gateway in-process restart and stop CLI dead-ends #125458 (voice-call) by the same author; carrying it verbatim here means whichever PR lands second is a no-op rebase on this contract, not a second independent decision. The +2 SDK surface-budget bump in scripts/plugin-sdk-surface-report.mts is the repo's own committed acceptance record for this addition.
  • Wait for exact-head CI to finish green before merging: satisfied — openclaw/ci-gate is SUCCESS on head ddf8a2671767ec60e00277db41e863c01d2d2b91 (the one CANCELLED "dispatch" check belongs to an earlier superseded run, not the attached run).

Proceeding to land.

…tead of message matching

Replaces the message-substring classifier in the Meet CLI's
gateway-unavailable local fallback with the structural
isGatewayTransportError/isGatewayClientRequestError guards (seam shared
verbatim with #125458). Decision surface chosen per Meet semantics:
uncoded transport closes (unreachable sockets, now incl. ETIMEDOUT/
ENETUNREACH) fall back; coded closes incl. 1006 deliberately do not,
since a live gateway may still own Meet browser sessions; unknown-method
fallback stays but requires a structural gateway request error. Adds
ECONNRESET to GATEWAY_UNREACHABLE_SOCKET_CODES so connect-time resets
wrap into the typed unreachable error instead of escaping raw.
@steipete
steipete force-pushed the steipete/beautiful-hopper-dceecf branch from ddf8a26 to 8bb262d Compare August 18, 2026 02:24
@openclaw-barnacle openclaw-barnacle Bot removed the scripts Repository scripts label Aug 18, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

CI fix included in this PR

Landing this PR uncovered an unrelated but real, CI-blocking bug: checks-node-compact-small-11 failed, then hung on two retries (19-25+ min vs. ~2.5 min normal) on src/process/supervisor/adapters/child.service-lifecycle.test.ts > "cancels the complete admitted command group before settling". Not caused by this PR's diff (zero file overlap: process/supervisor vs. gateway/plugin-sdk/google-meet), not a CI-capacity/runner-registration issue (actions_runner_registration was 0/10000 used at the time), and no in-flight PR/issue already covered it.

Root cause, confirmed via Docker repro of the CI environment: the production kill-tree logic is correct (child.ts, service-child-group-anchor.ts already signal the full process group and escalate properly). The test's own isAlive() helper uses process.kill(pid, 0), which succeeds for a zombie process too (POSIX: a terminated-but-unreaped PID still responds to signal-0). Under Docker on the CI runner, the test's backgrounded sleep descendant becomes a zombie once its parent shell exits, so isAlive(descendantPid) misreported true, failing the assertion — and on retry, the same zombie-state confusion produced repeated 5-second stall/retry cycles that compounded into the observed hangs.

Fix (commit 27932a8, test-only, +11/-1 LOC, zero production change): on Linux, isAlive() additionally reads /proc/<pid>/stat and treats state Z (zombie) as terminated. Non-Linux behavior (this test is skipped on Windows; local macOS dev) is unchanged.

Proof:

  • Docker pre-fix: reproduced the exact assertion failure (11 failed/8 passed in the full file, 117.6s).
  • Docker post-fix: 19/19 passed in 24.5s.
  • Local stress: 20/20 consecutive passes of the specific test.
  • node scripts/run-vitest.mjs src/process — 379 passed, 8 skipped (25 files passed, 1 skipped).
  • node scripts/check-changed.mjs — passed.
  • Fresh Codex autoreview on this commit alone (--mode commit) — clean, 0 findings, confidence 0.99.

@steipete

Copy link
Copy Markdown
Contributor Author

Addressing this review's rank-up moves before landing:

  • Confirm the typed-only fallback policy for existing Google Meet operators: accepted, explicitly. Current main's fallback matches on arbitrary error prose — ECONNREFUSED/ECONNRESET/EHOSTUNREACH/ENOTFOUND/"gateway not connected"/"unknown method: X" substrings — which means any error whose message happens to contain one of those tokens starts a second local Meet runtime, even when the Gateway actually answered (e.g. a GatewayClientRequestError whose message text happens to embed "gateway not connected" for unrelated reasons). That's the exact bug class this PR removes. Under the new typed-only policy: an operator only ever gets local fallback when (a) the Gateway is structurally unreachable (uncoded transport close) or (b) the Gateway answered but doesn't know the exact Meet method (structural request error, unknown method: <exact method>). Every other Gateway failure — including the plain-Error race arm and coded closes like 1006 — now surfaces the real error instead of silently starting a second local Chrome session. For Meet specifically this is a strict improvement, not just a narrowing: a false-positive fallback here means an operator ends up with two Meet browser sessions in the same call, actively worse than surfacing the error. I'm accepting this as the intended production behavior, not deferring it to a future decision.
  • Let the exact-head checks complete successfully: satisfied — openclaw/ci-gate is green on head 27932a80ad3e5566e6445525fdd6b2e36ce0b95d (confirmed via scripts/watch-pr-ci.mjs, terminal state GREEN).

Proceeding to land.

@steipete
steipete merged commit ebac731 into main Aug 18, 2026
212 checks passed
@steipete
steipete deleted the steipete/beautiful-hopper-dceecf branch August 18, 2026 03:40
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 18, 2026
…tead of message matching (openclaw#125495)

* fix(google-meet): classify gateway CLI fallback with typed guards instead of message matching

Replaces the message-substring classifier in the Meet CLI's
gateway-unavailable local fallback with the structural
isGatewayTransportError/isGatewayClientRequestError guards (seam shared
verbatim with openclaw#125458). Decision surface chosen per Meet semantics:
uncoded transport closes (unreachable sockets, now incl. ETIMEDOUT/
ENETUNREACH) fall back; coded closes incl. 1006 deliberately do not,
since a live gateway may still own Meet browser sessions; unknown-method
fallback stays but requires a structural gateway request error. Adds
ECONNRESET to GATEWAY_UNREACHABLE_SOCKET_CODES so connect-time resets
wrap into the typed unreachable error instead of escaping raw.

* test(process): treat Linux zombies as terminated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: google-meet 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.

1 participant