Skip to content

fix(macos): recover onboarding and prove packaged bootstrap - #119850

Closed
Patrick-Erichsen wants to merge 3 commits into
mainfrom
pe/macos-bootstrap-e2e
Closed

Patrick-Erichsen wants to merge 3 commits into
mainfrom
pe/macos-bootstrap-e2e

Conversation

@Patrick-Erichsen

@Patrick-Erichsen Patrick-Erichsen commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #120050
Related: #119759
Related: #119770
Follow-up to #119831 and #121012

What Problem This Solves

#121012 fixed the confirmed short first-run timeout, but macOS onboarding could still report the wrong result after delayed Gateway startup:

  • a successful CLI install could be shown as failed when only Gateway readiness failed;
  • concurrent readiness waiters could disagree after one had already published success;
  • a timed-out readiness probe could keep reusing an older in-flight connection;
  • CI did not launch the packaged macOS app through the real first-launch path.

The migration-lease conflict reported in #120050 was observed, but its causal role is still unproven. This change fixes the lifecycle/readiness failures without adding lease-specific policy to the app.

Why This Change Was Made

  • Tracks CLI executable installation separately from Gateway activation/readiness.
  • Accepts same-generation readiness already published by a sibling waiter.
  • Gives each bounded readiness probe an isolated connection and keeps cleanup outside the deadline.
  • Isolates debug Keychain services by bundle identity so packaged test variants cannot interfere.
  • Adds DEBUG-only consent/onboarding hooks for unattended native CI; release builds keep the normal approval flow.
  • Adds a packaged macOS E2E that builds the exact-head CLI and app, launches through LaunchServices, validates incompatible-CLI rejection, validates launchd plus Gateway RPC, delays the real Gateway past the old 12-second window, and requires onboarding to recover.
  • Adds the packaged E2E to openclaw/ci-gate and routes changes to its complete harness dependency graph onto macOS CI.

User Impact

A completed CLI install remains visibly successful if the later Gateway step fails. Delayed Gateway startup can recover to the correct success state, including when multiple readiness checks overlap. The packaged first-launch path is now guarded in CI.

Evidence

Reproduction Boundary

The E2E deterministically reproduces delayed first-launch readiness by holding the installed launchd Gateway beyond the former onboarding timeout, then releasing it and requiring the UI lifecycle to recover. It does not fabricate a migration-lease conflict because the issue does not yet prove that conflict caused the stale UI state.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L maintainer Maintainer-authored PR labels Aug 6, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. labels Aug 6, 2026
@openclaw-barnacle openclaw-barnacle Bot added the app: macos App: macos label Aug 6, 2026
@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. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 6, 2026
@clawsweeper

clawsweeper Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 21, 2026, 5:40 AM ET / 09:40 UTC.

ClawSweeper review

What this changes

The PR separates macOS CLI-install and Gateway-readiness outcomes, adjusts readiness recovery, and adds packaged macOS bootstrap CI coverage.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⛔ Blocked by patch quality or review findings - 7 items remain

Keep open, but block merge: the branch drops current main’s profile-scoped Keychain identity, mixing credentials and activation bindings between named macOS profiles. It also needs a rebase because GitHub reports a dirty merge state.

