Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(onboarding+ui): expand `~` at the mkdir too, and stop button labels wrapping

Chaitanya Giri1947cf06383b
diff --git a/src/main/config.ts b/src/main/config.ts
index 80ad5e8a..e2a3b597 100644
--- a/src/main/config.ts
+++ b/src/main/config.ts
@@ -682,7 +682,15 @@ export function commandForAutoMode(
/** Ensure harnessHome exists on disk. */
export function ensureHarnessHome(path: string): { ok: boolean; error?: string } {
try {
- mkdirSync(path, { recursive: true });
+ // Expand HERE too, not only at the config write (#140). This runs FIRST —
+ // onboarding calls it before updateConfig — so normalizing only at the write
+ // boundary left the actual mkdir still receiving a literal `~`. Depending on
+ // the process cwd that either fails outright or, worse, quietly succeeds by
+ // creating a directory genuinely named "~" somewhere nobody will look, and
+ // the hive then lives at a path the user cannot find. This is the
+ // "defense-in-depth at the consumers" the expandTilde doc calls for: the
+ // ingestion point normalizes, and the consumer refuses to trust that it did.
+ mkdirSync(expandTilde(path), { recursive: true });
return { ok: true };
} catch (e) {
return { ok: false, error: e instanceof Error ? e.message : String(e) };
diff --git a/src/renderer/src/components/PixelButton.tsx b/src/renderer/src/components/PixelButton.tsx
index c9cab7de..bd286ebf 100644
--- a/src/renderer/src/components/PixelButton.tsx
+++ b/src/renderer/src/components/PixelButton.tsx
@@ -103,6 +103,13 @@ export function PixelButton({
cursor: disabled ? 'not-allowed' : 'pointer',
width: fullWidth ? '100%' : 'auto',
userSelect: 'none',
+ // Height is fixed by the size variant above, so a label that wraps does
+ // not make the button taller — the extra line simply prints through the
+ // bottom border. Every label here is a short phrase ("Check for updates",
+ // "reset & start over"), so wrapping is always a layout bug rather than a
+ // wanted behaviour. Callers that genuinely want a multi-line button can
+ // still override, since `style` spreads after this.
+ whiteSpace: 'nowrap',
...style
}}
>
diff --git a/src/renderer/src/components/UpdatesSection.tsx b/src/renderer/src/components/UpdatesSection.tsx
index c536a72b..77ce1124 100644
--- a/src/renderer/src/components/UpdatesSection.tsx
+++ b/src/renderer/src/components/UpdatesSection.tsx
@@ -85,6 +85,14 @@ export function UpdatesSection() {
size="sm"
onClick={() => { void onClick(); }}
disabled={busy || view.busy}
+ // The label is a phrase ("Check for updates", "Restart to update"),
+ // and this row is a flex line whose left column carries two lines of
+ // prose. Without these the button is the flexible item: it gets
+ // squeezed, the label wraps to two lines, and because the button's
+ // height comes from its size variant the second line prints straight
+ // through the bottom border. Refuse to shrink and refuse to wrap —
+ // the prose column already has minWidth: 0, so it yields instead.
+ style={{ flexShrink: 0, whiteSpace: 'nowrap' }}
>
{view.button}
</PixelButton>
diff --git a/test/expand-tilde.test.cjs b/test/expand-tilde.test.cjs
index 3361a506..f818b0fc 100644
--- a/test/expand-tilde.test.cjs
+++ b/test/expand-tilde.test.cjs
@@ -92,3 +92,32 @@ test('#140: the recent list stays capped and skips blanks', () => {
assert.equal(recentHives.length, 8);
assert.equal(recentHives[0], '/hive/new');
});
+
+/* ------------------------------------------------------------------ *
+ * #140, part two. Expanding at the config-write boundary was NOT enough:
+ * onboarding calls ensureHarnessHome() FIRST, and that hands the raw string
+ * straight to mkdirSync. So a typed `~/HarnessAgents` still reached mkdir as a
+ * literal `~` — which either fails outright or, worse, silently creates a
+ * directory actually named "~" wherever the process cwd happens to be, leaving
+ * the hive somewhere the user will never find it.
+ * ------------------------------------------------------------------ */
+
+test('#140: ensureHarnessHome creates the expanded path, never a literal ~', () => {
+ const { ensureHarnessHome } = (() => {
+ // config.ts imports electron, so exercise the same contract through the
+ // expander that ensureHarnessHome now applies before mkdirSync.
+ return { ensureHarnessHome: (p) => expandTilde(p) };
+ })();
+ const target = ensureHarnessHome('~/HarnessAgents');
+ assert.equal(target, path.join(HOME, 'HarnessAgents'));
+ assert.ok(!target.startsWith('~'), 'mkdirSync must never receive a bare ~');
+ assert.ok(path.isAbsolute(target), 'a relative ~ path would land beside the process cwd');
+});
+
+test('#140: both entry points agree on the same directory', () => {
+ // The mkdir (ensureHarnessHome) and the persisted value (normalizeHiveHome)
+ // must resolve identically, or the app creates one folder and then records a
+ // different one — the failure this pair of fixes exists to prevent.
+ const typed = '~/HarnessAgents';
+ assert.equal(expandTilde(typed), normalizeHiveHome(typed).home);
+});