Skip to content

AlphaClaw macOS Compatibility, building on pr-4-macos - #63

Open
diazMelgarejo wants to merge 456 commits into
chrysb:pr-4-macosfrom
diazMelgarejo:pr-4-macos
Open

AlphaClaw macOS Compatibility, building on pr-4-macos#63
diazMelgarejo wants to merge 456 commits into
chrysb:pr-4-macosfrom
diazMelgarejo:pr-4-macos

Conversation

@diazMelgarejo

@diazMelgarejo diazMelgarejo commented Apr 13, 2026

Copy link
Copy Markdown

Summary

  • macOS bin-path routing: Extracts getBinPath() into lib/platform.js — darwin routes to ~/.local/bin (user-writable, no sudo), Linux keeps /usr/local/bin with managed fallback.
  • Read-only onboarding: New readOnlyMode flow attaches AlphaClaw to an existing local OpenClaw setup without modifying any config files, writing git state, or touching the gateway proxy config.
  • sanitizeOpenclawConfig: Ensures every provider in openclaw.json has models: [], preventing the OpenClaw gateway JSON-schema crash that causes a 30s startup timeout.
  • Rebase on 0.9.3: Merges upstream/main — preserves all new route structure, SSE /api/events/status, buildStatusPayload() refactor, and bundler-style frontend imports while keeping the read-only onboarding invariants.
  • Test fixes (merge conflict residue): getSystemCronStatus missing deps arg, duplicate ensureGatewayProxyConfig outside read-only guard, ensureManagedExecDefaults modifying config in read-only mode, and api.test.js body expectation missing readOnlyMode.

Test plan

  • All 538 tests pass: npx vitest run
  • getBinPath() unit tests: 4 passing
  • sanitizeOpenclawConfig() unit tests: 7 passing
  • Read-only onboarding: passes without writing openclaw.json
  • macOS: alphaclaw start installs binary to ~/.local/bin without sudo
  • macOS: { readOnlyMode: true } to /api/onboard completes without rewriting existing config

Branch pr-4-macos (pushed from diazMelgarejo/AlphaClaw)

Commit Change
ad2325f Merge upstream/main (0.9.3) into pr-4-macos: 9 conflicts resolved, read-only onboarding preserved
3bbf43d fix(macos): lib/platform.js with getBinPath(), 4 tests
3d99697 fix(platform): code review fixes — fs top-level, homedir arrow fn, import kSystemBinDir, Linux prependPathEntry
4d04616 fix(gateway): sanitizeOpenclawConfig() in openclaw-config.js, 5 tests, wired into bin/alphaclaw.js
61c8284 fix(gateway): harden against null providers, array-typed providers, revert let cfg — 7 tests total

Full suite: 535 passed, 3 failures (after merging main to pr-4-macos)


Fixed: post main -> pr-4-macos

Failure Root cause Fix
routes-system.test.js — "reports running gateway status" getSystemCronStatus() called with no args at line 501; needs deps {fs, openclawDir, platform} Changed to readSystemCronConfig() (the local wrapper that captures deps)
routes-onboarding.test.js — "supports read-only onboarding" Two issues from merge: (1) duplicate ensureGatewayProxyConfig call outside the !readOnly guard; (2) ensureManagedExecDefaults (added by upstream) runs unconditionally and writes to openclaw.json Removed the duplicate call; guarded ensureManagedExecDefaults behind !validatedReadOnlyMode
tests/frontend/api.test.js — "runOnboard sends vars and modelKey" Test expected old body without readOnlyMode; our PR added readOnlyMode to the payload Updated expected body to include readOnlyMode: false

All 3 failures were merge conflict residue — the fixes preserve the correct invariant that read-only onboarding must not write to openclaw.json or call ensureGatewayProxyConfig.

chrysb and others added 30 commits March 11, 2026 13:48
fix: isolate onboarding auth from stale env vars
Let users continue to the dashboard when channel pairing is blocked or deferred, so setup does not get stuck waiting on a pairing request.
…ns and richer tool guidance.

This adds URL-sticky tools tab behavior, robust tools config persistence/reset handling, and contextual tooltips so advanced capabilities are easier to understand.
Introduces the cron tab with a resizable job list sidebar, job detail view
(metadata, prompt editor, usage stats, run history), and an overview page
with optimization warnings. Includes server-side cron service, API routes,
usage DB support, and tests. Fixes missing formatLocaleDateTimeWithTodayTime
import in job detail and clears stale run entries on job switch.
Adds full Slack channel support across AlphaClaw — onboarding wizard,
channel dashboard, pairings, gateway sync, watchdog notifications,
and the channel creation modal.