Priority: P1
Reviewed head: 0dfd1430130bf07d1849ad4152b3a165a2819e4f

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch has useful lifecycle coverage but remains blocked by a P1 profile-isolation regression and a dirty merge state.
Proof confidence 🌊 off-meta tidepool Not applicable: The item metadata identifies a member author, so the external-contributor proof gate does not apply; exact-head native CI is still required for this risky macOS change.
Patch quality 🦪 silver shellfish (2/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The item metadata identifies a member author, so the external-contributor proof gate does not apply; exact-head native CI is still required for this risky macOS change.
Evidence reviewed 6 items Profile isolation contract: Current main defines a profile suffix and requires Keychain identity to follow the active profile.
Current main consumers: Both Gateway profile credentials and activation binding compose their service name through the active profile.
Proposed regression: The branch replaces the profile-aware service with a static bundle-only service; the corresponding activation-binding store does the same.
Findings 1 actionable finding [P1] Preserve the named-profile Keychain namespace
Security Needs attention Keep Keychain state isolated by named profile: The patch makes all named profiles use one service name, allowing profile credentials and activation binding state to be reused across profile boundaries.

How this fits together

macOS onboarding installs a local CLI, starts the Gateway LaunchAgent, and reflects the resulting readiness state in the setup UI. Named profiles isolate Gateway credentials and activation binding through profile-specific Keychain service names.

flowchart LR
A[macOS onboarding] --> B[CLI installation]
B --> C[Gateway startup]
C --> D[Readiness owner]
D --> E[Setup UI]
F[Named app profile] --> G[Profile Keychain service]
G --> C
H[Packaged macOS CI] --> A
Loading

Before merge

  • Preserve the named-profile Keychain namespace (P1) - Current main applies AppProfile.current.keychainService to both this store and the activation-binding store. These static replacements collapse all named profiles, including release builds, onto one credential and binding namespace; retain the profile suffix after bundle isolation. This is the unchanged P1 from the prior review.
  • Resolve security concern: Keep Keychain state isolated by named profile - The patch makes all named profiles use one service name, allowing profile credentials and activation binding state to be reused across profile boundaries.
  • Resolve merge risk (P1) - Merging after a superficial conflict resolution could remove current named-profile credential and activation-binding isolation.
  • Resolve merge risk (P1) - The branch changes CI gating and its current required CI gate is failing; exact-head native bootstrap coverage must pass after rebase.
  • Complete next step (P2) - The protected maintainer label, P1 Keychain regression, and dirty merge state require normal contributor repair and maintainer review.
  • Improve patch quality - Restore profile-scoped Keychain services in both affected stores and add named-profile coverage.
  • Improve patch quality - Rebase onto current main and obtain green exact-head macOS bootstrap CI.

Findings

  • [P1] Preserve the named-profile Keychain namespace — apps/macos/Sources/OpenClaw/MacGatewayProfiles.swift:61-65
  • [medium] Keep Keychain state isolated by named profile — apps/macos/Sources/OpenClaw/MacGatewayProfiles.swift:61
Agent review details

Security

Needs attention: The Keychain namespace change weakens the existing named-profile credential and activation-binding isolation boundary.

PR surface

Tests +265, Config +34, Other +1225. Total +1524 across 24 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 4 279 14 +265
Docs 0 0 0 0
Config 1 34 0 +34
Generated 0 0 0 0
Other 19 1327 102 +1225
Total 24 1640 116 +1524

Review metrics

Metric Value Why it matters
Production versus test delta production +1,139/-59; tests +460/-16; generated metadata +41/-41 Most production growth is the packaged-bootstrap harness, so its exact-head native execution matters before merge.

Stored data model

Persistent data-model change detected: serialized state: scripts/e2e/macos-app-bootstrap-ci.ts, serialized state: test/scripts/install-cli.test.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Rebase and preserve profile isolation (recommended)
    Restore profile-scoped Keychain services in both stores, add named-profile coverage, then rebase the lifecycle work and require a green exact-head macOS bootstrap run.
  2. Pause the stale branch
    Pause this branch if its lifecycle changes cannot be cleanly reconciled with current main’s consolidated readiness owner.

Technical review

Best possible solution:

Rebase onto current main, retain the active-profile suffix after applying DEBUG bundle isolation in both Keychain stores, then reapply only lifecycle changes still needed by the current readiness owner and prove the exact head on macOS.

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

Yes: run two named profiles in one app bundle; current main gives them distinct Keychain services, while this branch resolves both to the same service.

Is this the best way to solve the issue?

No: bundle isolation is useful, but it must compose with current main’s profile suffix rather than replace it.

Full review comments:

  • [P1] Preserve the named-profile Keychain namespace — apps/macos/Sources/OpenClaw/MacGatewayProfiles.swift:61-65
    Current main applies AppProfile.current.keychainService to both this store and the activation-binding store. These static replacements collapse all named profiles, including release builds, onto one credential and binding namespace; retain the profile suffix after bundle isolation. This is the unchanged P1 from the prior review.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.99

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The patch can make named macOS profiles share credential and activation-binding state.
  • merge-risk: 🚨 compatibility: It removes profile-specific Keychain service names established on current main.
  • merge-risk: 🚨 auth-provider: Gateway profile credentials are stored in the affected Keychain service.
  • merge-risk: 🚨 security-boundary: The active profile is an isolation boundary for credentials and activation binding, which this branch collapses.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🌊 off-meta tidepool and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: The item metadata identifies a member author, so the external-contributor proof gate does not apply; exact-head native CI is still required for this risky macOS change.

Evidence

Security concerns:

  • [medium] Keep Keychain state isolated by named profile — apps/macos/Sources/OpenClaw/MacGatewayProfiles.swift:61
    The patch makes all named profiles use one service name, allowing profile credentials and activation binding state to be reused across profile boundaries.
    Confidence: 0.98

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • chelsealong: 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.

History

Review history (14 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-07T05:37:31.670Z sha fff89af :: found issues before merge. :: [P1] Accept a sibling-published readiness success
  • reviewed 2026-08-07T17:54:11.951Z sha 5e13a00 :: found issues before merge. :: [P1] Accept the sibling-published readiness success | [P1] Build app assets before the bootstrap job | [P3] Remove issue-specific debug markers from production logs
  • reviewed 2026-08-07T23:52:58.339Z sha 80e80d2 :: needs changes before merge. :: [P1] Accept a sibling-published readiness success | [P1] Route all bootstrap dependencies into the macOS lane
  • reviewed 2026-08-08T15:48:22.002Z sha e166235 :: needs changes before merge. :: [P1] Accept the sibling-published readiness result | [P1] Select the registry server for macOS bootstrap
  • reviewed 2026-08-08T20:51:49.807Z sha 33bb1bf :: needs changes before merge. :: [P1] Accept sibling-published readiness success | [P1] Route every bootstrap harness dependency
  • reviewed 2026-08-09T21:55:32.668Z sha 0dfd143 :: found issues before merge. :: [P1] Preserve the named-profile Keychain namespace
  • reviewed 2026-08-14T19:28:24.313Z sha 0dfd143 :: found issues before merge. :: [P1] Preserve the named-profile Keychain namespace
  • reviewed 2026-08-15T23:33:14.090Z sha 0dfd143 :: found issues before merge. :: [P1] Preserve the named-profile Keychain namespace

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed 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. labels Aug 7, 2026
@Patrick-Erichsen Patrick-Erichsen self-assigned this Aug 7, 2026
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Aug 7, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. P1 High-priority user-facing bug, regression, or broken workflow. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. P2 Normal backlog priority with limited blast radius. labels Aug 7, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 9, 2026
@openclaw-barnacle openclaw-barnacle Bot removed the docs Improvements or additions to documentation label Aug 9, 2026
@clawsweeper clawsweeper Bot removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 9, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. 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. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Aug 9, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. and removed merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 21, 2026
@VACInc

VACInc commented Sep 1, 2026

Copy link
Copy Markdown
Member

Closing this as superseded by the focused repairs that landed after this branch was prepared.

#119831 and #121012 addressed the earlier onboarding/readiness pieces. #128350 then explicitly extracted the remaining checklist-state repair from this PR, proved the packaged macOS behavior, landed as cfa802d73e54, and closed #120050.

This 24-file branch is now conflict-stale and its latest reviewed head also regresses named-profile Keychain isolation. It is no longer the canonical path for the reported onboarding defect. Thanks @Patrick-Erichsen for the investigation and proof work.

@VACInc VACInc closed this Sep 1, 2026
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 merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XL 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.

[Bug]: macOS onboarding reports Gateway-start failure although the local Gateway becomes healthy

2 participants