Skip to content

fix(tray): unify wearable client on repo-root .env + fix pendant Opus load - #344

Merged
AnkushMalaker merged 1 commit into
devfrom
fix/unified-tray-client-config
Jul 25, 2026
Merged

fix(tray): unify wearable client on repo-root .env + fix pendant Opus load#344
AnkushMalaker merged 1 commit into
devfrom
fix/unified-tray-client-config

Conversation

@AnkushMalaker

Copy link
Copy Markdown
Collaborator

What

Fixes the unified tray's --pendant install, which produced a login item that streamed to localhost and crash-looped on launch.

clients.py — pendant Opus native lib

The pendant (BLE) path decodes Opus via opuslib, which loads native libopus through ctypes.util.find_library("opus"). That search skips Homebrew's lib dir, and launchd hands the agent a bare environment — so the tray crashed with "Could not find Opus library". Now the generated macOS plist gets DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib:/usr/local/lib when the pendant extra is enabled (harmless when the dirs are absent).

local-wearable-client/{backend_sender,main}.py — unified config

The wearable client didn't read the repository-root .env the way the tray and vault sync do:

  • backend_sender._resolve_backend_url() called resolve_backend_url(None), so an explicit BACKEND_URL was ignored and it fell back to localhost. It also only read BACKEND_HOST and ADMIN_* auth keys.
  • Now both modules load_dotenv(REPO_ROOT / ".env") and read the unified BACKEND_URL / AUTH_USERNAME / AUTH_PASSWORD keys (mirroring vault_core), with legacy BACKEND_HOST / ADMIN_* names kept as fallbacks.

Verification

On this Mac, chronicle-tray install --pendant now installs a login item that stays up:

  • vault_core: Backend URL set explicitly: http://<server>:8000
  • backend_sender: Wearable backend resolved: http://<server>:8000 (ws: ws://<server>:8000/ws?codec=opus) (was localhost)
  • ble_manager: Scan found N device(s) — pendant section loads, no Opus crash.

… load

The unified tray's pendant (BLE) path streamed to localhost and crashed on
launch, so `chronicle-tray install --pendant` produced a login item that never
stayed up.

- clients.py: the pendant extra decodes Opus via opuslib, which finds native
  libopus through ctypes.util.find_library("opus") — a search that skips
  Homebrew's lib dir, and launchd hands the agent a bare environment. Add
  DYLD_FALLBACK_LIBRARY_PATH=/opt/homebrew/lib:/usr/local/lib to the generated
  macOS plist when the pendant extra is enabled.

- local-wearable-client/backend_sender.py, main.py: read the unified
  repository-root .env (BACKEND_URL / AUTH_USERNAME / AUTH_PASSWORD) that the
  tray and vault sync already use, mirroring vault_core. backend_sender now
  passes BACKEND_URL to resolve_backend_url (it previously passed None, so an
  explicit server URL was ignored and it fell back to localhost) and accepts
  AUTH_* auth keys, with the legacy BACKEND_HOST / ADMIN_* names kept as
  fallbacks.
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 41699d34-086a-4cd6-a0d1-c53d36b2abea

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/unified-tray-client-config

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.

@AnkushMalaker
AnkushMalaker merged commit 062adb8 into dev Jul 25, 2026
4 checks passed
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