Skip to content

fix(install): register the brain at cto and share one setup UI across platforms - #1040

Merged
arul28 merged 4 commits into
mainfrom
ade/ade-windows-connect-setup
Aug 5, 2026
Merged

fix(install): register the brain at cto and share one setup UI across platforms#1040
arul28 merged 4 commits into
mainfrom
ade/ade-windows-connect-setup

Conversation

@arul28

@arul28 arul28 commented Aug 5, 2026

Copy link
Copy Markdown
Owner

The bug

ade connect failed on every clean install, on Windows and macOS alike.

Both installers registered the machine brain with ade serve --install-service, which inherits ADE_DEFAULT_ROLE. On a fresh machine that is unset, so the brain came up at role agent — and ade connect runs at cto, which an agent brain can never serve.

Every other call site already held this invariant: the desktop app spawns its runtime at cto and refuses to attach to a service that isn't (localRuntimeConnectionPool.ts:330,2121), and ade brain start pins cto internally (cli.ts:15816). The installer was the one place that didn't. Both scripts now register through brain start — including the PowerShell rollback path, which was restoring the previous service at agent too.

The experience

The install was also silent and dishonest: ~30 s with no output, raw node:sqlite ExperimentalWarnings as the only proof of life, no progress on a 118 MB runtime or a 1 GB app download, and a cheerful next step printed after sign-in had already failed.

The shell scripts now own only what must happen before the ade binary exists. Everything after is ade setup — one TypeScript implementation both platforms hand off to, so the drift that left macOS with a download progress bar and Windows without one cannot recur.

  • Account — confirms an existing link (keep / switch / skip) instead of re-prompting blind
  • Desktop app — skips the ~1 GB download when that version is already installed, resumes a partial download via a Range request, verifies base64 SHA-512 against the electron-updater manifest
  • Launch — detached, so a Windows GUI child no longer inherits the console and sprays Electron logs over the prompt (macOS already got this free via open)
  • Verification — brain reachable + machine linked, before anything claims success
  • Summary — a failed step names the command that fixes it, inline and under "What's left"; a clean run prints neither
  • Warnings — the node:sqlite notice is filtered at CLI entry; every other warning class still prints
  • Degradation — plain appended lines on legacy conhost, pipes, and CI

Reuse

Extends rather than duplicates: the step/summary model from commands/connect.ts, byte progress from commands/tools.ts, readInstalledDesktopVersion from commands/doctor.ts, and releaseAssetUrl from lib/releaseAssets.ts.

Verification

  • 42 tests (setup.test.ts, nodeWarnings.test.ts), typecheck and build clean
  • Warning fix proven by A/B on a real Windows host: old binary 1 ExperimentalWarning, new binary 0
  • Full ade-cli suite: 9 failures, all pre-existing POSIX-path assertions in tools/manifest files this PR never touches — confirmed identical on the clean baseline

Not covered: a clean-host install run. It requires deleting ~/.ade on the dev machine, which would kill the ADE session that produced this PR.

Known limitations (recorded, not fixed here)

  • serve --install-service still defaults to agent for direct callers
  • The standalone CLI still cannot self-repair its brain service (isPackagedElectronCliRuntime() gate). The cto fix means we never reach the state that needs it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added the ade setup command to guide installation, account linking, desktop setup, verification, and recovery.
    • Installers now show progress, download metrics, elapsed time, and completion summaries.
    • Added resumable, verified desktop downloads with retry support.
    • Added interactive and non-interactive setup options, including rerun support.
    • Services are now registered through ade brain start.
  • Documentation

    • Updated installation guidance and CLI examples for the shared setup flow.
  • Bug Fixes

    • Suppressed supported SQLite warnings while preserving unrelated Node.js warnings.

@vercel

vercel Bot commented Aug 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Aug 5, 2026 10:50pm

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@arul28, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 25 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

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: CHILL

Plan: Pro Plus

Run ID: 4b9aa23d-b547-45a2-bf1f-360863a74bd3

📥 Commits

Reviewing files that changed from the base of the PR and between 1f73ddf and 5905b22.

