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
Open
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
PowerShellprofile 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 bothProgram FilesandProgram Files (x86)and resolvepwshonPATH, taking the first that exists. New helpersfirstExisting()andresolveOnPath().Config resilience
app/config/init.ts— coerceconfig.profilesto 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)
sidecar/src/messages/catalog: keyed, per‑locale,{{placeholder}}rendering with an English fallback;HYPERIA_LOCALEselects the locale at startup. Identity‑recovery and refusal prose moved out ofmain.rs/mcp.rs.Verification
sidecar:cargo checkclean (only pre‑existing warnings).app:tsc -bexits 0 afternpm installof root +app/deps. The two changed.tsfiles add no new imports.package.json,app/package.json,sidecar/Cargo.toml,Cargo.lock.🤖 Generated with Claude Code