|
| 1 | +# Handoff Notes |
| 2 | + |
| 3 | +## Branch |
| 4 | + |
| 5 | +- Current branch: `feat/local-dev-workflow-optimization` |
| 6 | +- Branch pushed to: `origin/feat/local-dev-workflow-optimization` |
| 7 | +- Latest commit from before this session: `01bd29a` `refactor: clarify scripts dev module boundaries` |
| 8 | +- Workspace status at handoff: code changes for desktop/controller/scripts-dev integration plus this `TASK.md` update |
| 9 | + |
| 10 | +## What Changed In This Session |
| 11 | + |
| 12 | +### Desktop runtime ownership was split into `external | internal` |
| 13 | + |
| 14 | +- `apps/desktop/shared/runtime-config.ts` now exposes `runtimeMode: "external" | "internal"` |
| 15 | +- `apps/desktop/main/platforms/shared/runtime-common.ts` now has an external runtime adapter path |
| 16 | +- `apps/desktop/main/platforms/index.ts` selects an external adapter when desktop is launched in external mode |
| 17 | +- `apps/desktop/main/runtime/manifests.ts` marks `web`, `controller`, and `openclaw` runtime units as `external` when desktop is attaching instead of owning processes |
| 18 | +- `apps/desktop/main/runtime/daemon-supervisor.ts` now probes external runtime units by port and reports external availability state instead of trying to manage them |
| 19 | +- `apps/desktop/main/index.ts` logs the effective desktop runtime mode and the external runtime targets during cold start |
| 20 | + |
| 21 | +### Controller OpenClaw ownership was split into `external | internal` |
| 22 | + |
| 23 | +- `apps/controller/src/app/env.ts` now accepts: |
| 24 | + - `NEXU_CONTROLLER_OPENCLAW_MODE=external|internal` |
| 25 | + - `OPENCLAW_BASE_URL` |
| 26 | + - `OPENCLAW_LOG_DIR` |
| 27 | +- Legacy `RUNTIME_MANAGE_OPENCLAW_PROCESS` is now treated as a compatibility input; the effective owner is derived from the explicit mode when present |
| 28 | +- `apps/controller/src/runtime/gateway-client.ts`, `apps/controller/src/runtime/runtime-health.ts`, and `apps/controller/src/runtime/openclaw-ws-client.ts` now connect through `OPENCLAW_BASE_URL` instead of hard-coded `127.0.0.1:${port}` |
| 29 | +- `apps/controller/src/app/bootstrap.ts` now logs the runtime contract and only starts OpenClaw when controller is in `internal` mode |
| 30 | +- `apps/controller/src/services/model-provider-service.ts` and `apps/controller/src/services/desktop-local-service.ts` now skip runtime restarts when controller is attached to an external OpenClaw instance |
| 31 | +- `apps/controller/src/runtime/openclaw-process.ts` now exposes `managesProcess()` so ownership checks are explicit at call sites |
| 32 | + |
| 33 | +### `scripts/dev` now owns OpenClaw local-dev startup |
| 34 | + |
| 35 | +- Added `scripts/dev/src/shared/dev-runtime-config.ts` |
| 36 | + - reads `scripts/dev/.env` when present |
| 37 | + - defines the cross-service local-dev contract for ports, URLs, state dirs, config path, log dir, and gateway token |
| 38 | +- Added `scripts/dev/.env.example` as the source-of-truth example for dev-only external injection |
| 39 | +- Added `scripts/dev/src/services/openclaw.ts` |
| 40 | +- Added `scripts/dev/src/supervisors/openclaw.ts` |
| 41 | +- Updated `scripts/dev/src/index.ts` so `pnpm dev start|restart|stop|status|logs` now includes `openclaw` |
| 42 | +- Updated existing `scripts/dev` controller/web assembly to consume injected values from `scripts/dev/.env` instead of assuming only hard-coded defaults |
| 43 | + |
| 44 | +### Small controller-chain robustness fix |
| 45 | + |
| 46 | +- `apps/controller/src/runtime/openclaw-config-writer.ts` now derives a fallback state dir from `openclawConfigPath` when the full env shape is not present, which fixed the related config-writer regression in tests |
| 47 | + |
| 48 | +## Validation Already Done |
| 49 | + |
| 50 | +- `pnpm --filter @nexu/desktop typecheck` passed |
| 51 | +- `pnpm --filter @nexu/desktop build` passed earlier in the session after the desktop external-runtime split |
| 52 | +- `pnpm --filter @nexu/controller typecheck` passed |
| 53 | +- `pnpm --filter @nexu/controller build` passed |
| 54 | +- `pnpm --dir ./scripts/dev exec tsc --noEmit` passed |
| 55 | +- Root-entrypoint local-dev acceptance for the current three-service flow passed: |
| 56 | + - `pnpm dev status` |
| 57 | + - `pnpm dev start` |
| 58 | + - `pnpm dev status` |
| 59 | + - `pnpm dev logs openclaw` |
| 60 | + - `pnpm dev logs controller` |
| 61 | + - `pnpm dev restart` |
| 62 | + - `pnpm dev stop` |
| 63 | + - `pnpm dev status` |
| 64 | +- Verified controller now boots in `external` OpenClaw mode and successfully reaches `openclaw_ws_connected` through the `scripts/dev`-managed OpenClaw process |
| 65 | + |
| 66 | +## Important Current Behavior |
| 67 | + |
| 68 | +- OpenClaw local dev is now expected to be orchestrated by `scripts/dev`, not by its own dedicated `.env` |
| 69 | +- `scripts/dev/.env` is intended to become the single dev-only source of truth for cross-service injected runtime values |
| 70 | +- Controller local dev is already consuming OpenClaw through that external contract when launched via `scripts/dev` |
| 71 | +- Desktop code is prepared for the same external-runtime shape, but desktop is not yet wired into `scripts/dev` |
| 72 | + |
| 73 | +## Known Existing Issues |
| 74 | + |
| 75 | +- `pnpm lint` still fails due to pre-existing repo-wide Biome formatting issues unrelated to this branch |
| 76 | +- `pnpm --filter @nexu/controller test` still has pre-existing failures not introduced by this session: |
| 77 | + - `tests/nexu-config-store.test.ts` |
| 78 | + - `tests/openclaw-sync.test.ts` |
| 79 | + - `tests/openclaw-runtime-plugin-writer.test.ts` (Windows symlink permission issue) |
| 80 | +- Desktop is not yet started/stopped through `scripts/dev`; only `openclaw + controller + web` are wired today |
| 81 | + |
| 82 | +## Suggested Next Steps |
| 83 | + |
| 84 | +1. Wire `desktop` into `scripts/dev` using the same `scripts/dev/.env` contract and `NEXU_DESKTOP_RUNTIME_MODE=external` |
| 85 | +2. Decide whether to expand `pnpm dev` into explicit single-service targeting like `pnpm dev start openclaw` / `pnpm dev stop controller` |
| 86 | +3. Continue tightening the `scripts/dev/.env` contract so every external injection is documented, named consistently, and traced to a single owner |
0 commit comments