⛔ Files ignored due to path filters (2)
  • docs/features/remote-runtime/README.md is excluded by !docs/**
  • docs/features/sync-and-multi-device/README.md is excluded by !docs/**
📒 Files selected for processing (30)
  • apps/ade-cli/README.md
  • apps/ade-cli/scripts/install-runtime.ps1
  • apps/ade-cli/scripts/install-runtime.sh
  • apps/ade-cli/src/bootstrap.ts
  • apps/ade-cli/src/cli.ts
  • apps/ade-cli/src/commands/setup.test.ts
  • apps/ade-cli/src/commands/setup.ts
  • apps/ade-cli/src/commands/setupDesktop.ts
  • apps/ade-cli/src/commands/setupRender.ts
  • apps/ade-cli/src/lib/nodeWarnings.test.ts
  • apps/ade-cli/src/lib/nodeWarnings.ts
  • apps/ade-cli/src/multiProjectRpcServer.test.ts
  • apps/ade-cli/src/multiProjectRpcServer.ts
  • apps/ade-cli/src/services/account/accountMachinePublisherService.test.ts
  • apps/ade-cli/src/services/sync/deviceRegistryService.ts
  • apps/ade-cli/src/services/sync/machineRelayTunnel.ts
  • apps/ade-cli/src/services/sync/projectlessSyncSnapshot.ts
  • apps/ade-cli/src/services/sync/syncRouteHealth.ts
  • apps/ade-cli/src/services/sync/syncService.test.ts
  • apps/ade-cli/src/services/sync/syncService.ts
  • apps/desktop/build/installer.nsh
  • apps/desktop/package.json
  • apps/desktop/scripts/windows-release-contract.test.mjs
  • apps/desktop/src/renderer/components/remoteTargets/RemoteTargetList.test.tsx
  • apps/desktop/src/renderer/components/remoteTargets/RemoteTargetList.tsx
  • apps/desktop/src/renderer/components/settings/SyncDevicesSection.test.tsx
  • apps/desktop/src/renderer/components/settings/accountDirectorySummary.ts
  • apps/desktop/src/shared/types/sync.ts
  • apps/web/src/components/install/InstallDialog.tsx
  • apps/web/src/lib/installTargets.ts
📝 Walkthrough

Walkthrough

Changes

Shared setup flow

Layer / File(s) Summary
Setup progress and terminal rendering
apps/ade-cli/src/commands/setupRender.ts, apps/ade-cli/src/commands/setup.test.ts
Adds terminal capability detection, progress rendering, summaries, recovery output, and reporter behavior.
Desktop acquisition and installation
apps/ade-cli/src/commands/setupDesktop.ts, apps/ade-cli/src/commands/setup.test.ts
Adds platform asset selection, resumable downloads, SHA-512 verification, Windows and macOS installation, cleanup, and application launching.
Setup command orchestration
apps/ade-cli/src/commands/setup.ts, apps/ade-cli/src/commands/setup.test.ts
Adds argument parsing, account handling, desktop setup, verification, failure recovery, and structured results.
CLI and installer integration
apps/ade-cli/src/cli.ts, apps/ade-cli/scripts/install-runtime.sh, apps/ade-cli/scripts/install-runtime.ps1, apps/ade-cli/README.md, apps/ade-cli/src/commands/setup.test.ts
Adds ade setup command parsing and dispatch. Both installers use ade brain start, show runtime progress, and delegate post-install work to ade setup. Documentation describes the new flow and non-interactive options.

SQLite warning filtering

Layer / File(s) Summary
SQLite warning filter implementation
apps/ade-cli/src/lib/nodeWarnings.ts, apps/ade-cli/src/lib/nodeWarnings.test.ts, apps/ade-cli/src/cli.ts
Suppresses matching SQLite experimental warnings while preserving unrelated warnings. The filter supports reset, environment control, and early CLI installation.

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

Possibly related PRs

  • arul28/ADE#726: Overlaps with installer, CLI, and runtime service installation changes.
  • arul28/ADE#1006: Provides related Windows runtime and service foundation changes.
  • arul28/ADE#1035: Overlaps with installer onboarding and PATH configuration changes.

Suggested labels: docs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 48.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the two primary changes: registering the brain with the cto role and sharing the setup flow across platforms.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/ade-windows-connect-setup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@arul28 arul28 changed the title ADE Windows Connect Setup -> Primary fix(install): register the brain at cto and share one setup UI across platforms Aug 5, 2026
@arul28
arul28 force-pushed the ade/ade-windows-connect-setup branch from 4362dd8 to 7b7fe7e Compare August 5, 2026 19:26
arul28 and others added 2 commits August 5, 2026 15:56
`ade connect` failed on every clean install, on Windows and macOS alike.
Both installers registered the machine brain with `ade serve
--install-service`, which inherits `ADE_DEFAULT_ROLE`; on a fresh machine
that is unset, so the brain came up at role `agent`. `ade connect` runs
at `cto`, and an `agent` brain can never serve a `cto` caller.

Every other call site already knew this: the desktop app spawns its
runtime at `cto` and refuses to attach to a service that is not
(localRuntimeConnectionPool.ts:330,2121), and `ade brain start` pins
`cto` internally (cli.ts:15816). Both installers now register through
`brain start`, including the PowerShell rollback path that was restoring
the previous service at `agent` too.

The installer was also silent and dishonest: ~30s with no output, raw
node:sqlite ExperimentalWarnings as the only proof of life, no progress
on a 118 MB runtime or a 1 GB app download, and a cheerful next step
printed after sign-in had already failed.

The shell scripts now own only what must happen before the `ade` binary
exists. Everything after is `ade setup`: one TypeScript implementation
both platforms hand off to, so the drift that left macOS with a download
progress bar and Windows without one cannot recur. It runs the agent
CLIs, account, and desktop app; verifies the install end to end; and
prints a summary where a failed step names the command that fixes it.

- account: confirms an existing link (keep/switch/skip) instead of
  re-prompting blind
- desktop: skips the ~1 GB download when that version is installed,
  resumes a partial download via Range, verifies base64 SHA-512
- desktop launch is detached, so a Windows GUI child no longer inherits
  the console and sprays Electron logs over the user's prompt
- node:sqlite ExperimentalWarning filtered at CLI entry; every other
  warning class still prints
- rendering degrades to plain appended lines on legacy conhost, pipes,
  and CI

Reuses the existing step/summary model from commands/connect.ts, byte
progress from commands/tools.ts, readInstalledDesktopVersion from
commands/doctor.ts, and releaseAssetUrl from lib/releaseAssets.ts.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The verification step added in this branch checked "brain running + account
signed in" and called that ready. A clean Windows install reproduced
exactly that state while never reaching the account directory, so the
installer would have printed "ADE is ready" over a machine that is absent
from the user's account.

Sign-in is not the outcome; publication is. Verification now reads the
brain's own account-directory publisher health and fails when the machine
is not published.

It also translates the publisher's internal state into an action. The
publisher's only snapshot source is the active project's sync host
(cli.ts:17011-17016), so a machine with no project registered emits
`no_active_sync_scope` and publishes nothing. The user-facing copy now
says to open a project rather than repeating "No active sync scope is
available." — the raw diagnostic the Connections pane surfaces today.

Absent health is treated as pass, not fail: the publisher runs on a 30s
heartbeat and a fresh install can outrun its first attempt.

`describeUnpublishedMachine` lives in commands/setup.ts rather than
cli.ts so it is testable without importing the whole dispatcher.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@arul28
arul28 force-pushed the ade/ade-windows-connect-setup branch from 7b7fe7e to 1f73ddf Compare August 5, 2026 19:56

@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: 7

🧹 Nitpick comments (3)
apps/ade-cli/scripts/install-runtime.ps1 (1)

133-133: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename $input; it shadows a PowerShell automatic variable.

$input is the pipeline enumerator inside a function. Assigning to it is flagged by PSScriptAnalyzer and breaks if Download-Asset ever accepts pipeline input. Rename it and the matching Dispose call at line 152.

♻️ Proposed fix
-      $input = $response.Content.ReadAsStreamAsync().GetAwaiter().GetResult()
+      $sourceStream = $response.Content.ReadAsStreamAsync().GetAwaiter().GetResult()
       $output = [IO.File]::Create($Destination)
       try {
@@
-        while (($read = $input.Read($buffer, 0, $buffer.Length)) -gt 0) {
+        while (($read = $sourceStream.Read($buffer, 0, $buffer.Length)) -gt 0) {
@@
         $output.Dispose()
-        $input.Dispose()
+        $sourceStream.Dispose()
🤖 Prompt for 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.

In `@apps/ade-cli/scripts/install-runtime.ps1` at line 133, Rename the stream
variable assigned in Download-Asset from $input to a non-reserved name, and
update the matching Dispose call to use the new variable consistently.

Source: Linters/SAST tools

apps/ade-cli/src/commands/setupDesktop.ts (1)

94-98: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick win

sha512Base64 reads the whole artifact into memory.

The desktop artifact is about 1 GB. fs.readFileSync allocates that as a single Buffer before hashing, on top of the memory the installer already holds. Stream the file into the hash instead.

♻️ Proposed refactor
-export function sha512Base64(filePath: string): string {
-  const hash = createHash("sha512");
-  hash.update(fs.readFileSync(filePath));
-  return hash.digest("base64");
-}
+export function sha512Base64(filePath: string): string {
+  const hash = createHash("sha512");
+  const buffer = Buffer.allocUnsafe(1024 * 1024);
+  const handle = fs.openSync(filePath, "r");
+  try {
+    let read = 0;
+    while ((read = fs.readSync(handle, buffer, 0, buffer.length, null)) > 0) {
+      hash.update(buffer.subarray(0, read));
+    }
+  } finally {
+    fs.closeSync(handle);
+  }
+  return hash.digest("base64");
+}

This keeps the synchronous signature, so setup.ts line 544 and the existing test need no change.

🤖 Prompt for 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.

In `@apps/ade-cli/src/commands/setupDesktop.ts` around lines 94 - 98, Update
sha512Base64 to hash the artifact incrementally with a synchronous file stream
instead of loading it via fs.readFileSync. Preserve the existing synchronous
string-returning API and Base64 digest behavior so its callers and tests remain
unchanged.
apps/ade-cli/src/commands/setup.test.ts (1)

35-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a color-enabled capability fixture and a regression test for it.

Every rendering test uses plain with color: false, so the ANSI-colored branch of formatActiveLine and stateSymbol is never exercised. That branch is where the width truncation at setupRender.ts line 203 miscounts escape bytes. Add a colored fixture with color: true and assert that a long colored active line keeps its reset sequence intact and stays within the visible column budget.

As per coding guidelines: "Record a named regression test or exact alternate verification for every accepted correctness finding."

🤖 Prompt for 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.

In `@apps/ade-cli/src/commands/setup.test.ts` around lines 35 - 41, Add a
color-enabled TerminalCapabilities fixture alongside plain in setup.test.ts,
then add a named regression test covering a long colored active line through
formatActiveLine/stateSymbol. Assert the rendered output preserves the ANSI
reset sequence and its visible width remains within the configured column
budget.

Source: Coding guidelines

🤖 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 `@apps/ade-cli/scripts/install-runtime.ps1`:
- Around line 120-125: Update the HTTP download setup around Add-Type and
HttpClient so it detects when System.Net.Http or [Net.Http.HttpClient] is
unavailable and falls back to Invoke-WebRequest for the download. Keep the
existing HttpClient path when the type loads successfully, and ensure the
unavailable-type case is handled before constructing the client so it does not
enter the main install rollback path.

In `@apps/ade-cli/scripts/install-runtime.sh`:
- Around line 534-537: Initialize path_profile_updated to 0 before setup_path
can take any early-return branch, then preserve setting it to 1 only when the
profile is successfully appended. Keep the final conditional in the install flow
safe under set -u so it does not evaluate an unset variable.

In `@apps/ade-cli/src/commands/setup.ts`:
- Around line 522-523: Update the artifact staging logic in downloadWithResume
to use a stable cache directory scoped to the artifact/version instead of
creating a fresh mkdtempSync directory per invocation. Preserve partial files
across interrupted runs by removing or conditioning the finally cleanup so the
cache is deleted only after successful completion, while retaining the existing
resume behavior within the download flow.

In `@apps/ade-cli/src/commands/setupDesktop.ts`:
- Around line 114-186: Update downloadWithResume in
apps/ade-cli/src/commands/setupDesktop.ts (lines 114-186) to create an
idle-timeout AbortSignal that resets whenever a response chunk is received, pass
it to fetchImpl, and allow that timeout to enter the retry loop while still
rethrowing the caller-provided abort. Update the manifest fetchImpl call in
apps/ade-cli/src/commands/setup.ts (lines 456-462) to pass an
AbortSignal.timeout(...) so stalled manifest requests fail the desktop step
instead of hanging.

In `@apps/ade-cli/src/commands/setupRender.ts`:
- Around line 197-203: Update the truncation logic in the setup render flow
around the line construction and return so ANSI escape sequences from
stateSymbol/paint do not count toward caps.columns or get split. Measure visible
terminal width and truncate safely at a display-width boundary, preserving
complete color reset sequences; add coverage for colored output while retaining
the existing plain-text behavior.
- Around line 256-258: Update the summary heading construction near the `failed`
count to select the separator based on `caps.unicode`, using the existing ASCII
fallback when Unicode support is unavailable and retaining the em dash for
Unicode-capable terminals.

In `@apps/ade-cli/src/lib/nodeWarnings.ts`:
- Around line 80-82: Update apps/ade-cli/src/lib/nodeWarnings.ts lines 80-82 and
the installation logic to save the original process.emitWarning before wrapping
it; make resetNodeWarningFilterForTests restore that emitter, clear the saved
reference, and reset installed. In apps/ade-cli/src/lib/nodeWarnings.test.ts
lines 4-44, add the named regression test restores process.emitWarning after
resetNodeWarningFilterForTests that resets, captures the emitter, installs the
filter, resets again, and asserts the captured emitter is restored.

---

Nitpick comments:
In `@apps/ade-cli/scripts/install-runtime.ps1`:
- Line 133: Rename the stream variable assigned in Download-Asset from $input to
a non-reserved name, and update the matching Dispose call to use the new
variable consistently.

In `@apps/ade-cli/src/commands/setup.test.ts`:
- Around line 35-41: Add a color-enabled TerminalCapabilities fixture alongside
plain in setup.test.ts, then add a named regression test covering a long colored
active line through formatActiveLine/stateSymbol. Assert the rendered output
preserves the ANSI reset sequence and its visible width remains within the
configured column budget.

In `@apps/ade-cli/src/commands/setupDesktop.ts`:
- Around line 94-98: Update sha512Base64 to hash the artifact incrementally with
a synchronous file stream instead of loading it via fs.readFileSync. Preserve
the existing synchronous string-returning API and Base64 digest behavior so its
callers and tests remain unchanged.
🪄 Autofix

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: CHILL

Plan: Pro Plus

Run ID: bf46e19f-abac-4fb5-aaf5-6f676e53064e

📥 Commits

Reviewing files that changed from the base of the PR and between 81c0b94 and 1f73ddf.

⛔ Files ignored due to path filters (1)
  • docs/features/onboarding-and-settings/README.md is excluded by !docs/**
📒 Files selected for processing (10)
  • apps/ade-cli/README.md
  • apps/ade-cli/scripts/install-runtime.ps1
  • apps/ade-cli/scripts/install-runtime.sh
  • apps/ade-cli/src/cli.ts
  • apps/ade-cli/src/commands/setup.test.ts
  • apps/ade-cli/src/commands/setup.ts
  • apps/ade-cli/src/commands/setupDesktop.ts
  • apps/ade-cli/src/commands/setupRender.ts
  • apps/ade-cli/src/lib/nodeWarnings.test.ts
  • apps/ade-cli/src/lib/nodeWarnings.ts

Comment thread apps/ade-cli/scripts/install-runtime.ps1
Comment on lines 534 to 537
if [ "$path_profile_updated" -eq 1 ]; then
printf 'New terminals will find `ade` on PATH. To use it in this one, run: %s\n' "$(env_file_ref)"
printf '\n ade is on your PATH in new terminals. To use it in this one, run:\n %s\n' \
"$(env_file_ref)"
fi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Guard path_profile_updated against being unset.

setup_path sets path_profile_updated=1 only on the successful profile-append path. Several earlier return 0 branches leave it at whatever it was. If it is never initialized, [ "$path_profile_updated" -eq 1 ] prints an integer-expression error at the end of an otherwise successful install.

🛡️ Proposed fix
-if [ "$path_profile_updated" -eq 1 ]; then
+if [ "${path_profile_updated:-0}" -eq 1 ]; then
#!/bin/bash
# Check whether path_profile_updated is initialized before use.
set -euo pipefail
rg -n 'path_profile_updated' apps/ade-cli/scripts/install-runtime.sh
🤖 Prompt for 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.

In `@apps/ade-cli/scripts/install-runtime.sh` around lines 534 - 537, Initialize
path_profile_updated to 0 before setup_path can take any early-return branch,
then preserve setting it to 1 only when the profile is successfully appended.
Keep the final conditional in the install flow safe under set -u so it does not
evaluate an unset variable.

Comment thread apps/ade-cli/src/commands/setup.ts Outdated
Comment thread apps/ade-cli/src/commands/setupDesktop.ts
Comment thread apps/ade-cli/src/commands/setupRender.ts Outdated
Comment thread apps/ade-cli/src/commands/setupRender.ts Outdated
Comment thread apps/ade-cli/src/lib/nodeWarnings.ts
…relay

A signed-in machine with no registered project could never appear in its
owner's ADE account. The account-directory publisher's only snapshot
source was a project-scoped sync host (cli.ts getSnapshot ->
resolveActiveSyncHost), so on a clean install it returned null, the
publisher bailed with `no_active_sync_scope` before any network call, and
the machine stayed invisible. Reproduced on a clean Windows box; the code
path has no platform branches, so macOS and Linux behaved identically.

This was never intended. runServe already treats projectless serving as a
supported hosting state -- it takes the machine-wide sync-host lease and
binds the shared listener -- and its own comment says such a brain would
"bind the port, publish itself, and dial the relay". It bound the port and
did neither of the other two, because getMachineOnlySyncStatus returned a
hardcoded all-down literal that was a lie in exactly that case.

- new projectlessSyncSnapshot builds an honest snapshot when the lease is
  held and the listener is bound: real port, real pairing connect info,
  host role. The publisher falls back to it only while genuinely hosting,
  so `no_active_sync_scope` stays an honest diagnosis otherwise.
- new machineRelayTunnel dials the relay on that path, reusing the shared
  tunnel-client cache key so a project scope booting later adopts the
  client instead of re-registering and evicting itself.
- a headless Linux box with an empty projects.json now publishes and is
  reachable off-LAN, which is the whole point of the one-liner install.

Pairing stays unset by design: account membership is the auth path and the
pairing code is a nearby-device fallback. The published endpoints still
enforce pairing-store auth, DPoP binding, and account attestation.

Also folds in the review findings this surfaced:
- one shared per-state advice table replaces hand-mirrored copies in the
  CLI and the Connections pane that had already drifted; the pane no
  longer renders the publisher's internal skipReason at users
- "open a project" is gone from every surface and doc: this change makes
  that case publish, so the advice could no longer help anyone
- syncRouteHealth extracts route-health derivation shared by syncService
  and the projectless builder, flattening a six-level nested ternary
- desktop install: streamed SHA-512 instead of buffering ~1 GB, a lock
  over the shared download cache, a working retry on Windows cleanup,
  and a macOS rollback that can no longer destroy a working app
- installers no longer fail a whole `curl | sh` because an optional
  post-install step flaked

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
CodeRabbit flagged this twice and both review passes refuted it: nothing
reaching `formatActiveLine` is coloured today, because `stateSymbol` only
paints the `ok` and `failed` symbols and that line passes a literal
"active". Measuring with `String.length` is therefore correct -- by
coincidence, not by construction.

That is a poor invariant to ship. Colour one more component of the line
later and it silently truncates early, and a slice through a reset
sequence leaves the colour applied to everything printed afterwards.

Truncation now counts columns actually occupied and copies escape
sequences whole. Writing the test caught a bug in the first version of
this: breaking out of the loop once the visible budget was spent dropped
the trailing reset, which is precisely the bleed it was meant to prevent.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@arul28
arul28 merged commit d06c02a into main Aug 5, 2026
36 checks passed
@arul28
arul28 deleted the ade/ade-windows-connect-setup branch August 5, 2026 23:05
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.

1 participant