Skip to content

The agent that grows with you

fix(update): managed SSH observer reads a profile update's receipt from the root home (review F2-ssh-receipt-root)

Tekniumbb85bdfc1161
diff --git a/apps/desktop/electron/managed-ssh-update.test.ts b/apps/desktop/electron/managed-ssh-update.test.ts
index adef9261f09..30d8a89c650 100644
--- a/apps/desktop/electron/managed-ssh-update.test.ts
+++ b/apps/desktop/electron/managed-ssh-update.test.ts
@@ -538,6 +538,53 @@ test.runIf(process.platform !== 'win32')(
}
)
+test.runIf(process.platform !== 'win32')(
+ 'managed observer reads a named profile update receipt from the root home the CLI writes',
+ async () => {
+ const root = await mkdtemp(path.join(os.tmpdir(), 'hermes-managed-profile-receipt-'))
+ const profileHome = path.join(root, 'profiles', 'research')
+
+ const receipt = (outcome: string) =>
+ JSON.stringify({
+ correlation_id: CORRELATION,
+ outcome,
+ started_at: '2026-08-23T00:00:00Z',
+ finished_at: '2026-08-23T00:01:00Z'
+ })
+
+ try {
+ // The CLI's receipt store is install-wide; a stale copy under the profile is not its source.
+ await mkdir(path.join(root, 'logs', 'update_receipts'), { recursive: true })
+ await mkdir(path.join(profileHome, 'logs', 'update_receipts'), { recursive: true })
+ await writeFile(path.join(profileHome, `.update_exit_code.${CORRELATION}`), '0')
+ await writeFile(path.join(root, 'logs', 'update_receipts', `update_${CORRELATION}.json`), receipt('success'))
+ await writeFile(
+ path.join(profileHome, 'logs', 'update_receipts', `update_${CORRELATION}.json`),
+ receipt('failed')
+ )
+
+ const command = buildRemoteUpdateObservationCommand(
+ {
+ ssh: { exec: async () => '' },
+ platform: 'Linux',
+ hermesPath: '/opt/hermes/hermes',
+ hermesHome: profileHome
+ },
+ CORRELATION
+ )
+
+ const { stdout } = await exec(command, { shell: 'sh' })
+ const parsed = parseRemoteUpdateObservation(stdout, CORRELATION)
+
+ assert.equal(parsed.exitCode, 0)
+ assert.equal(parsed.receipt?.correlationId, CORRELATION)
+ assert.equal(parsed.receipt?.outcome, 'success')
+ } finally {
+ await rm(root, { force: true, recursive: true })
+ }
+ }
+)
+
test('Windows coordinator handoff is pending until its marker clears and correlated receipt is durable', async () => {
const replies = [
observation({ marker: 'live', markerPid: 44 }),
diff --git a/apps/desktop/electron/managed-ssh-update.ts b/apps/desktop/electron/managed-ssh-update.ts
index c87796d11d0..c9712f5165e 100644
--- a/apps/desktop/electron/managed-ssh-update.ts
+++ b/apps/desktop/electron/managed-ssh-update.ts
@@ -324,9 +324,10 @@ from pathlib import Path
home=Path(os.path.expanduser(sys.argv[1]))
correlation=sys.argv[2]
-# The update marker is install-wide even when the launcher was invoked with a
-# named profile home (<root>/profiles/<name>). Correlated status/intent/receipt
-# remain under the launch home, matching the CLI writer.
+# The update marker and the receipt store are install-wide even when the launcher
+# was invoked with a named profile home (<root>/profiles/<name>): the CLI writes
+# receipts under the root home. Correlated status/ready/intent stay under the
+# launch home, matching their writers.
profile_parent=home.parent.name
is_profile_home=(profile_parent.lower()=='profiles') if os.name=='nt' else (profile_parent=='profiles')
install_root=home.parent.parent if is_profile_home else home
@@ -416,7 +417,7 @@ def terminal_code():
except ValueError:return 'malformed'
def receipt():
- directory=home/'logs'/'update_receipts'
+ directory=install_root/'logs'/'update_receipts'
try:paths=sorted(directory.glob('update_*.json'),key=lambda p:p.stat().st_mtime_ns,reverse=True)
except OSError:return None
for path in paths: