Skip to content

Promote v3.1.10 gateway recovery to main - #264

Merged
yalexx merged 3 commits into
mainfrom
beta
Jul 22, 2026
Merged

yalexx merged 3 commits into
mainfrom
beta

Conversation

@yalexx

@yalexx yalexx commented Jul 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • promote the tested beta candidate for v3.1.10 to main
  • includes gateway health verification after updates and conservative legacy OpenClaw state recovery

Beta validation

Safety

  • this PR exists only to promote beta to main after beta checks
  • no direct push to main
  • recovery moves known legacy blocker files to timestamped quarantine directories instead of deleting them

Summary by CodeRabbit

  • New Features

    • Added gateway health verification after updates, including connectivity checks and automated recovery/repair.
    • Added legacy gateway-state quarantine and retry logic to improve post-update startup reliability.
    • Added legacy Codex OAuth config migration (remapping stored model identifiers) during gateway pre-start.
  • Bug Fixes

    • Improve recovery when the gateway is not reachable after an update, with additional journal/log-based validation.
  • Tests

    • Updated updater unit tests to mock port probing.
  • Chores

    • Bumped the application version to 3.1.10.

@yalexx
yalexx requested a review from a team as a code owner July 20, 2026 13:56
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 44 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: ef6607c9-c8a7-4173-b61f-5d6ee43912bf

📥 Commits

Reviewing files that changed from the base of the PR and between 120fcd3 and c7beb31.

📒 Files selected for processing (4)
  • public/sw.js
  • src/app/globals.css
  • src/app/page.tsx
  • src/components/ChatPopup.tsx
📝 Walkthrough

Walkthrough

Changes

Gateway health recovery

Layer / File(s) Summary
Installer post-update recovery
install.sh
Post-update processing probes the gateway, runs repair and restart actions when needed, quarantines matching legacy state, and logs recovery failures without aborting the flow.
Updater health flow and validation
src/lib/updater.ts, src/tests/unit/updater.test.ts, package.json
Updater pipelines use gateway health recovery and port probing, tests mock successful probes, and the package version changes to 3.1.10.

Codex configuration migration

Layer / File(s) Summary
Codex OAuth model migration
scripts/gateway-pre-start.sh
Pre-start configuration migration rewrites supported openai/<gpt> primary and fallback model identifiers to codex/<gpt> when Codex OAuth is present without OpenAI credentials.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Updater
  participant GatewayHealth
  participant PortProbe
  participant OpenClaw
  participant Journal
  participant LegacyState

  Updater->>GatewayHealth: Validate gateway health
  GatewayHealth->>OpenClaw: Restart and run doctor --fix
  GatewayHealth->>PortProbe: Probe configured port
  PortProbe-->>GatewayHealth: Return listening status
  GatewayHealth->>Journal: Read recent gateway logs
  Journal-->>GatewayHealth: Return blocker patterns
  GatewayHealth->>LegacyState: Quarantine legacy state
  GatewayHealth->>PortProbe: Retry gateway probe
  PortProbe-->>Updater: Return final health result
Loading

Possibly related PRs

Suggested reviewers: krasimirkralev

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: promoting v3.1.10 with gateway recovery improvements to main.
Description check ✅ Passed The description covers the summary, validation, and safety, but it omits several template sections like type of change and testing details.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch beta

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

🦀 ClawReview

Claws waving — here's what this change is about.

Promotes the v3.1.10 beta candidate to main after CI passed on the beta branch. The core addition is gateway health verification in the update flow: after an update, ClawBox now waits for the gateway port, attempts openclaw doctor --fix, and — if journal logs match known legacy-state patterns — quarantines blocking files to a timestamped directory before retrying. The release also includes a Codex OAuth model-id migration in gateway-pre-start.sh, chat popup animation and layout polish, and a service worker cache bump.

At a glance

  • 🔧 Fix · touches updater auto-update flow, gateway-pre-start.sh, install.sh post-update recovery, ChatPopup UI
  • Base branch: main · +301 source / +7 tests across 10 files
  • ✅ release promotion betamain — feature-PR conventions exempt
  • ℹ️ touches security-sensitive paths (install.sh, scripts/gateway-pre-start.sh) — review with extra care

Good to know

  • 🟡 The new gateway_verify step has failFast: true — if the gateway doesn't recover, the update itself will fail rather than silently leave the device in a degraded state.
  • ℹ️ Service worker cache name bumped from clawbox-v3 to clawbox-v4; existing installs will get a full cache bust on their next page load.
  • 🟡 Quarantine directories (openclaw-legacy-quarantine-<timestamp>/) are created in $CLAWBOX_HOME on affected devices and are never auto-cleaned — worth knowing for disk-space monitoring on long-lived Jetsons.
  • ℹ️ PR Add gateway recovery test coverage #265 (open) adds further test coverage for this gateway recovery path — it's a companion to this change.

— ClawReview 🦀, your resident reef crab. Just orientation — CodeRabbit does the line-by-line, humans do the merge. Conventions: docs.

@github-actions github-actions Bot added area: install Auto-triage area area: gateway Auto-triage area labels Jul 20, 2026
@github-actions

github-actions Bot commented Jul 20, 2026

Copy link
Copy Markdown

CI Summary

✅ Tests

  • Result: passed
  • View run
  • Coverage: statements 69.77%, branches 59.68%, functions 65.16%, lines 71.79%

✅ E2E

