Skip to content

fix(sidecar): persist host bridges across CLI upgrades (#148)#150

Merged
pawellisowski merged 5 commits into
mainfrom
fix/persist-host-bridges
May 24, 2026
Merged

fix(sidecar): persist host bridges across CLI upgrades (#148)#150
pawellisowski merged 5 commits into
mainfrom
fix/persist-host-bridges

Conversation

@pawellisowski
Copy link
Copy Markdown
Contributor

Summary

Host bridges installed via aware sidecar install were placed next to the running aware binary — for npm that's the package's own dir, which npm install -g wipes wholesale on every upgrade, silently dropping every bridge and resurfacing the #136 spawn aware-<host>: program not found failure. Closes #148.

  • Persistent location: bridges now install into ~/.aware/bridges/ (version-independent, survives upgrades).
  • Off-PATH resolution: since bridges leave PATH, the CLI invoker resolves a known bridge to its absolute path (find_bridge_by_binary) before spawning; non-bridge binaries and legacy on-PATH copies fall back to bare-name PATH resolution, so existing setups keep working through the transition.
  • No false "already installed": install/uninstall check the managed dir only (find_bridge_in_dir), so a legacy on-PATH copy can't block migration or be deleted by us.
  • Version-aware: a <binary>.version marker records the installing CLI release; install refreshes when missing/mismatched, and the invoker warns (prompting aware sidecar install <host>) before spawning a version-stale managed bridge.
  • sidecar list now reports four states — ✓ current, ↻ other-version, ⚠ legacy-on-PATH (prompt migration), ✗ missing — and resolves post-install note paths ({dir} → install dir) so SketchUp/Revit registration commands are runnable.

Review

Primary review by Codex (codex exec review --base main) — 5 rounds, every finding addressed, final pass clean. Findings fixed: PATH-satisfied install skip, version staleness (install + runtime), off-PATH post-install notes, and list masking legacy/placeholder state.

Test plan

  • cargo test --bin aware green (378); new sidecar + invoker unit tests for persistence, dir-only/by-binary resolution, version-currency, staleness, and note resolution
  • Changed files rustfmt- and clippy --all-targets -D warnings-clean (pre-existing crate-wide drift in untouched files unchanged; CI builds only)
  • Post-merge: bridges survive an npm install -g @aware-aeco/cli@latest; aware sidecar list prompts migration for a legacy on-PATH copy

Note: a pre-existing unrelated test failure exists on mainagent_list.rs::json_output_returns_envelope hard-asserts the agent count at 65 but the repo now has 67. Tracked separately; not touched here.

…rades (#148)

Bridges installed via `aware sidecar install` were placed next to the running
`aware` binary — for npm that's the package's own dir, which `npm install -g`
wipes wholesale on every upgrade, silently dropping every bridge and
resurfacing the #136 `spawn aware-<host>: program not found` failure.

- bridge_install_dir now resolves to ~/.aware/bridges (persistent, version-
  independent), removing the volatile exe-adjacent location.
- Since bridges are no longer on PATH, the CLI invoker resolves a known bridge
  binary to its absolute path via find_bridge_by_binary before spawning;
  non-bridge binaries (and legacy on-PATH bridges) fall back to bare-name PATH
  resolution, so existing setups keep working through the transition.
…review)

install()'s "already installed?" check delegated to find_bridge, which also
scans PATH — so a legacy on-PATH bridge (e.g. the pre-upgrade npm copy) made
install skip writing to ~/.aware/bridges, leaving the bridge unmigrated and
still vulnerable to the next npm wipe. Added find_bridge_in_dir (managed dir +
extracted subdir, no PATH); install and uninstall now use it. Runtime
resolution (find_bridge / the invoker) keeps the PATH fallback for transition.
Found by Codex review.
…notes (#148 review)

Two regressions from persisting bridges:

- Version staleness: install no-op'd on any existing file, so after a CLI
  upgrade the version-matched release asset was never re-fetched and the runtime
  spawned a stale bridge. Now a `<binary>.version` marker records the installing
  CLI version; install refreshes when it's missing/mismatched (bridge_is_current).
  uninstall clears the marker too.
- Off-PATH notes: the SketchUp/Revit post-install notes told users to run
  `aware-sketchup --install-bridge` / `install-addin.ps1`, which aren't on PATH
  now. Notes carry a `{dir}` placeholder resolved to the install dir so the
  printed command is runnable. Found by Codex review.
… paths (#148 review)

`aware sidecar list` used find_bridge (PATH-inclusive) and printed b.note raw:

- A legacy PATH-only bridge showed a clean ✓, hiding that it still lives outside
  ~/.aware/bridges and will be wiped on the next npm upgrade. list now reports
  four states: ✓ current (managed dir + matching version), ↻ other-version
  (managed dir, refresh), ⚠ legacy-on-PATH (prompt migration), ✗ missing.
- Notes printed the literal `{dir}` placeholder; list now resolves them via
  note_message like the install path does. Found by Codex review.
 review)

Runtime resolution returned a managed-dir bridge regardless of its version
marker, so `app run` could spawn a sidecar installed by an older CLI. The
invoker now warns (and prompts `aware sidecar install <host>`) when the resolved
managed bridge's version marker doesn't match the CLI — warn rather than refuse,
so cross-version-compatible bridges keep working and a patch bump doesn't force a
redownload; a truly incompatible bridge still fails the run with a clear error.
Adds sidecar::managed_bridge_is_stale.
@pawellisowski pawellisowski merged commit fa19bb2 into main May 24, 2026
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.

Host bridges installed via 'aware sidecar install' are wiped on every npm CLI upgrade (stored in volatile package dir)

1 participant