Skip to content

Commit 12a6ee0

Browse files
msfstefclaude
andauthored
feat(agents-desktop): give pull-wake runner a distinguishable label (#4590)
## What The agents-desktop app registers itself as a pull-wake "runner" that shows up in the mobile/desktop runner picker. Every desktop instance registered with the same hardcoded label `Electric Agents Desktop`, making it impossible to tell runners apart when selecting where to run an agent. This makes the label distinguishable. It now defaults to: ``` <identity> · <hostname> ``` where `<identity>` is the signed-in Electric Cloud **name**, falling back to **email** (available earlier, before `whoami` resolves), then to `Electric Desktop` for local/manual servers. Examples: - `Stefanos · stefs-mbp.local` (Cloud, signed in) - `stef@example.com · stefs-mbp.local` (Cloud, name not yet resolved) - `Electric Desktop · stefs-mbp.local` (local/manual server) ## Overrides Resolution precedence (mirrors the existing `pullWakeRunnerId` pattern): 1. `ELECTRIC_DESKTOP_PULL_WAKE_RUNNER_LABEL` env var 2. `pullWakeRunnerLabel` in `settings.json` 3. auto `<identity> · <hostname>` ## Notes - No schema/server/UI changes — registration already upserts the `label` on the stable runner id, so existing runners pick up the new label automatically on next launch. The selection UIs already render `label`, so the improvement flows straight through to both mobile and desktop pickers. - Cloud auth state is now captured once in `startRuntime` and reused for both owner-principal derivation and the label (no extra `getCloudAuthState()` call); owner-principal behavior is unchanged. ## Test plan - [x] `tsc --noEmit`, prettier, eslint pass - [ ] Launch desktop signed into Cloud → runner appears as `<name> · <hostname>` in the picker - [ ] Launch against a local server → runner appears as `Electric Desktop · <hostname>` - [ ] Set `pullWakeRunnerLabel` / `ELECTRIC_DESKTOP_PULL_WAKE_RUNNER_LABEL` → overrides win on next launch 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7a8f8c8 commit 12a6ee0

5 files changed

Lines changed: 35 additions & 6 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
"@electric-ax/agents-desktop": patch
3+
---
4+
5+
Give the desktop pull-wake runner a distinguishable label instead of the
6+
hardcoded `Electric Agents Desktop`, so multiple runners are easy to tell
7+
apart in the mobile/desktop runner picker. The label now defaults to
8+
`<identity> · <hostname>`, where identity is the signed-in Cloud name
9+
(falling back to email, then `Electric Desktop`). It can be overridden via
10+
the `pullWakeRunnerLabel` setting in `settings.json` or the
11+
`ELECTRIC_DESKTOP_PULL_WAKE_RUNNER_LABEL` env var. Existing runners pick up
12+
the new label automatically on next launch (registration upserts on the
13+
stable runner id).

‎packages/agents-desktop/src/runtime/lifecycle.ts‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
import path from 'node:path'
2+
import os from 'node:os'
23
import { app, powerSaveBlocker } from 'electron'
34
import { AGENT_SKILLS_DIR } from '../shared/paths'
45
import {
56
MCP_OAUTH_REDIRECT_BASE,
67
PULL_WAKE_OWNER_PRINCIPAL,
78
PULL_WAKE_REGISTER_RUNNER,
89
PULL_WAKE_RUNNER_ID,
10+
PULL_WAKE_RUNNER_LABEL,
911
RECONNECT_BASE_MS,
1012
RECONNECT_MAX_MS,
1113
} from '../shared/constants'
@@ -36,6 +38,7 @@ export type RuntimeLifecycleDeps = {
3638
workingDirectory?: string | null
3739
mcp?: { servers: Array<McpServerConfig> }
3840
pullWakeRunnerId?: string | null
41+
pullWakeRunnerLabel?: string
3942
preventAppSuspension?: boolean
4043
enabledModelValues?: Array<string>
4144
}
@@ -266,13 +269,15 @@ export async function startRuntime(
266269

267270
const serverWithPrincipal = deps.injectDevPrincipalHeaders(activeServer)
268271
const runtimeHeaders = mergeHeaders(serverWithPrincipal.headers)
269-
const cloudAuthUserId =
270-
activeServer.source === `electric-cloud`
271-
? (deps.getCloudAuthState()?.userId ?? null)
272-
: null
272+
const cloudAuthState =
273+
activeServer.source === `electric-cloud` ? deps.getCloudAuthState() : null
273274
const runnerOwnerPrincipal =
274-
runnerOwnerPrincipalFromUserId(cloudAuthUserId) ??
275+
runnerOwnerPrincipalFromUserId(cloudAuthState?.userId ?? null) ??
275276
runnerOwnerPrincipalFromHeaders(runtimeHeaders, PULL_WAKE_OWNER_PRINCIPAL)
277+
const runnerLabelPrefix =
278+
cloudAuthState?.name?.trim() ||
279+
cloudAuthState?.email?.trim() ||
280+
`Electric Desktop`
276281
console.info(
277282
`[agents-desktop] Starting built-in agents runtime for server ${activeServer.url}`
278283
)
@@ -318,7 +323,10 @@ export async function startRuntime(
318323
ownerPrincipal: PULL_WAKE_REGISTER_RUNNER
319324
? runnerOwnerPrincipal
320325
: undefined,
321-
label: `Electric Agents Desktop`,
326+
label:
327+
PULL_WAKE_RUNNER_LABEL ??
328+
deps.settings.pullWakeRunnerLabel ??
329+
`${runnerLabelPrefix} · ${os.hostname()}`,
322330
headers: runtimeHeaders,
323331
claimHeaders: runtimeHeaders,
324332
claimTokenHeader:

‎packages/agents-desktop/src/settings/store.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ export async function loadDesktopSettings(
179179
)
180180
: undefined,
181181
pullWakeRunnerId,
182+
pullWakeRunnerLabel:
183+
typeof parsed.pullWakeRunnerLabel === `string` &&
184+
parsed.pullWakeRunnerLabel.trim()
185+
? parsed.pullWakeRunnerLabel.trim()
186+
: undefined,
182187
})
183188
if (parsed.apiKeys !== undefined) {
184189
Object.assign(deps.apiKeys, normalizeApiKeys(parsed.apiKeys))

‎packages/agents-desktop/src/shared/constants.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ export const BACKGROUND_LAUNCH_ARG = `--electric-background-launch`
4444

4545
export const PULL_WAKE_RUNNER_ID =
4646
process.env.ELECTRIC_DESKTOP_PULL_WAKE_RUNNER_ID?.trim() || null
47+
export const PULL_WAKE_RUNNER_LABEL =
48+
process.env.ELECTRIC_DESKTOP_PULL_WAKE_RUNNER_LABEL?.trim() || null
4749
export const PULL_WAKE_REGISTER_RUNNER =
4850
process.env.ELECTRIC_DESKTOP_PULL_WAKE_REGISTER_RUNNER === undefined
4951
? true

‎packages/agents-desktop/src/shared/types.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ export type DesktopSettings = {
135135
mcp?: { servers: Array<McpServerConfig> }
136136
seededDefaultMcpServerNames?: Array<string>
137137
pullWakeRunnerId?: string
138+
pullWakeRunnerLabel?: string
138139
}
139140

140141
export type LaunchAtLoginStatus = {

0 commit comments

Comments
 (0)