Slack uses Socket Mode which requires two tokens (Bot Token + App Token)
rather than one. This is handled via a new `extraEnvKeys` property on
channel definitions and dual-token logic in the gateway sync and
onboarding flows.

Changes:
- Add Slack to channel definitions, env keys, and known vars
- Add Slack Bot Token and App Token fields to onboarding wizard
- Wire Slack into openclaw.json generation (fresh + import flows)
- Handle dual-token channel sync in gateway (--bot-token / --app-token)
- Use Object.keys(kChannelDefs) instead of hardcoded channel arrays
- Add Slack to channel dashboard, pairings UI, and pairing routes
- Add App Token field to create-channel modal (Slack is single-account)
- Add watchdog crash notifications via Slack DM
- Add slack-api.js (minimal Web API wrapper matching existing patterns)
- Add Slack SVG icon
- Update agents-service test for Slack channel account

Ref: chrysb#8

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Introduces a rolling cron schedule calendar with usage-aware tiers, status-aware tooltips, job navigation, and repeating-job grouping, plus bulk cron usage/runs endpoints to power the view efficiently. Also adds vertical resizing with persisted heights for cron prompt and watchdog logs, and refines calendar layout/behavior for performance and usability.
This update reduces cognitive load in the all-jobs experience while adding richer scheduling, warning, and run-trend interactions that map directly into run history filtering.
This switches pricing resolution to a stable map-first flow with node_modules fallback, updates usage/cron consumers to reuse the shared resolver, and trims redundant trend subtitle text in the cron overview UI.
Count distinct run ids in usage aggregation so average tokens/cost per run are computed against real cron runs, and refresh trend visuals with brighter neon segment styling.
Use slot-aware run details for past entries, 7-day projected averages for upcoming entries, and drive token intensity colors from actual/predicted per-slot usage to match calendar context.
This updates cron run metadata presentation, swaps and spaces key actions, moves usage range controls to SegmentedControl, and removes unsupported --json flags from cron enable/disable/edit commands while adding focused coverage.
This consolidates run history rendering into a shared component, simplifies delivery/session routing controls, and aligns cron command usage with current CLI support while keeping save behavior consistent through a single Save changes action.
Use latest-run heartbeat/status context to avoid false not-delivered warnings while preserving actionable cron optimization alerts.
Close Slack channel setup gaps by persisting app tokens in edit/manage flows, hiding managed Slack tokens from Envars, and enforcing single-account rules consistently in UI and server logic. Align channel add UX across views by reusing one add-menu codepath and tighten setup guidance copy.
feat: add cron dashboard tab
fix: add skip option on onboarding pairing step
Make the onboarding Channels group easier to scan by grouping Telegram, Discord, and Slack into logo-backed accordion sections with a shared caret affordance and default-expanded Telegram details.
Center the cron layout, replace the persistent job sidebar with a selector, add trend/insight improvements, and split cron detail into focused components while sharing editor line-sync behavior with the file viewer for consistent wrapped-line numbering.
Capture the rest of the current working tree changes so the beta release reflects all in-progress updates in this branch.
Introduce a reusable PaneShell component and ac-fixed-header-pane CSS
for pages that need a pinned header with a separately scrollable body.
Apply the pattern to envars, models, and agents tabs so save/cancel
actions stay visible while content scrolls.

Other changes in this batch:
- Add PopActions (animated save/cancel) to envars and models headers
- Fix models isDirty state not clearing when auth tokens are reverted
- Add agent overview tools card with profile summary and navigation
- Move watchdog to bottom of monitoring sidebar section
- Reserve PopActions height with visibility:hidden to prevent layout shift
@diazMelgarejo

Copy link
Copy Markdown
Author

No open test gaps remain from the original checklist.

a05cbe9 — fix: return contract

-   return status.installed || (status.platform === "darwin" && status.enabled);
+   const finalStatus = getSystemCronStatus({ fs, openclawDir, platform });
+   return finalStatus.installed;

startManagedScheduler() sets kSchedulerState.active synchronously, so the re-read sees the correct runtime state immediately. getSystemCronStatus was already imported; one import line added for it.

7641a7f — test: Linux install path

Calls installHourlyGitSyncCron() with platform: "linux", then asserts kSystemCronPath exists in the memory-fs, contains the default schedule string, and getSystemCronStatus() returns { installed: true, installMethod: "system_cron" }.

a7bd4b2 — test: darwin disable → re-enable

Three phases against the same memory-fs:

  1. Install → installed: true
  2. stopManagedScheduler() → installed: false
  3. Re-install → installed: true again

4cba0d8 — test: return value semantics

Asserts result === getSystemCronStatus().installed for both darwin and linux. If the broadened installed || (darwin && enabled) expression ever comes back, these tests break as soon as enabled is true but installed is still false.

