The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): explain missing remote profiles
Yuan Li071842a869d3
diff --git a/apps/desktop/electron/remote-lifecycle.test.ts b/apps/desktop/electron/remote-lifecycle.test.tsindex bdd76274b0e..f97c0a64516 100644--- a/apps/desktop/electron/remote-lifecycle.test.ts+++ b/apps/desktop/electron/remote-lifecycle.test.ts@@ -1088,6 +1088,23 @@ test('scrapeReadyPort reads only the named spawn log', async () => {assert.ok(ssh.calls.every(call => !call.includes('desktop-ssh.log')))})+test('scrapeReadyPort explains a missing remote profile', async () => {+ const ssh = fakeSsh([[/cat/, "Error: Profile 'operator' does not exist. Create it with: hermes profile create operator\n"]])++ await assert.rejects(+ () => scrapeReadyPort(ssh, spawnLogPath(OWNERSHIP_ID, SPAWN_NONCE), {+ timeoutMs: 1000,+ isAlive: async () => false+ }),+ (err: any) => {+ assert.equal(err.kind, 'remote-profile-missing')+ assert.match(err.message, /remote Hermes profile 'operator' does not exist/)+ assert.match(err.message, /hermes profile create operator/)+ return true+ }+ )+})+test('scrapeReadyPort times out and reports a dead spawn', async () => {// never emits a READY lineconst ssh = fakeSsh([[/cat .*\.log/, 'still starting...']])diff --git a/apps/desktop/electron/remote-lifecycle.ts b/apps/desktop/electron/remote-lifecycle.tsindex b9fdae38823..ff773eee784 100644--- a/apps/desktop/electron/remote-lifecycle.ts+++ b/apps/desktop/electron/remote-lifecycle.ts@@ -1217,6 +1217,22 @@ async function remoteSupportsSshOwnership(ssh, hermesPath) {.endsWith('YES')}+function remoteProfileMissingError(output) {+ const match = String(output || '').match(/Error: Profile ['\"]([^'\"]+)['\"] does not exist\.?(?: Create it with: ([^\n]+))?/i)++ if (!match) return null++ const profile = match[1]+ const createCommand = match[2]?.trim()+ const err: any = new Error(+ `The remote Hermes profile '${profile}' does not exist. ` ++ `Select an existing remote profile${createCommand ? ` or create it with: ${createCommand}` : '.'}`+ )+ err.kind = 'remote-profile-missing'+ err.profile = profile+ return err+}+async function scrapeReadyPort(ssh, logPath, { timeoutMs = resolveReadyTimeoutMs(), isAlive, signal }: any = {}) {const deadline = Date.now() + timeoutMsconst remoteLog = expandRemotePath(logPath)@@ -1224,12 +1240,6 @@ async function scrapeReadyPort(ssh, logPath, { timeoutMs = resolveReadyTimeoutMswhile (Date.now() < deadline) {assertBootstrapNotSuperseded(signal)- if (isAlive && !(await isAlive())) {- const err: any = new Error('Remote dashboard process exited before announcing its port.')- err.kind = 'spawn-failed'- throw err- }-let tailtry {@@ -1238,6 +1248,14 @@ async function scrapeReadyPort(ssh, logPath, { timeoutMs = resolveReadyTimeoutMstail = ''}+ if (isAlive && !(await isAlive())) {+ const cause = remoteProfileMissingError(tail)+ if (cause) throw cause+ const err: any = new Error('Remote dashboard process exited before announcing its port.')+ err.kind = 'spawn-failed'+ throw err+ }+const m = READY_RE.exec(String(tail || ''))if (m) {