The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
test(desktop-update-e2e): port main's install/update specs to the attach model
teknium146100a612399
diff --git a/apps/desktop/e2e/update/app-update.spec.ts b/apps/desktop/e2e/update/app-update.spec.tsindex 95049be23f7..33589152a26 100644--- a/apps/desktop/e2e/update/app-update.spec.ts+++ b/apps/desktop/e2e/update/app-update.spec.ts@@ -31,8 +31,8 @@ import {diagnostics,git,handoffLog,- installProcesses,launchInstalledApp,+ nonGatewayProcesses,openAbout,publishUpstream,startInstallSession,@@ -116,9 +116,9 @@ test('clicking Update now moves the backend to the new commit, relaunches the ap// Hand the machine back to Playwright: quit the relaunched app the way the OS asks it to.process.kill(relaunched.pid, 'SIGTERM')await expect- .poll(() => installProcesses(facts).map(p => `${p.pid} ${p.cmdline.slice(0, 160)}`), {+ .poll(() => nonGatewayProcesses(facts).map(p => `${p.pid} ${p.cmdline.slice(0, 160)}`), {timeout: 60_000,- message: 'the relaunched app quits cleanly on SIGTERM'+ message: 'the relaunched app quits cleanly on SIGTERM (its gateway outlives it)'}).toEqual([])})diff --git a/apps/desktop/e2e/update/first-run.spec.ts b/apps/desktop/e2e/update/first-run.spec.tsindex 05c82c17160..a3d97468ece 100644--- a/apps/desktop/e2e/update/first-run.spec.ts+++ b/apps/desktop/e2e/update/first-run.spec.ts@@ -30,7 +30,9 @@ import {installFirstRunSampler,installProcesses,launchInstalledApp,- startInstallSession+ nonGatewayProcesses,+ startInstallSession,+ stopInstallGateway} from './harness'const RUN = Date.now().toString(36)@@ -111,10 +113,18 @@ test('a healthy local install opens straight to chat on every launch: no setup cawait closeQuietly(app)}+ await expect+ .poll(() => nonGatewayProcesses(facts).map(p => `${p.pid} ${p.cmdline.slice(0, 160)}`), {+ timeout: 30_000,+ message: 'quitting the app leaves nothing of the install running but its gateway'+ })+ .toEqual([])+ const stopped = stopInstallGateway(facts)+ expect(stopped.code, `hermes gateway stop\n${stopped.output}`).toBe(0)await expect.poll(() => installProcesses(facts).map(p => `${p.pid} ${p.cmdline.slice(0, 160)}`), {timeout: 30_000,- message: 'quitting the app leaves nothing of the install running'+ message: 'stopping the gateway leaves nothing of the install running'}).toEqual([])})diff --git a/apps/desktop/e2e/update/harness.ts b/apps/desktop/e2e/update/harness.tsindex 337f0be17e3..5537f810c2a 100644--- a/apps/desktop/e2e/update/harness.ts+++ b/apps/desktop/e2e/update/harness.ts@@ -272,9 +272,13 @@ export function desktopMainProcesses(facts: InstallFacts): ProcInfo[] {/** The `hermes serve` backend(s) of this install (children of the backend excluded). */export function backendServeProcesses(facts: InstallFacts): ProcInfo[] {+ // The local backend is the gateway `hermes gateway ensure` attached to or started+ // (`hermes_cli.main [--profile X] gateway run --quiet`); `serve` covers a pool backend.const serve = installProcesses(facts).filter(proc =>- / serve( |$)/.test(proc.cmdline) && !/--type=/.test(proc.cmdline) && !exeOf(proc.pid).includes('linux-unpacked')+ (/ serve( |$)/.test(proc.cmdline) || / gateway run( |$)/.test(proc.cmdline)) &&+ !/--type=/.test(proc.cmdline) &&+ !exeOf(proc.pid).includes('linux-unpacked'))const pids = new Set(serve.map(proc => proc.pid))@@ -282,6 +286,20 @@ export function backendServeProcesses(facts: InstallFacts): ProcInfo[] {return serve.filter(proc => !pids.has(proc.ppid))}+/** Install processes other than the gateway Desktop attached to (it outlives the app by design). */+export function nonGatewayProcesses(facts: InstallFacts): ProcInfo[] {+ const gateways = new Set(backendServeProcesses(facts).map(proc => proc.pid))++ return installProcesses(facts).filter(proc => !gateways.has(proc.pid) && !gateways.has(proc.ppid))+}++/** `hermes gateway stop` with the install's own CLI: attach-mode Desktop never owns the gateway. */+export function stopInstallGateway(facts: InstallFacts): { code: number | null; output: string } {+ const result = spawnSync(facts.hermes, ['gateway', 'stop'], { env: facts.env, encoding: 'utf8', timeout: 90_000 })++ return { code: result.status, output: `${result.stdout ?? ''}${result.stderr ?? ''}` }+}+export function readText(file: string): string {try {return fs.readFileSync(file, 'utf8')