chrysb and others added 13 commits April 16, 2026 08:02
…se (chrysb#68)

Templates that omit a direct openclaw pin should still resolve OpenClaw from the same AlphaClaw version the template pins. This change reuses the template-pinned version when reading registry metadata and adds a regression for the mismatch case.

Constraint: Managed templates now intentionally pin only @chrysb/alphaclaw
Rejected: Continue resolving dist-tags.latest for template fallbacks | mixes template-pinned AlphaClaw with unrelated OpenClaw metadata
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep template fallback metadata tied to the same pinned AlphaClaw version unless template semantics change again
Tested: node --check lib/server/alphaclaw-version.js; node --check tests/server/alphaclaw-version.test.js; direct mocked fetch validation for fallback/latest/direct-pin cases
Not-tested: Full Vitest run in this local environment (Vite/esbuild spawn error -88 during config startup)
Add WhatsApp channel support and QR login flow parity
@chrysb

chrysb commented Apr 18, 2026

Copy link
Copy Markdown
Owner

Thank you! I will inspect this over the weekend.

diazMelgarejo and others added 4 commits April 18, 2026 21:52
…guards

Absorbs upstream commits 0b92623→f98d4c0 (v0.9.5–v0.9.9):
- gogcli HOME compat: HOME/OPENCLAW_HOME now set to kRootDir in gatewayEnv
  and onboard shellCmd env (commits 9dcd41e, 396bd78)
- SQLite handle-close fix: explicit close() in db module tests to fix
  WAL-lock flakiness — the root-cause fix that replaced our singleFork PR
  (commit f98d4c0)
- Package updates: openclaw patch refresh, package-lock bump

Conflict resolution:
- lib/server/gateway.js: accepted HOME/kRootDir addition; added kRootDir
  to constants import
- lib/server/onboarding/index.js: accepted HOME/kRootDir addition; added
  kRootDir to constants import; all 16 !validatedReadOnlyMode guard sites
  preserved — upstream's removal of read-only logic was NOT accepted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After upstream commit 9dcd41e (gogcli HOME compat), gatewayEnv() and the
onboard shellCmd env now set HOME=kRootDir and OPENCLAW_HOME=kRootDir,
with OPENCLAW_STATE_DIR carrying the old OPENCLAW_DIR value.

Update two tests that still expected the pre-refactor layout:
- gateway.test.js: add HOME/OPENCLAW_STATE_DIR to launch env assertion
- routes-onboarding.test.js: switch toEqual→toMatchObject, replace
  OPENCLAW_HOME with HOME+OPENCLAW_STATE_DIR expectations

All 575 tests and 29 watchdog tests now pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rkers

Root cause (two layers):
1. routes-browse.test.js + routes-models.test.js called mkdtempSync per test
   but never cleaned up. 30+ leaked dirs/run add I/O overhead on macOS
   /var/folders/ (memory-mapped filesystem).
2. db-layer parallel workers (doctor, watchdog, webhooks) leave DatabaseSync
   .db-shm pages mmap'd. Under 60+ workers on ARM64, OS memory pressure slows
   ALL workers — including pure-mock routes tests — past the 5s timeout.

Fix:
- routes-browse.test.js: track created dirs in createdTestRoots[]; afterEach
  splices and rmSync({recursive,force}) each entry
- routes-models.test.js: same pattern for createApp() temp dirs (createdTempRoots)
- vitest.config.js: testTimeout 5000 → 10000ms; gives pure-mock workers breathing
  room while db-layer .db-shm pressure fix propagates (doctor/watchdog/webhooks-db
  still need afterEach closeXyzDb() — tracked as remaining upstream work)

Verified: npm run test:coverage passes 594/594 sequentially.
Target: npm test 594/594 (was 584/594 before this fix).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
E.1 — package.json: add @esbuild/darwin-arm64 + @esbuild/darwin-x64 0.25.x as
      optionalDependencies so ARM64 Macs pick up the correct native binary without
      requiring manual postinstall.

E.2 — bin/alphaclaw.js: print darwin-specific npm prefix advisory on `alphaclaw start`
      (guides users to set prefix=$HOME/.local to avoid sudo-required installs).

E.3 — bin/alphaclaw.js + lib/scripts/macos-hourly-sync.plist.template: on darwin,
      write a LaunchAgent plist to ~/Library/LaunchAgents/ instead of /etc/cron.d
      (which requires root and does not exist on macOS).

E.5 — .github/workflows/ci.yml: extend CI matrix to include macos-latest alongside
      ubuntu-latest; add watchdog suite and coverage steps so macOS-specific failures
      are caught before merge.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants