Skip to content
This repository was archived by the owner on Aug 6, 2026. It is now read-only.

Commit f8c4b88

Browse files
committed
apply final review fixes
1 parent 1e9c7c0 commit f8c4b88

4 files changed

Lines changed: 33 additions & 34 deletions

File tree

‎apps/code/scripts/dev-update/run-from-ci-forge.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ command -v gh >/dev/null || {
2121
exit 1
2222
}
2323

24-
if pgrep -x "PostHog Code" >/dev/null || pgrep -x "PostHog" >/dev/null; then
24+
if pgrep -x "PostHog Code|PostHog" >/dev/null; then
2525
echo "PostHog is already running. Quit it first; the test build shares its single-instance lock and data dir." >&2
2626
exit 1
2727
fi

‎apps/code/scripts/dev-update/run-from-ci.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ command -v gh >/dev/null || {
2020
exit 1
2121
}
2222

23-
if pgrep -x "PostHog" >/dev/null; then
23+
if pgrep -x "PostHog Code|PostHog" >/dev/null; then
2424
echo "PostHog is already running. Quit it first; the test build shares its single-instance lock and data dir." >&2
2525
exit 1
2626
fi

‎apps/code/tests/e2e/fixtures/update.ts‎

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,7 @@ export const FORGE_RUN_APP_BIN = path.join(
3030
FORGE_RUN_APP,
3131
"Contents/MacOS/PostHog Code",
3232
);
33-
// Squirrel replaces the bundle's contents but keeps the on-disk .app name, so
34-
// after the swap the "PostHog Code.app" dir contains the renamed binary.
33+
// Squirrel swaps bundle contents in place, so the old-named .app dir gains the renamed binary.
3534
export const FORGE_RUN_APP_BIN_UPDATED = path.join(
3635
FORGE_RUN_APP,
3736
"Contents/MacOS/PostHog",
@@ -143,35 +142,35 @@ export function shipItEvidence(): { exists: boolean; entries: string[] } {
143142
}
144143
}
145144

146-
// The forge leg runs the pre-rename build ("PostHog Code") before the swap and
147-
// the renamed build ("PostHog") after it, so process checks must match both.
148-
const APP_PROCESS_NAMES = ["PostHog", "PostHog Code"];
145+
// The forge leg is "PostHog Code" pre-swap and "PostHog" post-swap, so match either name.
146+
const APP_PROCESS_PATTERN = [FORGE_RUN_APP_BIN, RUN_APP_BIN]
147+
.map((bin) => path.basename(bin))
148+
.join("|");
149149

150150
export function isAppRunning(): boolean {
151-
return APP_PROCESS_NAMES.some((name) => {
152-
try {
153-
execFileSync("pgrep", ["-x", name], { stdio: "ignore" });
154-
return true;
155-
} catch {
156-
return false;
157-
}
158-
});
151+
try {
152+
execFileSync("pgrep", ["-x", APP_PROCESS_PATTERN], { stdio: "ignore" });
153+
return true;
154+
} catch {
155+
return false;
156+
}
159157
}
160158

161159
// Executable paths of the running main app processes (not helpers). Used to prove
162160
// Squirrel's auto-relaunched process is running from the swapped bundle.
163161
export function runningAppExecutables(): string[] {
164-
const pids = APP_PROCESS_NAMES.flatMap((name) => {
165-
try {
166-
return execFileSync("pgrep", ["-x", name], { encoding: "utf8" })
167-
.trim()
168-
.split("\n")
169-
.filter(Boolean);
170-
} catch {
171-
return [];
172-
}
173-
});
174-
return [...new Set(pids)]
162+
let pids: string[];
163+
try {
164+
pids = execFileSync("pgrep", ["-x", APP_PROCESS_PATTERN], {
165+
encoding: "utf8",
166+
})
167+
.trim()
168+
.split("\n")
169+
.filter(Boolean);
170+
} catch {
171+
return [];
172+
}
173+
return pids
175174
.map((pid) => {
176175
try {
177176
return execFileSync("ps", ["-p", pid, "-o", "comm="], {
@@ -185,12 +184,10 @@ export function runningAppExecutables(): string[] {
185184
}
186185

187186
export function killApp(): void {
188-
for (const name of APP_PROCESS_NAMES) {
189-
try {
190-
execFileSync("pkill", ["-x", name]);
191-
} catch {
192-
// nothing running, fine
193-
}
187+
try {
188+
execFileSync("pkill", ["-x", APP_PROCESS_PATTERN]);
189+
} catch {
190+
// nothing running, fine
194191
}
195192
}
196193

‎packages/core/src/speech/composeUtterance.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
const TASK_TITLE_MAX = 40;
2+
const TASK_PREFIX = "PostHog task";
3+
const TASK_PREFIX_GUARD = new RegExp(`^\\s*${TASK_PREFIX}`, "i");
24

35
export interface ComposeInput {
46
text: string;
@@ -43,7 +45,7 @@ export function composeUtterance({
4345
// before any greeting logic so the guard stays order-independent: injecting
4446
// "Hey <name>," first would push the prefix past the start of the string and
4547
// defeat this test, producing a double prefix.
46-
if (/^\s*posthog task/i.test(body)) return body;
48+
if (TASK_PREFIX_GUARD.test(body)) return body;
4749

4850
if (needsUser && addressByName && firstName) {
4951
// Normalize any leading greeting the agent added, then address by real name.
@@ -57,5 +59,5 @@ export function composeUtterance({
5759
title.length > TASK_TITLE_MAX
5860
? `${title.slice(0, TASK_TITLE_MAX)}…`
5961
: title;
60-
return `PostHog task '${shortTitle}' — ${body}`;
62+
return `${TASK_PREFIX} '${shortTitle}' — ${body}`;
6163
}

0 commit comments

Comments
 (0)