✅ E2E Install

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tests/unit/updater.test.ts`:
- Line 141: The updater tests only cover the healthy gateway path because
mockIsPortOpen always resolves true. Add tests configuring mockIsPortOpen to
resolve false, including journal output matching LEGACY_GATEWAY_BLOCKER_RE where
needed, and assert the recovery behavior through quarantineLegacyOpenclawState
plus the throw-on-still-offline failure path in ensureGatewayHealthy.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: c00ba84b-644c-4130-8688-bdab50ef24e4

📥 Commits

Reviewing files that changed from the base of the PR and between 49ab98c and 22fa9ba.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • install.sh
  • package.json
  • src/lib/updater.ts
  • src/tests/unit/updater.test.ts

Comment thread src/tests/unit/updater.test.ts
…266)

ChatGPT-subscription boxes (Codex OAuth, no OpenAI API key) that stored
their active model or a fallback as `openai/gpt-5.5` (etc.) before the setup
UI routed ChatGPT picks through Codex hit `401 Missing bearer or basic
authentication in header` on api.openai.com/v1/responses — often only as a
FailoverError days into use, once the OAuth token first refreshes and the
failover chain reaches the keyless `openai/*` fallback.

The chat-model pick route already rewrites openai/<gpt> -> codex/<gpt>, but
only when the user re-picks the model; existing configs never re-pick, so an
updated box stays broken until manually re-selected. Migrate primary +
fallbacks in gateway-pre-start.sh on gateway start, guarded on "codex OAuth
present AND no OpenAI API key" so keyed / dual-auth boxes (where openai/* is a
valid route) are left untouched. Mirrors CODEX_SUPPORTED_MODEL_RE /
hasOpenAiApiKeyProfile / hasCodexOauthProfile in
src/app/setup-api/chat/model/route.ts.

Verified against 6 fixtures: openai->codex primary+fallback migrate; keyed
box untouched; non-supported (gpt-4o) primary left as-is; already-codex no-op;
no-codex-auth untouched; composes with the retired-Sonnet migration. bash -n
and py_compile pass.

Co-authored-by: Mike (IDRobots) <mike@idrobots.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/gateway-pre-start.sh`:
- Around line 173-196: Update _auth_profiles and the checks in
_has_openai_api_key_profile and _has_codex_oauth_profile to preserve and inspect
each auth profile’s key alongside its value. Ensure keyed entries such as
"codex:default" are recognized during migration even when their profile value
lacks an explicit provider or mode, while retaining the existing provider/mode
checks for unkeyed or fully specified profiles.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6eda82a5-9ddc-4172-989e-c196cb8eec0f

📥 Commits

Reviewing files that changed from the base of the PR and between 22fa9ba and 120fcd3.

📒 Files selected for processing (1)
  • scripts/gateway-pre-start.sh

Comment thread scripts/gateway-pre-start.sh
… narrow chat) (#267)

* fix: chat header pills squeeze + truncate cleanly on narrow panels

On a narrow chat the provider / model / thinking selector pills overlapped
into an unreadable strip. Two parts:

1. .header-dropdown-trigger gets width:100% so the button fills its
   flex-shrinking .header-dropdown parent. Previously the button kept its
   content width and spilled past the shrunk parent, so overflow:hidden on
   .chat-header-pills clipped / overlapped the pills instead of the labels
   truncating. Now every pill gives ground evenly and its label ellipsizes
   (the chevron stays — it's reserved in the 24px right padding).

2. Single row (no wrap) + overflow:hidden, and the chat window clamps to
   MIN_CHAT_WIDTH (340px) on both resize paths + the rendered width, so the
   window stops shrinking once the pills reach a readable minimum instead of
   smashing them.

The open menu is portaled to <body> (HeaderDropdown), so clipping the row
can't hide it. Verified at 320-420px: even truncation, carets visible, zero
overlap.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: open chat from mascot with a macOS-style animation, no corner flash

- Stop streaming the frozen mascot's position into mascotX while the chat is
  open (page.tsx). That nudged mascotX for a frame right after opening, so the
  popup flashed to the wrong corner before settling. mascotX is now captured
  once from the tap.
- Grow the popup OUT of the mascot: transform-origin pinned to the popup's
  bottom edge, aligned horizontally with the mascot, and scale 0.82 -> 1 on an
  easeOutExpo curve (cubic-bezier(0.16,1,0.3,1)) over 0.36s. Smooth, premium,
  emanates from where you tapped instead of scaling from the popup centre.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* chore: bump SW cache clawbox-v3 -> v4 to invalidate stale assets on the 3.1.10 chat-UI changes

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix: keep chat popup header on-screen on short/zoomed viewports

The un-dragged popup anchors from the bottom (bottom:170 above the mascot,
bottom:65 in tray mode) but its maxHeight budget was a flat 100vh-60px, so on
viewports shorter than ~680px (small windows, browser zoom) a 500px-tall popup
shoved its whole header — pills, status dot, close button — off the TOP of the
screen (rect.y = -76 measured on a 594px viewport). Subtract the bottom anchor
from the height budget per mode (+12px top margin) so the header is always
visible and the popup just gets shorter instead.

Found by driving the real desktop over CDP and sampling the popup rect during
open; the same probe confirmed the mascot-open animation runs and there is no
left-corner flash.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Mike (IDRobots) <mike@idrobots.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the area: ui Auto-triage area label Jul 22, 2026
@yalexx
yalexx merged commit 280ed5e into main Jul 22, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: gateway Auto-triage area area: install Auto-triage area area: ui Auto-triage area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant