Skip to content

fix(shells): detect pwsh 7 at any install path + harden config against malformed profiles (v0.16.10)#142

Open
kordless wants to merge 1 commit into
canaryfrom
fix/pwsh7-detection-and-config-resilience
Open

fix(shells): detect pwsh 7 at any install path + harden config against malformed profiles (v0.16.10)#142
kordless wants to merge 1 commit into
canaryfrom
fix/pwsh7-detection-and-config-resilience

Conversation

@kordless

Copy link
Copy Markdown

What & why

PowerShell 7 wouldn't open on this machine and a malformed config could crash the app at launch. Root cause of the first: the pwsh detector hardcoded only the 64‑bit install path, so an x86 / winget / Microsoft Store install was missed — the PowerShell profile then pointed at a nonexistent exe and every pane opened with it silently fell back to Windows PowerShell 5.1. While fixing that I also hit (and caused) a config‑loader crash, so this hardens that path too.

Changes

Shell detection

  • app/config/detect.ts — probe both Program Files and Program Files (x86) and resolve pwsh on PATH, taking the first that exists. New helpers firstExisting() and resolveOnPath().

Config resilience

  • app/config/init.ts — coerce config.profiles to a real array before .map. A malformed value (e.g. a JSON‑encoded string) previously threw an uncaught exception that crashed the main process at launch — unrecoverable, since the app won't start to let you fix it. Now a stringified array is parsed and anything still non‑array degrades to [].
  • sidecar/src/mcp.rs (settings_set) — unwrap a stringified JSON array/object before storing (coerce_json_string). An MCP client that serializes a structured value to a string can no longer write a config that crashes the loader. (This is exactly how the crash above got introduced.)

Agent messaging (this session's earlier work, folded in)

  • New sidecar/src/messages/ catalog: keyed, per‑locale, {{placeholder}} rendering with an English fallback; HYPERIA_LOCALE selects the locale at startup. Identity‑recovery and refusal prose moved out of main.rs / mcp.rs.
  • Branch‑aware identity recovery — host vs container, docker vs podman (podman / native‑Linux reach the host via a real bridge gateway, so a loopback bind is invisible; Docker Desktop forwards to loopback).
  • Server instructions: if Hyperia itself misbehaves, stop and tell the human — don't keep hammering the failing tool.

Verification

  • sidecar: cargo check clean (only pre‑existing warnings).
  • app: tsc -b exits 0 after npm install of root + app/ deps. The two changed .ts files add no new imports.
  • Version bumped to 0.16.10 across package.json, app/package.json, sidecar/Cargo.toml, Cargo.lock.

🤖 Generated with Claude Code

…t malformed profiles (v0.16.10)

PowerShell 7 wouldn't open and a bad config could brick the app. Three fixes:

- detect.ts: probe both Program Files locations AND PATH for pwsh, not just the
  hardcoded 64-bit path. An x86 / winget / Microsoft Store install was missed
  entirely, so the "PowerShell" profile pointed at a nonexistent exe and every
  pane opened with it silently fell back to Windows PowerShell 5.1.
- init.ts: coerce config.profiles to a real array before .map. A malformed value
  (e.g. a JSON-encoded string) previously threw an uncaught exception that crashed
  the main process at launch — unrecoverable, since the app won't start to fix it.
- mcp.rs (settings_set): unwrap a stringified JSON array/object before storing, so
  an MCP client that serializes a structured value to a string can't write a
  config that crashes the loader.

Also folds in this session's agent-message work:

- New messages/ catalog: keyed, per-locale, {{placeholder}} rendering with an
  English fallback, moving identity-recovery and refusal prose out of main.rs /
  mcp.rs. HYPERIA_LOCALE selects the locale at startup.
- Branch-aware identity recovery: host vs container guidance, docker vs podman
  (podman/native-Linux use a real bridge gateway; a loopback bind is invisible).
- Server instructions: if Hyperia itself misbehaves, stop and tell the human —
  don't keep hammering the failing tool.

Verification: sidecar `cargo check` clean. App-side TypeScript type-reviewed but
not locally compiled (typescript not installed at repo root this session).

Co-Authored-By: Claude Opus 4.8 <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.

1 participant