Skip to content

The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.

Pi on a grid keeps its own home: settings, packages and the conversation across model switches (#1318)

lingrd23687b4c168b
diff --git a/cli/src/core/agents/create.ts b/cli/src/core/agents/create.ts
index 62ed42b11..fea5c9891 100644
--- a/cli/src/core/agents/create.ts
+++ b/cli/src/core/agents/create.ts
@@ -31,7 +31,7 @@ import {
import { setUpWithin } from '../../lib/setUpWithin.js'
import { agentLaunchArgs, joinedInstructions } from '../../lib/agentAttribution.js'
import { writeGridConfigDir } from '../../lib/gridConfigDir.js'
-import { describeGridLaunch, gridConflictingEnvToClear, type GridLaunchAnswer, type GridLaunchMachine, type GridLaunchRequest, type GridWebSearchStatus } from '../../lib/gridLaunchWire.js'
+import { describeGridLaunch, gridConfigHandOff, gridConflictingEnvToClear, type GridLaunchAnswer, type GridLaunchMachine, type GridLaunchRequest, type GridWebSearchStatus } from '../../lib/gridLaunchWire.js'
import { profileEnvironment } from '../../lib/engineHomes.js'
import { DEFAULT_HARNESS_PERMISSION, freshHarnessEnvironment } from '../../lib/harnessDefaults.js'
import { buildHarnessSessionLabel } from '../../lib/harnessSessionLabel.js'
@@ -256,13 +256,14 @@ export function createAgentCreator({
// An engine whose provider lives in a file gets a directory this daemon owns, never the
// user's own dotfiles. The label is unique per creation, so two agents never share one.
if (built.launch.configDir) {
- const { envVar, files, pointAt, links } = built.launch.configDir
+ const { files, links } = built.launch.configDir
try {
const publication = native && publishConfig ? await publishConfig(label, files, links, current) : null
if (publication && !native?.retain?.(publication.proof)) return stale()
const dir = publication?.directory ?? await writeGridConfigDir(label, files, links)
- // Pi is handed the directory; OpenCode's OPENCODE_CONFIG wants the file inside it.
- gridLaunch.env[envVar] = pointAt ? join(dir, pointAt) : dir
+ const handOff = gridConfigHandOff(built.launch.configDir, dir)
+ Object.assign(gridLaunch.env, handOff.env)
+ gridLaunch.args = [...gridLaunch.args, ...handOff.args]
} catch (error) {
const detail = `could not write ${engine}'s grid configuration · ${error instanceof Error ? error.message : error}`
console.warn(`[agent] create ${engine} refused · ${detail}`)
diff --git a/cli/src/core/agents/gridAssignments.spec.ts b/cli/src/core/agents/gridAssignments.spec.ts
index 1fed266b4..327e52f2b 100644
--- a/cli/src/core/agents/gridAssignments.spec.ts
+++ b/cli/src/core/agents/gridAssignments.spec.ts
@@ -1,12 +1,12 @@
import { afterEach, expect, it, vi } from 'vitest'
import { readProcessEnv } from '../../lib/processEnv.js'
-import { processArgs } from '../../lib/tmux.js'
+import { processLaunchArgs } from '../../lib/tmux.js'
import type { RegisteredSession } from '../../lib/registry.js'
import type { DiscoveredTerminalAgent } from '../../lib/terminalAgentDiscovery.js'
import { createGridAssignments } from './gridAssignments.js'
vi.mock('../../lib/processEnv.js', () => ({ readProcessEnv: vi.fn(async () => ({ ANTHROPIC_BASE_URL: 'https://grid.example/relay' })) }))
-vi.mock('../../lib/tmux.js', () => ({ processArgs: vi.fn(async () => '') }))
+vi.mock('../../lib/tmux.js', () => ({ processLaunchArgs: vi.fn(async () => '') }))
const assignment = { baseUrl: 'https://grid.example/relay', model: 'chosen' }
const row = (id = 'a'): RegisteredSession => ({ agentId: id, engine: 'claude', sessionId: 'session', registeredAt: 1, boundAt: 2,
active: true, primaryRuntimeKey: 'tmux:%1', processIdentity: { pid: 123, startMarker: 'start', executable: 'claude' },
@@ -111,7 +111,7 @@ it('refreshes a committed swap in the background, with the same stale-answer gua
s.service.refresh(s.rows[0])
await flush()
expect(readProcessEnv).toHaveBeenCalledWith(s.rows[0].processIdentity)
- expect(processArgs).toHaveBeenCalledWith(s.rows[0].processIdentity)
+ expect(processLaunchArgs).toHaveBeenCalledWith(s.rows[0].processIdentity)
s.answer()
await flush()
expect(s.rows[0].grid).toBeNull()
@@ -150,7 +150,7 @@ it('an unreadable or rejected process read keeps the assignment; a confirmed pla
s.service.refresh(s.rows[0])
await flush()
expect(s.rows[0].grid).toEqual(assignment)
- vi.mocked(processArgs).mockRejectedValueOnce(new Error('gone'))
+ vi.mocked(processLaunchArgs).mockRejectedValueOnce(new Error('gone'))
s.service.refresh(s.rows[0])
await flush()
expect(s.rows[0].grid).toEqual(assignment)
@@ -160,3 +160,25 @@ it('an unreadable or rejected process read keeps the assignment; a confirmed pla
expect(s.rows[0].grid).toBeNull()
expect(s.models.gridAssignments).not.toHaveBeenCalled()
})
+
+it("reads a Pi whose environment cannot be read from how it was launched, and only when that names a grid", async () => {
+ // Pi renames its process, and `ps` then shows neither its environment nor its argv (2026-10-14): what is left is
+ // its launcher's command line. Moved onto a grid, that names the extension, and the switch is confirmed at once.
+ const s = setup()
+ s.rows[0] = { ...s.rows[0], engine: 'pi', grid: undefined }
+ vi.mocked(readProcessEnv).mockResolvedValueOnce(null)
+ vi.mocked(processLaunchArgs).mockResolvedValueOnce("zsh -lic . 'launch.sh' harness-engine /w /bin/pi --session s --model grid/chosen -e /c/grid-provider.ts")
+ s.service.refresh(s.rows[0])
+ await flush()
+ expect(s.pending[0].processes).toEqual([{ key: expect.any(String), engine: 'pi', env: {}, args: '-e /c/grid-provider.ts --model grid/chosen' }])
+ s.answer(0, assignment)
+ await flush()
+ expect(s.rows[0].grid).toEqual(assignment)
+ // A launch naming no grid says nothing about an environment that could not be read: still not known.
+ vi.mocked(readProcessEnv).mockResolvedValueOnce(null)
+ vi.mocked(processLaunchArgs).mockResolvedValueOnce('zsh -lic . launch.sh harness-engine /w /bin/pi --session s')
+ s.service.refresh(s.rows[0])
+ await flush()
+ expect(s.rows[0].grid).toEqual(assignment)
+ expect(s.models.gridAssignments).toHaveBeenCalledOnce()
+})
diff --git a/cli/src/core/agents/gridAssignments.ts b/cli/src/core/agents/gridAssignments.ts
index c8ea86e52..75ce352e1 100644
--- a/cli/src/core/agents/gridAssignments.ts
+++ b/cli/src/core/agents/gridAssignments.ts
@@ -1,12 +1,12 @@
/** Optional model metadata follows discovery; it never owns a binding or delays session control. */
import type { ModelsPort } from '../api.js'
-import { gridAssignmentAnswersIn, gridAssignmentProcess, sameGridAssignment,
+import { gridAssignmentAnswersIn, gridAssignmentEvidence, sameGridAssignment,
type GridAssignment, type GridAssignmentProcess } from '../../lib/gridAssignmentWire.js'
import { readProcessEnv } from '../../lib/processEnv.js'
import type { RegisteredSession, registry as Registry } from '../../lib/registry.js'
import type { DiscoveredTerminalAgent } from '../../lib/terminalAgentDiscovery.js'
import { sameProcessIdentity } from '../../lib/terminalRuntime.js'
-import { processArgs } from '../../lib/tmux.js'
+import { processLaunchArgs } from '../../lib/tmux.js'
export interface GridAssignmentsDeps {
models: () => Pick<ModelsPort, 'gridAssignments'>
@@ -82,11 +82,11 @@ export function createGridAssignments({ models, registry, revision, announce, wa
const owner = ticket(session, 'refresh')
if (!owner) return
const identity = session.processIdentity
- void Promise.all([readProcessEnv(identity), processArgs(identity)]).then(([env, args]) => {
- if (!env) { owner.done(); return }
- const process = gridAssignmentProcess(owner.key, session.engine, env, args)
+ void Promise.all([readProcessEnv(identity), processLaunchArgs(identity)]).then(([env, args]) => {
+ const process = gridAssignmentEvidence(owner.key, session.engine, env, args)
if (process) ask([{ owner, process }])
- else { owner.apply(null); owner.done() }
+ else if (process === null) { owner.apply(null); owner.done() }
+ else owner.done()
}).catch(() => { owner.done() })
},
}
diff --git a/cli/src/core/agents/launch.spec.ts b/cli/src/core/agents/launch.spec.ts
index 851ff1935..9677837f7 100644
--- a/cli/src/core/agents/launch.spec.ts
+++ b/cli/src/core/agents/launch.spec.ts
@@ -1,5 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest'
import { prepareResume } from '../../engines/launchPrep.js'
+import { bringPiSessionHome } from '../../lib/piSessionHome.js'
import type { GridLaunchAnswer, GridLaunchOverride, GridLaunchRequest } from '../../lib/gridLaunchWire.js'
import { dropPermissionFlagIfUnsupported } from '../../lib/engineLaunch.js'
import { buildLaunchOverrides, type LaunchOverrides, type LaunchOverridesDeps } from '../../lib/launchOverrides.js'
@@ -9,6 +10,7 @@ import type { RegisteredSession } from '../../lib/registry.js'
import { createLaunchHelpers, gridLaunchThrough, type LaunchHelperDeps } from './launch.js'
vi.mock('../../engines/launchPrep.js', async (real) => ({ ...await real<object>(), prepareResume: vi.fn(() => ({ repairedItems: 0 })) }))
+vi.mock('../../lib/piSessionHome.js', () => ({ bringPiSessionHome: vi.fn(() => null) }))
vi.mock('../../lib/engineLaunch.js', async (real) => ({ ...await real<object>(), dropPermissionFlagIfUnsupported: vi.fn() }))
// OpenCode's version is its own code, loaded for an OpenCode relaunch alone; a test may say it could not be.
vi.mock('../../engines/inProcess.js', async (real) => {
@@ -175,6 +177,46 @@ describe('relaunch helpers', () => {
'[resume] repaired 1 Codex reasoning items · backup: /b/rollout.bak',
])
})
+
+ it("brings a Pi conversation an older grid launch left in the daemon's folder home before it resumes", () => {
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {})
+ const { helpers } = setup()
+ const old = '/data/grid-launch-config/c88e/sessions/--w--/s1.jsonl'
+ const pi = session({ engine: 'pi', transcriptPath: old })
+ vi.stubEnv('PI_CODING_AGENT_SESSION_DIR', '')
+ vi.stubEnv('PI_CODING_AGENT_DIR', '')
+ vi.mocked(bringPiSessionHome).mockReturnValueOnce('/home/.pi/agent/sessions/--w--/s1.jsonl')
+ helpers.prepareSessionResume(pi)
+ const [path, roots, sessions] = vi.mocked(bringPiSessionHome).mock.calls[0]!
+ expect(path).toBe(old)
+ expect(roots.map((root) => root.split('/').at(-1))).toEqual(['grid-engine-config', 'grid-launch-config'])
+ expect(sessions).toMatch(/\/agent\/sessions$/)
+ // Pi's own variables move where it keeps sessions, as they move where Pi looks for them.
+ vi.stubEnv('PI_CODING_AGENT_DIR', '/moved/agent')
+ helpers.prepareSessionResume(pi)
+ expect(vi.mocked(bringPiSessionHome).mock.calls[1]![2]).toBe('/moved/agent/sessions')
+ vi.stubEnv('PI_CODING_AGENT_SESSION_DIR', '/moved/sessions')
+ vi.mocked(bringPiSessionHome).mockReturnValueOnce(old)
+ helpers.prepareSessionResume(pi)
+ expect(vi.mocked(bringPiSessionHome).mock.calls[2]![2]).toBe('/moved/sessions')
+ // Said once, for the copy; nothing for a conversation already home, or another engine's.
+ helpers.prepareSessionResume(session({ engine: 'codex' }))
+ expect(bringPiSessionHome).toHaveBeenCalledTimes(3)
+ expect(log.mock.calls.map(([line]) => String(line))).toEqual([
+ "[resume] a1 · pi's conversation brought home · /home/.pi/agent/sessions/--w--/s1.jsonl",
+ ])
+ // A copy that fails never costs the relaunch: it runs after the old Pi stopped.
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {})
+ vi.mocked(bringPiSessionHome).mockImplementationOnce(() => { throw new Error('EACCES') })
+ expect(() => helpers.prepareSessionResume(pi)).not.toThrow()
+ vi.mocked(bringPiSessionHome).mockImplementationOnce(() => { throw 'odd' })
+ expect(() => helpers.prepareSessionResume(pi)).not.toThrow()
+ expect(warn.mock.calls.map(([line]) => String(line))).toEqual([
+ "[resume] a1 · could not bring pi's conversation home · EACCES",
+ "[resume] a1 · could not bring pi's conversation home · odd",
+ ])
+ vi.unstubAllEnvs()
+ })
})
describe('a grid launch, as the core asks the models service for it', () => {
diff --git a/cli/src/core/agents/launch.ts b/cli/src/core/agents/launch.ts
index c275adfc8..269ee5cf1 100644
--- a/cli/src/core/agents/launch.ts
+++ b/cli/src/core/agents/launch.ts
@@ -7,7 +7,11 @@ import type { NativeLaunch } from '../../engines/nativeLaunch.js'
*
* Moved verbatim out of `runForeground` (the core boundary, step 10: docs/design/2026-10-03-harnessd.md).
*/
+import { join } from 'node:path'
+import { env } from '../../config/env.js'
import { prepareResume, repairedItemsName } from '../../engines/launchPrep.js'
+import { bringPiSessionHome } from '../../lib/piSessionHome.js'
+import { gridConfigRoot } from '../../lib/gridConfigDir.js'
import { dropPermissionFlagIfUnsupported } from '../../lib/engineLaunch.js'
import { gridUnavailable, type GridLaunchAnswer, type GridLaunchRequest } from '../../lib/gridLaunchWire.js'
import { buildLaunchOverrides, type LaunchOverrides, type LaunchOverridesDeps, type LaunchOverridesResult, type LaunchSource } from '../../lib/launchOverrides.js'
@@ -112,6 +116,19 @@ export function createLaunchHelpers({ authority, prepareApiTools, launchOverride
}
const prepareSessionResume = (session: RegisteredSession): void => {
+ if (session.engine === 'pi') {
+ // A Pi an older grid launch moved into the daemon's own folder resumes from its own home now.
+ const roots = [gridConfigRoot(), join(env.ADAPTER_DATA_DIR, 'grid-launch-config')]
+ const sessions = process.env.PI_CODING_AGENT_SESSION_DIR || join(process.env.PI_CODING_AGENT_DIR || join(env.PI_HOME, 'agent'), 'sessions')
+ // Best effort: this runs after the old Pi has stopped, and a copy that cannot be made must not cost the
+ // relaunch. Pi then resumes what it can find, as it did before.
+ try {
+ const home = bringPiSessionHome(session.transcriptPath, roots, sessions)
+ if (home && home !== session.transcriptPath) console.log(`[resume] ${sid(session.agentId)} · pi's conversation brought home · ${home}`)
+ } catch (error) {
+ console.warn(`[resume] ${sid(session.agentId)} · could not bring pi's conversation home · ${error instanceof Error ? error.message : error}`)
+ }
+ }
const repair = prepareResume(session)
if (repair.repairedItems) {
// The rollout we tail was just shrunk in place. Move the tail to the repaired length now, before
diff --git a/cli/src/core/agents/restart.spec.ts b/cli/src/core/agents/restart.spec.ts
index b16b33fac..ec2fce307 100644
--- a/cli/src/core/agents/restart.spec.ts
+++ b/cli/src/core/agents/restart.spec.ts
@@ -7,7 +7,7 @@ import { probeGatewayRuntime } from '../../lib/gatewayRuntime.js'
import type { RegisteredSession } from '../../lib/registry.js'
import { AgentRestartCoordinator, bypassPermissionFor, restartAgent } from '../../lib/restartAgent.js'
import { terminalRouteKey } from '../../lib/terminalRuntime.js'
-import { clearPaneRemainOnExit, processArgs } from '../../lib/tmux.js'
+import { clearPaneRemainOnExit, processLaunchArgs } from '../../lib/tmux.js'
import { workspaceMissing } from '../../lib/workspaceCheck.js'
import { createAgentRestarter, type RestartDeps } from './restart.js'
@@ -25,7 +25,7 @@ vi.mock('../../lib/restartAgent.js', async (real) => ({
}))
vi.mock('../../lib/tmux.js', async (real) => ({
...await real<object>(), clearPaneRemainOnExit: vi.fn(async () => {}),
- processArgs: vi.fn(async () => '/bin/claude --model opus -c model_provider=grid'),
+ processLaunchArgs: vi.fn(async () => '/bin/claude --model opus -c model_provider=grid'),
}))
vi.mock('../../lib/workspaceCheck.js', () => ({ workspaceMissing: vi.fn(() => null) }))
diff --git a/cli/src/core/agents/retarget.spec.ts b/cli/src/core/agents/retarget.spec.ts
index 3d0f27d9e..9a4027d7d 100644
--- a/cli/src/core/agents/retarget.spec.ts
+++ b/cli/src/core/agents/retarget.spec.ts
@@ -38,7 +38,7 @@ vi.mock('../../lib/restartAgent.js', async (real) => ({
vi.mock('../../lib/runtimeProfileWire.js', async (real) => ({ ...await real<object>(), parseRuntimeProfile: vi.fn(() => ({ engine: 'claude', model: 'opus' })) }))
vi.mock('../../lib/tmux.js', async (real) => ({
...await real<object>(), clearPaneRemainOnExit: vi.fn(async () => {}),
- processArgs: vi.fn(async () => 'codex -c model_providers.grid.base_url=http://grid.local/v1'),
+ processLaunchArgs: vi.fn(async () => 'codex -c model_providers.grid.base_url=http://grid.local/v1'),
}))
vi.mock('../../lib/workspaceCheck.js', () => ({ workspaceMissing: vi.fn(() => null) }))
diff --git a/cli/src/core/main.ts b/cli/src/core/main.ts
index 0eac2d835..6650af8a9 100644
--- a/cli/src/core/main.ts
+++ b/cli/src/core/main.ts
@@ -2096,10 +2096,7 @@ async function runForeground(session: AuthSession | null): Promise<void> {
const gridLaunchMachine = async (engine: AgentEngine, native?: NativeLaunch): Promise<GridLaunchMachine> => ({
hermesSystemManaged: existsSync(HERMES_SYSTEM_MANAGED_DIR),
opencodeMajor: native ? native.opencodeMajor : engine === 'opencode' ? await opencodeMajorVersion() : null,
- ...(native?.environment.HOME ? {
- grokHome: nativeHookLocations(native.environment).GROK_HOME,
- piSkillsDir: join(nativeHookLocations(native.environment).PI_AGENT_DIR, 'skills'),
- } : {}),
+ ...(native?.environment.HOME ? { grokHome: nativeHookLocations(native.environment).GROK_HOME } : {}),
})
/**
diff --git a/cli/src/core/modelsLink.spec.ts b/cli/src/core/modelsLink.spec.ts
index 9f65d414a..77f6a96f3 100644
--- a/cli/src/core/modelsLink.spec.ts
+++ b/cli/src/core/modelsLink.spec.ts
@@ -120,6 +120,8 @@ describe('models in its own process, as the core reaches it', () => {
const withFiles = { ...built, launch: { ...launch, configDir: files }, apiBase: RELAY }
expect(await setup({ gridLaunch: withFiles }).port.gridLaunch(request)).toEqual(withFiles)
expect(await setup({ gridLaunch: { ...built, launch: { ...launch, configDir: { envVar: 'PI', files: [] } } } }).port.gridLaunch(request)).toMatchObject({ ok: true })
+ const flag = { ...built, launch: { ...launch, configDir: { arg: '-e', files: [{ name: 'grid-provider.ts', content: '' }], pointAt: 'grid-provider.ts' } } }
+ expect(await setup({ gridLaunch: flag }).port.gridLaunch(request)).toEqual(flag)
const refused = { ok: false, error: 'GRID_ENGINE_UNSUPPORTED', detail: 'no grid for amp', apiBase: RELAY }
expect(await setup({ gridLaunch: refused }).port.gridLaunch(request)).toEqual(refused)
expect(await setup({ gridLaunch: { ok: false, error: 'API_UNAVAILABLE', detail: 'gone' } }).port.gridLaunch(request)).toEqual({ ok: false, error: 'API_UNAVAILABLE', detail: 'gone' })
@@ -133,6 +135,9 @@ describe('models in its own process, as the core reaches it', () => {
{ ...built, launch: { ...launch, configDir: { ...files, files: [null] } } },
{ ...built, launch: { ...launch, configDir: { ...files, pointAt: 7 } } }, { ...built, launch: { ...launch, configDir: { ...files, links: 'x' } } },
{ ...built, launch: { ...launch, configDir: { ...files, links: [{ name: 'a' }] } } }, { ...built, launch: { ...launch, configDir: { ...files, links: [null] } } },
+ // Pointed at by a variable or a flag: neither, both, or a flag that is not text is no launch.
+ { ...built, launch: { ...launch, configDir: { files: [] } } }, { ...built, launch: { ...launch, configDir: { ...files, arg: '-e' } } },
+ { ...built, launch: { ...launch, configDir: { arg: 7, files: [] } } },
]
for (const answer of unusable) await expect(setup({ gridLaunch: answer }).port.gridLaunch(request), JSON.stringify(answer)).rejects.toBeInstanceOf(ServiceUnavailableError)
await expect(setup().port.gridLaunch(request)).rejects.toBeInstanceOf(ServiceUnavailableError)
diff --git a/cli/src/core/modelsLink.ts b/cli/src/core/modelsLink.ts
index 4047d7880..7ce2c4984 100644
--- a/cli/src/core/modelsLink.ts
+++ b/cli/src/core/modelsLink.ts
@@ -77,7 +77,10 @@ function engineLaunchIn(value: unknown): GridEngineLaunch | null {
if (value.sessionModel !== undefined && !isText(value.sessionModel)) return null
const dir = value.configDir
if (dir !== undefined) {
- if (!isRecord(dir) || !isText(dir.envVar) || !Array.isArray(dir.files)) return null
+ if (!isRecord(dir) || !Array.isArray(dir.files)) return null
+ // Pointed at by exactly one of a variable or a flag (`GridEngineLaunch.configDir`).
+ const pointers = [dir.envVar, dir.arg].filter((pointer) => pointer !== undefined)
+ if (pointers.length !== 1 || !isText(pointers[0])) return null
if (!dir.files.every((file) => isRecord(file) && isText(file.name) && isText(file.content))) return null
if (dir.pointAt !== undefined && !isText(dir.pointAt)) return null
if (dir.links !== undefined && !(Array.isArray(dir.links) && dir.links.every((link) => isRecord(link) && isText(link.name) && isText(link.target)))) return null
diff --git a/cli/src/engines/__fixtures__/launch-argv.golden.json b/cli/src/engines/__fixtures__/launch-argv.golden.json
index 35c48f22e..da9d0a714 100644
--- a/cli/src/engines/__fixtures__/launch-argv.golden.json
+++ b/cli/src/engines/__fixtures__/launch-argv.golden.json
@@ -1098,12 +1098,12 @@
"opencode · harness on a grid, as git, as a named agent": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","OPENCODE_CONFIG":"/state/grid-engine-config/agent-0001/opencode.json","HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/agent-0001/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["-m","team-grid/gpt-5","--studio","--agent","harness-compute"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unavailable"},"sessionModel":"team-grid/gpt-5"}},"calls":["writeGridConfigDir agent-0001 opencode.json","dshLaunch acme/studio /work/studio opencode agent-0001"]},
"pi · own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
"pi · own login, its model back": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":[]},
- "pi · grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","PI_CODING_AGENT_DIR":"/state/grid-engine-config/agent-0001"},"extraArgs":["--model","grid/gpt-5"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 models.json,settings.json"]},
- "pi · grid with web tools and a window": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","PI_CODING_AGENT_DIR":"/state/grid-engine-config/agent-0001"},"extraArgs":["--model","grid/gpt-5"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 models.json,settings.json"]},
- "pi · saved API": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"sk-or-1","PI_CODING_AGENT_DIR":"/state/grid-engine-config/agent-0001"},"extraArgs":["--model","grid/qwen/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:openrouter","networkName":"OpenRouter","baseUrl":"https://openrouter.ai/api/v1","apiKey":"sk-or-1","model":"qwen/qwen3-coder"},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 models.json,settings.json"]},
+ "pi · grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123"},"extraArgs":["--model","grid/gpt-5","-e","/state/grid-engine-config/agent-0001/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 grid-provider.ts"]},
+ "pi · grid with web tools and a window": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123"},"extraArgs":["--model","grid/gpt-5","-e","/state/grid-engine-config/agent-0001/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 grid-provider.ts"]},
+ "pi · saved API": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"sk-or-1"},"extraArgs":["--model","grid/qwen/qwen3-coder","-e","/state/grid-engine-config/agent-0001/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:openrouter","networkName":"OpenRouter","baseUrl":"https://openrouter.ai/api/v1","apiKey":"sk-or-1","model":"qwen/qwen3-coder"},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 grid-provider.ts"]},
"pi · harness": {"result":{"ok":true,"overrides":{"env":{"HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/harness-runtime-1/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["--studio","--append-system-prompt","/work/studio/.harness/runtime/harness-runtime-1/CONTEXT.md"],"clearEnv":["HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["dshLaunch acme/studio /work/studio pi harness-runtime-1"]},
"pi · harness without a workspace": {"result":{"ok":false,"error":"DSH_WORKSPACE_MISSING","detail":"acme/studio has no saved workspace"},"calls":[]},
- "pi · harness on a grid, as git, as a named agent": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","PI_CODING_AGENT_DIR":"/state/grid-engine-config/agent-0001","HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/agent-0001/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["--model","grid/gpt-5","--studio","--append-system-prompt","/work/studio/.harness/runtime/agent-0001/CONTEXT.md"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 models.json,settings.json","dshLaunch acme/studio /work/studio pi agent-0001"]},
+ "pi · harness on a grid, as git, as a named agent": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"gridkey-abc123","HARNESS_DSH":"acme/studio","HARNESS_WORKSPACE":"/work/studio","HARNESS_CONTEXT_FILE":"/work/studio/.harness/runtime/agent-0001/CONTEXT.md","STUDIO_MODE":"pro \"x\""},"extraArgs":["--model","grid/gpt-5","-e","/state/grid-engine-config/agent-0001/grid-provider.ts","--studio","--append-system-prompt","/work/studio/.harness/runtime/agent-0001/CONTEXT.md"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH_DIR","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"grid-abc","networkName":"Team grid","baseUrl":"https://grid.example/grid-abc/relay/v1","apiKey":"gridkey-abc123","model":"gpt-5"},"webSearch":"unsupported"}}},"calls":["writeGridConfigDir agent-0001 grid-provider.ts","dshLaunch acme/studio /work/studio pi agent-0001"]},
"codex · own login · no config": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig <home>/.codex/config.toml"]},
"codex · profile · no config": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"/profiles/work"},"extraArgs":["-c","model_provider=\"openai\""],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig /profiles/work/config.toml","installCodexHooks /profiles/work"]},
"codex · profile, its model back · no config": {"result":{"ok":true,"overrides":{"env":{"CODEX_HOME":"/profiles/work"},"extraArgs":["-c","model_provider=\"openai\"","-m","gpt-5.5"],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"calls":["readCodexConfig /profiles/work/config.toml","installCodexHooks /profiles/work"]},
diff --git a/cli/src/engines/__fixtures__/launch-shapes.golden.json b/cli/src/engines/__fixtures__/launch-shapes.golden.json
index 65ce1e28f..3b10c020b 100644
--- a/cli/src/engines/__fixtures__/launch-shapes.golden.json
+++ b/cli/src/engines/__fixtures__/launch-shapes.golden.json
@@ -4,7 +4,7 @@
"codex · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w2","codex","-c","tui.fullscreen_transcript=false","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"script":"6ab77b8b7f29b922","env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · qwen3-coder · web search on"]},
"cursor · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create cursor refused · cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
"opencode · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w4","opencode","--standalone"],"script":"bdaa225516c166f5","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
- "pi · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w5","pi","--model","grid/qwen3-coder"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w5","pi","--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
"hermes · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w6","hermes","-m","qwen3-coder"],"script":"740e05707feea22c","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search on"]},
"commandcode · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create commandcode refused · commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
"devin · grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"pane":null,"config":null,"folder":{},"logged":["[agent] create devin refused · devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."]},
@@ -24,9 +24,9 @@
"opencode · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w22","opencode","--standalone"],"script":"bdaa225516c166f5","env":{"GRID_API_KEY":"grid-key-2","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/Auto\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"Auto\": {\n \"name\": \"Auto\"\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · model chosen by the engine · web search unavailable"]},
"opencode · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w23","opencode","-m","home/qwen3-coder"],"script":"bdaa225516c166f5","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
"opencode · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w24","opencode","--standalone"],"script":"bdaa225516c166f5","env":{"GRID_API_KEY":"stale-key","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"api-router/vendor/model-a\",\n \"provider\": {\n \"api-router\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Router\",\n \"options\": {\n \"baseURL\": \"http://127.0.0.1:<port>/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"vendor/model-a\": {\n \"name\": \"vendor/model-a\",\n \"limit\": {\n \"context\": 200000,\n \"output\": 32000\n }\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Router (api:router) · vendor/model-a · web search unavailable"]},
- "pi · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w25","pi","--model","grid/Auto"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"grid-key-2","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)"]},
- "pi · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w26","pi","--model","grid/qwen3-coder"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
- "pi · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w27","pi","--model","grid/vendor/model-a"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"stale-key","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w25","pi","--model","grid/Auto","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w26","pi","--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "pi · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w27","pi","--model","grid/vendor/model-a","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"f29d3fd335553d90","env":{"GRID_API_KEY":"stale-key"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)"]},
"hermes · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w28","hermes"],"script":"0e91c2ae7b92a265","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · model chosen by the engine · web search unavailable"]},
"hermes · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w29","hermes","-m","qwen3-coder"],"script":"2b297e5899feaf9a","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search unsupported (/etc/hermes pins this machine's Hermes settings, and the overlay carrying the web tools would replace it)"]},
"hermes · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w30","hermes","-m","vendor/model-a"],"script":"2b297e5899feaf9a","env":{"OPENAI_BASE_URL":"http://127.0.0.1:<port>/v1","OPENAI_API_KEY":"stale-key","HERMES_INFERENCE_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Router (api:router) · vendor/model-a · web search unavailable"]},
@@ -49,7 +49,7 @@
"codex · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"extraArgs":["-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] codex -> Home (net-home) · qwen3-coder · web search on","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"cursor · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"cursor cannot run on grid Home: Cursor Agent can only be re-pointed at another Cursor API (CURSOR_API_ENDPOINT), not at an OpenAI-compatible relay. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"opencode · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "pi · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1"},"extraArgs":["--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/agent-pi/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"hermes · restart on a grid": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/agent-hermes"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_MCP_AUTHORIZATION","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}}},"retargetLine":"[grid] hermes -> Home (net-home) · qwen3-coder · web search on","config":{"agent-hermes":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"commandcode · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"commandcode cannot run on grid Home: Command Code documents no way to change its endpoint. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"devin · restart on a grid": {"result":{"ok":false,"error":"GRID_ENGINE_UNSUPPORTED","detail":"devin cannot run on grid Home: Devin runs on its own hosted service and documents no endpoint override. It would have run on its own login instead. Engines that can: claude, codex, opencode, hermes, grok, pi, copilot."},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
@@ -78,12 +78,12 @@
"opencode · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"opencode · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"opencode · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/agent-opencode/opencode.json"},"extraArgs":["--standalone"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"},"sessionModel":"home/qwen3-coder"}},"retargetLine":"[grid] opencode -> Home (net-home) · qwen3-coder · web search on","config":{"agent-opencode":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "pi · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-2","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/Auto"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "pi · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "pi · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"fresh-key","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/vendor/model-a"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "pi · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-2"},"extraArgs":["--model","grid/Auto","-e","<root>/data/grid-engine-config/agent-pi/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1"},"extraArgs":["--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/agent-pi/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"fresh-key"},"extraArgs":["--model","grid/vendor/model-a","-e","<root>/data/grid-engine-config/agent-pi/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · retarget onto a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1"},"extraArgs":["--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/agent-pi/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"pi · retarget back to the own login": {"result":{"ok":true,"overrides":{"env":{},"extraArgs":[],"clearEnv":["HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"]}},"retargetLine":null,"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
- "pi · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/agent-pi"},"extraArgs":["--model","grid/qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
+ "pi · fork on a grid": {"result":{"ok":true,"overrides":{"env":{"GRID_API_KEY":"grid-key-1"},"extraArgs":["--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/agent-pi/grid-provider.ts"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","OPENAI_API_KEY","OPENAI_BASE_URL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)","config":{"agent-pi":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"hermes · restart on a grid without a model": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-2"},"extraArgs":[],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","HERMES_INFERENCE_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}}},"retargetLine":"[grid] hermes -> Home (net-home) · model chosen by the engine · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"hermes · restart on a grid · another machine": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder"},"extraArgs":["-m","qwen3-coder"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}}},"retargetLine":"[grid] hermes -> Home (net-home) · qwen3-coder · web search unsupported (/etc/hermes pins this machine's Hermes settings, and the overlay carrying the web tools would replace it)","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
"hermes · restart on a saved API, its key as saved now": {"result":{"ok":true,"overrides":{"env":{"OPENAI_BASE_URL":"http://127.0.0.1:<port>/v1","OPENAI_API_KEY":"fresh-key","HERMES_INFERENCE_MODEL":"vendor/model-a"},"extraArgs":["-m","vendor/model-a"],"clearEnv":["ANTHROPIC_API_KEY","ANTHROPIC_AUTH_TOKEN","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","XAI_API_KEY","GROK_MODELS_BASE_URL","COPILOT_PROVIDER_API_KEY","COPILOT_PROVIDER_BASE_URL","COPILOT_MODEL","GRID_API_KEY","GRID_MCP_AUTHORIZATION","HERMES_MANAGED_DIR","GROK_HOME","HARNESS_DSH","HARNESS_DSH_DIR","HARNESS_WORKSPACE","HARNESS_CONTEXT_FILE","HARNESS_SKILLS_DIR","HARNESS_PRIVATE_GRID"],"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"fresh-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}}},"retargetLine":"[grid] hermes -> Router (api:router) · vendor/model-a · web search unavailable","config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":[]},
@@ -128,7 +128,7 @@
"leaving a grid · opencode": ["GRID_API_KEY","OPENCODE_CONFIG"],
"validate · pi · grid": {"ok":true},
"validate · pi · own login": {"ok":true},
- "leaving a grid · pi": ["GRID_API_KEY","PI_CODING_AGENT_DIR"],
+ "leaving a grid · pi": ["GRID_API_KEY"],
"validate · hermes · grid": {"ok":true},
"validate · hermes · own login": {"ok":true},
"leaving a grid · hermes": ["OPENAI_BASE_URL","OPENAI_API_KEY","HERMES_INFERENCE_MODEL","GRID_API_KEY","HERMES_MANAGED_DIR"],
@@ -182,7 +182,7 @@
"claude · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w1","claude","--disallowedTools=WebSearch,WebFetch","--mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}","--allowedTools=mcp__harness__web_search,mcp__harness__web_read","--system-prompt-snapshot","off","--append-system-prompt","Web tools in this session come from the `harness` MCP server only: `mcp__harness__web_search` searches the web and `mcp__harness__web_read` reads pages. The built-in `WebSearch` and `WebFetch` tools are not available in this session, even where earlier turns of this conversation used them — do not call them; call the `harness` tools instead."],"script":"0a63f835ea505d44","env":{"ANTHROPIC_BASE_URL":"https://grid.example/g/home/relay","ANTHROPIC_AUTH_TOKEN":"grid-key-1","ANTHROPIC_MODEL":"qwen3-coder","CLAUDE_CODE_MAX_CONTEXT_TOKENS":"131072","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"CLAUDE.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] claude -> Home (net-home) · qwen3-coder · web search on"]},
"codex · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w2","codex","-c","tui.fullscreen_transcript=false","-c","model_provider=\"grid\"","-c","model_providers.grid.name=\"Autonomous Grid\"","-c","model_providers.grid.base_url=\"https://grid.example/g/home/relay/v1\"","-c","model_providers.grid.env_key=\"GRID_API_KEY\"","-c","model_providers.grid.wire_api=\"responses\"","-c","model_providers.grid.supports_websockets=false","-c","web_search=\"disabled\"","-c","mcp_servers.harness.url=\"https://control.example/v1/grid/web-mcp/\"","-c","mcp_servers.harness.env_http_headers.Authorization=\"GRID_MCP_AUTHORIZATION\"","-m","qwen3-coder","-c","model_context_window=131072","-c","model_auto_compact_token_limit=117964"],"script":"e164792ba440fbaa","env":{"GRID_API_KEY":"grid-key-1","GRID_MCP_AUTHORIZATION":"Bearer grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] codex -> Home (net-home) · qwen3-coder · web search on"]},
"opencode · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w4","opencode","--standalone"],"script":"0e61f976b4864c3a","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/qwen3-coder\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
- "pi · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w5","pi","--model","grid/qwen3-coder"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w5","pi","--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
"hermes · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w6","hermes","-m","qwen3-coder"],"script":"29aff01c2e7af91b","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1","HERMES_MANAGED_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.yaml":{"mode":"600","text":"{\n \"mcp_servers\": {\n \"harness\": {\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"headers\": {\n \"Authorization\": \"Bearer ${GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search on"]},
"grok · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w12","grok","-m","qwen3-coder"],"script":"130c1753c9d0827e","env":{"GROK_MODELS_BASE_URL":"https://grid.example/g/home/relay/v1","XAI_API_KEY":"grid-key-1","GRID_API_KEY":"grid-key-1","GROK_HOME":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"config.toml":{"mode":"600","text":"[model.\"qwen3-coder\"]\nmodel = \"qwen3-coder\"\nbase_url = \"https://grid.example/g/home/relay/v1\"\nenv_key = \"GRID_API_KEY\"\n\n[mcp_servers.harness]\nurl = \"https://control.example/v1/grid/web-mcp/\"\nheaders = { Authorization = \"Bearer ${GRID_API_KEY}\" }\n"},"sessions":{"link":"<root>/home/.grok/sessions"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] grok -> Home (net-home) · qwen3-coder · web search on"]},
"copilot · grid": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w14","copilot","--additional-mcp-config","{\"mcpServers\":{\"harness\":{\"type\":\"http\",\"url\":\"https://control.example/v1/grid/web-mcp/\",\"headers\":{\"Authorization\":\"Bearer ${GRID_API_KEY}\"}}}}"],"script":"c8861a6bd8c5794e","env":{"COPILOT_PROVIDER_BASE_URL":"https://grid.example/g/home/relay/v1","COPILOT_PROVIDER_API_KEY":"grid-key-1","COPILOT_MODEL":"qwen3-coder","GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] copilot -> Home (net-home) · qwen3-coder · web search on"]},
@@ -195,9 +195,9 @@
"opencode · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w22","opencode","--standalone"],"script":"0e61f976b4864c3a","env":{"GRID_API_KEY":"grid-key-2","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"home/Auto\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"Auto\": {\n \"name\": \"Auto\"\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · model chosen by the engine · web search unavailable"]},
"opencode · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w23","opencode","-m","home/qwen3-coder"],"script":"0e61f976b4864c3a","env":{"GRID_API_KEY":"grid-key-1","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"on"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"provider\": {\n \"home\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Home\",\n \"options\": {\n \"baseURL\": \"https://grid.example/g/home/relay/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"qwen3-coder\": {\n \"name\": \"qwen3-coder\",\n \"limit\": {\n \"context\": 131072,\n \"output\": 32000\n }\n }\n }\n }\n },\n \"mcp\": {\n \"harness\": {\n \"type\": \"remote\",\n \"url\": \"https://control.example/v1/grid/web-mcp/\",\n \"enabled\": true,\n \"headers\": {\n \"Authorization\": \"Bearer {env:GRID_API_KEY}\"\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Home (net-home) · qwen3-coder · web search on"]},
"opencode · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w24","opencode","--standalone"],"script":"0e61f976b4864c3a","env":{"GRID_API_KEY":"stale-key","OPENCODE_CONFIG":"<root>/data/grid-engine-config/<label>/opencode.json"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":{"<label>":{"dir":{"opencode.json":{"mode":"600","text":"{\n \"$schema\": \"https://opencode.ai/config.json\",\n \"model\": \"api-router/vendor/model-a\",\n \"provider\": {\n \"api-router\": {\n \"npm\": \"@ai-sdk/openai-compatible\",\n \"name\": \"Router\",\n \"options\": {\n \"baseURL\": \"http://127.0.0.1:<port>/v1\",\n \"apiKey\": \"{env:GRID_API_KEY}\"\n },\n \"models\": {\n \"vendor/model-a\": {\n \"name\": \"vendor/model-a\",\n \"limit\": {\n \"context\": 200000,\n \"output\": 32000\n }\n }\n }\n }\n }\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] opencode -> Router (api:router) · vendor/model-a · web search unavailable"]},
- "pi · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w25","pi","--model","grid/Auto"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"grid-key-2","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)"]},
- "pi · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w26","pi","--model","grid/qwen3-coder"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"grid-key-1","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
- "pi · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w27","pi","--model","grid/vendor/model-a"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"stale-key","PI_CODING_AGENT_DIR":"<root>/data/grid-engine-config/<label>"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"models.json":{"mode":"600","text":"{\n \"providers\": {\n \"grid\": {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n }\n }\n}"},"settings.json":{"mode":"600","text":"{\n \"skills\": [\n \"<root>/home/.pi/agent/skills\"\n ]\n}"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w25","pi","--model","grid/Auto","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"Auto\",\n \"name\": \"Auto\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · model chosen by the engine · web search unsupported (Pi has no MCP client)"]},
+ "pi · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w26","pi","--model","grid/qwen3-coder","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"grid-key-1"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"https://grid.example/g/home/relay/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"qwen3-coder\",\n \"name\": \"qwen3-coder\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 131072,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Home (net-home) · qwen3-coder · web search unsupported (Pi has no MCP client)"]},
+ "pi · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w27","pi","--model","grid/vendor/model-a","-e","<root>/data/grid-engine-config/<label>/grid-provider.ts"],"script":"877330e91fe6a1d3","env":{"GRID_API_KEY":"stale-key"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unsupported"}},"config":{"<label>":{"dir":{"grid-provider.ts":{"mode":"600","text":"// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\nexport default function (pi) {\n pi.registerProvider(\"grid\", {\n \"name\": \"Autonomous Grid\",\n \"baseUrl\": \"http://127.0.0.1:<port>/v1\",\n \"api\": \"openai-completions\",\n \"apiKey\": \"$GRID_API_KEY\",\n \"models\": [\n {\n \"id\": \"vendor/model-a\",\n \"name\": \"vendor/model-a\",\n \"reasoning\": false,\n \"input\": [\n \"text\"\n ],\n \"contextWindow\": 200000,\n \"maxTokens\": 8192,\n \"cost\": {\n \"input\": 0,\n \"output\": 0,\n \"cacheRead\": 0,\n \"cacheWrite\": 0\n }\n }\n ]\n })\n}\n"}}}},"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] pi -> Router (api:router) · vendor/model-a · web search unsupported (Pi has no MCP client)"]},
"hermes · grid without a model, web tools or window": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w28","hermes"],"script":"62954db3d9e3d96e","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-2"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":null},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-2"},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · model chosen by the engine · web search unavailable"]},
"hermes · grid · another machine": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w29","hermes","-m","qwen3-coder"],"script":"8ec6e56fc3c51058","env":{"OPENAI_BASE_URL":"https://grid.example/g/home/relay/v1","OPENAI_API_KEY":"grid-key-1","HERMES_INFERENCE_MODEL":"qwen3-coder"},"grid":{"baseUrl":"https://grid.example/g/home/relay/v1","model":"qwen3-coder"},"gridLaunchRecord":{"override":{"networkId":"net-home","networkName":"Home","baseUrl":"https://grid.example/g/home/relay/v1","apiKey":"grid-key-1","model":"qwen3-coder","mcpUrl":"https://control.example/v1/grid/web-mcp/","contextWindow":131072},"webSearch":"unsupported"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Home (net-home) · qwen3-coder · web search unsupported (/etc/hermes pins this machine's Hermes settings, and the overlay carrying the web tools would replace it)"]},
"hermes · saved API": {"result":{"ok":false,"error":"RECORDED","detail":"the pane is not opened by this spec"},"pane":{"argv":["/usr/bin/env","DISABLE_AUTO_UPDATE=true","/bin/zsh","-lic",". '<root>/data/launch/<script>.sh'","harness-engine","<root>/work/w30","hermes","-m","vendor/model-a"],"script":"8ec6e56fc3c51058","env":{"OPENAI_BASE_URL":"http://127.0.0.1:<port>/v1","OPENAI_API_KEY":"stale-key","HERMES_INFERENCE_MODEL":"vendor/model-a"},"grid":{"baseUrl":"http://127.0.0.1:<port>/v1","model":"vendor/model-a"},"gridLaunchRecord":{"override":{"networkId":"api:router","networkName":"Router","baseUrl":"http://127.0.0.1:<port>/v1","apiKey":"stale-key","model":"vendor/model-a","contextWindow":200000},"webSearch":"unavailable"}},"config":null,"folder":{"AGENTS.md":{"mode":"644","text":"<!-- harness:apis -->\n## Saved APIs\n\nThe user can save API connections in Harness → Models → APIs on this computer.\nRun `harness api list --json` to discover the current connections; the list contains no keys.\nUse `harness api request <id> <path> --method POST --data @request.json` for JSON APIs,\nor `harness api run <id> -- <command> [args]` for a provider SDK/tool. The latter supplies\nthe connection's documented key variable and HARNESS_API_BASE_URL to that tool only.\nUse these APIs when needed for the user's task. Never print, paste, or save API keys in a project.\nAdding an API does not change this harness's model or subscription.\n"}},"logged":["[grid] hermes -> Router (api:router) · vendor/model-a · web search unavailable"]},
diff --git a/cli/src/engines/launchArgv.golden.spec.ts b/cli/src/engines/launchArgv.golden.spec.ts
index 5acf03ded..d0dcaf735 100644
--- a/cli/src/engines/launchArgv.golden.spec.ts
+++ b/cli/src/engines/launchArgv.golden.spec.ts
@@ -529,7 +529,7 @@ describe('every launch hands tmux what it did before Claude Code and Codex decla
'dshLaunch acme/studio /work/studio opencode agent-0001',
],
'pi · harness on a grid, as git, as a named agent': [
- 'writeGridConfigDir agent-0001 models.json,settings.json',
+ 'writeGridConfigDir agent-0001 grid-provider.ts',
'dshLaunch acme/studio /work/studio pi agent-0001',
],
}
diff --git a/cli/src/lib/gridAssignment.spec.ts b/cli/src/lib/gridAssignment.spec.ts
index 666408e78..ab32aa790 100644
--- a/cli/src/lib/gridAssignment.spec.ts
+++ b/cli/src/lib/gridAssignment.spec.ts
@@ -1,9 +1,10 @@
import { afterEach, describe, expect, it } from 'vitest'
-import { mkdtempSync, rmSync, writeFileSync } from 'node:fs'
+import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { classifyGridAssignment, probeGridAssignment, readOpencodeGridAssignment, readPiGridAssignment } from './gridAssignment.js'
-import { buildGridEngineLaunch, gridCapableEngines, type GridLaunchOverride } from './gridLaunch.js'
+import { gridAssignmentProcess } from './gridAssignmentWire.js'
+import { buildGridEngineLaunch, gridCapableEngines, gridConfigHandOff, type GridLaunchOverride } from './gridLaunch.js'
import type { AgentEngine } from '../engines/types.js'
import { clearProcessEnvCache, parsePsEnviron } from './processEnv.js'
@@ -109,47 +110,58 @@ describe('Pi, whose endpoint lives in a file', () => {
for (const dir of dirs.splice(0)) rmSync(dir, { recursive: true, force: true })
})
- /** Writes the launch's own config files where the probe will look for them. */
+ /** Writes the launch's own files where the probe will look for them, and the argv the pane runs. */
function materialize(): { dir: string; args: string } {
const built = buildGridEngineLaunch('pi', OVERRIDE, { hermesSystemManaged: false })
if (!built.ok) throw new Error(built.detail)
const dir = mkdtempSync(join(tmpdir(), 'pi-grid-'))
dirs.push(dir)
for (const file of built.launch.configDir!.files) writeFileSync(join(dir, file.name), file.content)
- return { dir, args: `pi ${built.launch.args.join(' ')}` }
+ const handOff = gridConfigHandOff(built.launch.configDir!, dir)
+ return { dir, args: `pi --session 01a1387c-b029-75b7-b0f0-925d65eb8121 ${[...built.launch.args, ...handOff.args].join(' ')}` }
}
it('round-trips: what the launcher wrote is what the probe reads back', async () => {
- const { dir, args } = materialize()
+ const { args } = materialize()
// Parsed from a real macOS `ps eww` line — argv first, then the environment — so the shape the
// probe is handed at runtime is the shape under test.
- const env = parsePsEnviron(`${args} PI_CODING_AGENT_DIR=${dir} GRID_API_KEY=gridkey-secret`)
+ const env = parsePsEnviron(`${args} GRID_API_KEY=gridkey-secret`)
await expect(readPiGridAssignment(env, args)).resolves.toEqual({
baseUrl: RELAY_V1,
model: 'GLM-4.7-Flash',
})
+ // And the process the core hands the models service carries the extension and model, nothing else of argv.
+ expect(gridAssignmentProcess('k', 'pi', env, args)?.args).toBe(`-e ${args.split(' -e ')[1]} --model grid/GLM-4.7-Flash`)
})
- it('a config directory that is gone reads as unknown, not as fine', async () => {
+ it('an extension that is gone reads as unknown, not as fine', async () => {
const { dir, args } = materialize()
- const env = parsePsEnviron(`${args} PI_CODING_AGENT_DIR=${dir}`)
rmSync(dir, { recursive: true, force: true })
// Nothing to read → null → the app offers a move rather than claiming the agent is in place.
- await expect(readPiGridAssignment(env, args)).resolves.toBeNull()
+ await expect(readPiGridAssignment({}, args)).resolves.toBeNull()
})
- it('reads nothing when the pane was never given a config directory', async () => {
- const { args } = materialize()
- await expect(readPiGridAssignment({}, args)).resolves.toBeNull()
+ it('reads nothing when the pane was never given the extension', async () => {
+ expect(gridAssignmentProcess('k', 'pi', {}, 'pi --model grid/GLM-4.7-Flash')).toBeNull()
+ await expect(readPiGridAssignment({}, 'pi --model grid/GLM-4.7-Flash')).resolves.toBeNull()
})
it('will not call a provider pointed somewhere else a grid', async () => {
const { dir, args } = materialize()
- writeFileSync(join(dir, 'models.json'), JSON.stringify({
- providers: { grid: { baseUrl: 'https://api.openai.com/v1' } },
- }))
+ const file = join(dir, 'grid-provider.ts')
+ writeFileSync(file, readFileSync(file, 'utf8').replace(RELAY_V1, 'https://api.openai.com/v1'))
+ await expect(readPiGridAssignment({}, args)).resolves.toBeNull()
+ })
+
+ it('still reads a Pi launched before the extension, from the config directory it was moved into', async () => {
+ // Such a Pi keeps running until it is next relaunched, and the app must not call it off its grid meanwhile.
+ const dir = mkdtempSync(join(tmpdir(), 'pi-grid-old-'))
+ dirs.push(dir)
+ writeFileSync(join(dir, 'models.json'), JSON.stringify({ providers: { grid: { baseUrl: RELAY_V1 } } }))
+ const args = 'pi --model grid/GLM-4.7-Flash'
const env = parsePsEnviron(`${args} PI_CODING_AGENT_DIR=${dir}`)
- await expect(readPiGridAssignment(env, args)).resolves.toBeNull()
+ expect(gridAssignmentProcess('k', 'pi', env, args)).not.toBeNull()
+ await expect(readPiGridAssignment(env, args)).resolves.toEqual({ baseUrl: RELAY_V1, model: 'GLM-4.7-Flash' })
})
})
@@ -195,7 +207,7 @@ describe('readOpencodeGridAssignment', () => {
writeFileSync(join(dir, file.name), file.content)
}
const assignment = await readOpencodeGridAssignment({
- [built.launch.configDir!.envVar]: join(dir, built.launch.configDir!.pointAt!),
+ [built.launch.configDir!.envVar!]: join(dir, built.launch.configDir!.pointAt!),
})
expect(assignment).not.toBeNull()
expect(assignment!.baseUrl).toContain(NETWORK_ID)
@@ -320,7 +332,7 @@ describe('web tools do not disturb the probe', () => {
writeFileSync(join(dir, file.name), file.content)
}
const assignment = await readOpencodeGridAssignment({
- [built.launch.configDir!.envVar]: join(dir, built.launch.configDir!.pointAt!),
+ [built.launch.configDir!.envVar!]: join(dir, built.launch.configDir!.pointAt!),
})
expect(assignment).toEqual({ baseUrl: RELAY_V1, model: 'GLM-4.7-Flash' })
})
diff --git a/cli/src/lib/gridAssignment.ts b/cli/src/lib/gridAssignment.ts
index bbf75525e..071a0b834 100644
--- a/cli/src/lib/gridAssignment.ts
+++ b/cli/src/lib/gridAssignment.ts
@@ -29,7 +29,7 @@ import type { ProcessIdentity } from './registry.js'
export type { GridAssignment } from './gridAssignmentWire.js'
import { GRID_ENDPOINT_VARS as BASE_URL_VAR, GRID_MODEL_VARS as MODEL_VAR, GRID_CODEX_ENDPOINT as CODEX_BASE_URL,
- GRID_ARGV_MODEL as ARGV_MODEL, GRID_PI_MODEL as PI_ARGV_MODEL, type GridAssignment, type GridAssignmentProcess,
+ GRID_ARGV_MODEL as ARGV_MODEL, GRID_PI_MODEL as PI_ARGV_MODEL, GRID_PI_EXTENSION as PI_EXTENSION, piProviderExtensionIn, type GridAssignment, type GridAssignmentProcess,
type GridAssignmentAnswer } from './gridAssignmentWire.js'
export { sameGridAssignment } from './gridAssignmentWire.js'
@@ -44,12 +44,12 @@ export { sameGridAssignment } from './gridAssignmentWire.js'
const MODEL_IN_ARGV = new Set<AgentEngine>([...enginesDeclaring('modelInArgv'), 'grok'])
/**
- * Pi's endpoint is in neither its environment nor its argv — it is in the `models.json` inside the
- * config directory `PI_CODING_AGENT_DIR` points at. So that is where it is read from, because the
- * alternative is to trust a note we wrote ourselves about what we did.
+ * Pi's endpoint is in neither its environment nor its argv — it is in the extension file `-e` hands
+ * it, or, for a Pi launched before that, the `models.json` inside the config directory
+ * `PI_CODING_AGENT_DIR` points at. So that is where it is read from, because the alternative is to
+ * trust a note we wrote ourselves about what we did.
*/
const PI_CONFIG_DIR_VAR = 'PI_CODING_AGENT_DIR'
-/** `--model grid/<model>` — how Pi is told which provider and model to use. */
/**
@@ -127,7 +127,8 @@ export function classifyGridAssignment(
}
/**
- * Pi's provider block, read out of the config directory its process was pointed at.
+ * Pi's provider block, read out of the extension (or, launched before it, the config directory) its process was
+ * pointed at.
*
* Exported so a spec can drive the real read against real files: the process half of the probe
* cannot be faked (an environment is fixed at exec), and a round trip that re-implemented this
@@ -140,15 +141,23 @@ export async function readPiGridAssignment(
processEnv: Record<string, string>,
args: string,
): Promise<GridAssignment | null> {
- const dir = processEnv[PI_CONFIG_DIR_VAR]?.trim()
- if (!dir) return null
const model = PI_ARGV_MODEL.exec(args)
if (!model) return null
+ const extension = PI_EXTENSION.exec(args)?.[1]
+ const dir = processEnv[PI_CONFIG_DIR_VAR]?.trim()
try {
- const raw = JSON.parse(await readFile(join(dir, 'models.json'), 'utf8')) as {
- providers?: Record<string, { baseUrl?: unknown }>
+ let baseUrl: unknown
+ if (extension) {
+ // The provider the extension registers, by the id `--model` names.
+ const registered = piProviderExtensionIn(await readFile(extension, 'utf8'))
+ if (registered?.id !== model[1]) return null
+ baseUrl = registered.provider.baseUrl
+ } else if (dir) {
+ const raw = JSON.parse(await readFile(join(dir, 'models.json'), 'utf8')) as {
+ providers?: Record<string, { baseUrl?: unknown }>
+ }
+ baseUrl = raw.providers?.[model[1]]?.baseUrl
}
- const baseUrl = raw.providers?.[model[1]]?.baseUrl
if (typeof baseUrl !== 'string' || !isGridUrl(baseUrl)) return null
return { baseUrl, model: model[2] }
} catch {
diff --git a/cli/src/lib/gridAssignmentShapes.golden.spec.ts b/cli/src/lib/gridAssignmentShapes.golden.spec.ts
index e3ab7da18..621ce83cb 100644
--- a/cli/src/lib/gridAssignmentShapes.golden.spec.ts
+++ b/cli/src/lib/gridAssignmentShapes.golden.spec.ts
@@ -24,7 +24,7 @@ it('keeps every assignment and saved-API instruction shape on both platforms', a
Object.defineProperty(process, 'platform', { value: os })
vi.resetModules()
const { gridAssignmentShapes } = await import('../testing/gridAssignmentShapes.js')
- const { buildGridEngineLaunch, gridCapableEngines } = await import('./gridLaunch.js')
+ const { buildGridEngineLaunch, gridCapableEngines, gridConfigHandOff } = await import('./gridLaunch.js')
const dir = join(root, os)
const storeDir = join(dir, 'api-connections')
mkdirSync(storeDir, { recursive: true })
@@ -76,14 +76,17 @@ it('keeps every assignment and saved-API instruction shape on both platforms', a
{ hermesSystemManaged: false, opencodeMajor: 2 })
if (!built.ok) { out[`${engine}/launch-roundtrip/${model}`] = built; continue }
const env = { ...built.launch.env }
+ const args = [...built.launch.args]
if (built.launch.configDir) {
const configs = built.launch.configDir
const path = join(dir, `config-${engine}-${model}`)
mkdirSync(path)
for (const file of configs.files) writeFileSync(join(path, file.name), file.content)
- env[configs.envVar] = configs.pointAt ? join(path, configs.pointAt) : path
+ const handOff = gridConfigHandOff(configs, path)
+ Object.assign(env, handOff.env)
+ args.push(...handOff.args)
}
- await assignment(`${engine}/launch-roundtrip/${model}`, engine, env, built.launch.args.join(' '))
+ await assignment(`${engine}/launch-roundtrip/${model}`, engine, env, args.join(' '))
}
const connection = { id: 'saved', provider: 'custom', name: 'Saved', baseUrl: api, keyEnv: 'SAVED_API_KEY', authHeader: 'Authorization', authPrefix: 'Bearer', apiKey: 'fake-saved-key' }
await assignment('saved/before-save', 'claude', { ANTHROPIC_BASE_URL: api, ANTHROPIC_MODEL: 'chosen' })
diff --git a/cli/src/lib/gridAssignmentWire.ts b/cli/src/lib/gridAssignmentWire.ts
index 5afe6291a..6de77e03c 100644
--- a/cli/src/lib/gridAssignmentWire.ts
+++ b/cli/src/lib/gridAssignmentWire.ts
@@ -14,19 +14,43 @@ export const GRID_MODEL_VARS: Partial<Record<AgentEngine, string>> = {
export const GRID_CODEX_ENDPOINT = /model_providers\.[A-Za-z0-9_-]+\.base_url=(?:"([^"]+)"|(\S+))/
export const GRID_ARGV_MODEL = /(?:^|\s)-m\s+(\S+)/
export const GRID_PI_MODEL = /(?:^|\s)--model\s+([A-Za-z0-9_-]+)\/(\S+)/
+/** `-e <dir>/grid-provider.ts`, the extension a grid launch hands Pi (lib/gridLaunch.ts `piProviderExtension`). */
+export const GRID_PI_EXTENSION = /(?:^|\s)-e\s+(\S*\/grid-provider\.ts)(?=\s|$)/
+
+/** The provider id and block a grid-provider extension registers; null for any other source. */
+export function piProviderExtensionIn(source: string): { id: string; provider: Record<string, unknown> } | null {
+ const block = /pi\.registerProvider\(("[^"]+"), (\{[\s\S]*\})\)\s*\}\s*$/.exec(source)
+ if (!block) return null
+ try {
+ const id: unknown = JSON.parse(block[1]), provider: unknown = JSON.parse(block[2])
+ return typeof id === 'string' && !!provider && typeof provider === 'object' ? { id, provider: provider as Record<string, unknown> } : null
+ } catch { return null }
+}
/** Null is positive evidence of no launch markers. An unreadable environment is handled by the caller. */
export function gridAssignmentProcess(key: string, engine: AgentEngine, env: Record<string, string>, args: string): GridAssignmentProcess | null {
const endpoint = GRID_ENDPOINT_VARS[engine]
+ // A Pi launched before its provider extension was pointed at a whole config directory instead, and is read that way
+ // until it is relaunched.
const marker = engine === 'pi' ? 'PI_CODING_AGENT_DIR' : engine === 'opencode' ? 'OPENCODE_CONFIG' : endpoint
+ const extension = engine === 'pi' ? GRID_PI_EXTENSION.exec(args) : null
const provider = marker ? null : GRID_CODEX_ENDPOINT.exec(args)
- if (!(marker ? env[marker]?.trim() : provider)) return null
+ if (!(extension || (marker ? env[marker]?.trim() : provider))) return null
const picked: Record<string, string> = {}
for (const name of [marker, GRID_MODEL_VARS[engine]]) if (name && env[name] !== undefined) picked[name] = env[name]
// Never forward the command line: it may carry a prompt, token or unrelated tool arguments.
- const model = engine === 'pi' ? GRID_PI_MODEL.exec(args)?.[0]
+ const model = engine === 'pi' ? GRID_PI_MODEL.exec(args)?.[0].trim()
: engine === 'codex' || engine === 'grok' ? GRID_ARGV_MODEL.exec(args)?.[0] : undefined
- return { key, engine, env: picked, args: [provider?.[0], model].filter(Boolean).join(' ') }
+ return { key, engine, env: picked, args: [provider?.[0], extension?.[0].trim(), model].filter(Boolean).join(' ') }
+}
+
+/**
+ * [gridAssignmentProcess] over what a process gave: its environment, or null when that could not be read. Without
+ * one, only a launch command naming its grid counts (Pi's `-e` extension); a command naming none is not known, never
+ * "on its own login", since the unread environment may hold the grid.
+ */
+export function gridAssignmentEvidence(key: string, engine: AgentEngine, env: Record<string, string> | null, args: string): GridAssignmentProcess | null | undefined {
+ return env ? gridAssignmentProcess(key, engine, env, args) : gridAssignmentProcess(key, engine, {}, args) ?? undefined
}
const record = (value: unknown): value is Record<string, unknown> => !!value && typeof value === 'object' && !Array.isArray(value)
diff --git a/cli/src/lib/gridConfigDir.ts b/cli/src/lib/gridConfigDir.ts
index 02c53e86a..22efe8ac1 100644
--- a/cli/src/lib/gridConfigDir.ts
+++ b/cli/src/lib/gridConfigDir.ts
@@ -1,11 +1,10 @@
/**
* The private config directory an engine is given when its provider lives in a file.
*
- * Pi is the case this exists for: it reads providers out of a directory, and `PI_CODING_AGENT_DIR`
- * moves that directory. Rather than edit `~/.pi/agent/models.json` — someone else's file, which
- * would outlive the agent and survive every uninstall — the daemon writes a directory it owns and
- * points the engine at that. The user's own configuration is never opened, and deleting the
- * directory undoes the whole thing.
+ * OpenCode's config file and Pi's provider extension are the usual cases. Rather than edit the
+ * engine's own config — someone else's file, which would outlive the agent and survive every
+ * uninstall — the daemon writes a directory it owns and points the engine at that. The user's own
+ * configuration is never opened, and deleting the directory undoes the whole thing.
*
* Nothing written here is secret. A provider block references the key through an environment
* variable; the key itself lives in the process environment — and, so a relaunch can put it back
diff --git a/cli/src/lib/gridLaunch.spec.ts b/cli/src/lib/gridLaunch.spec.ts
index dda728057..769f45e9a 100644
--- a/cli/src/lib/gridLaunch.spec.ts
+++ b/cli/src/lib/gridLaunch.spec.ts
@@ -16,6 +16,7 @@ import {
type GridLaunchMachine,
type GridLaunchOverride,
} from './gridLaunch.js'
+import { piProviderExtensionIn } from './gridAssignmentWire.js'
import { ENGINES, type AgentEngine } from '../engines/types.js'
import { buildEngineLaunchArgv } from './engineLaunch.js'
@@ -43,12 +44,18 @@ function launchOf(engine: AgentEngine, override = WITH_MODEL, machine = PLAIN_MA
return built.launch
}
-it('borrows Grok conversations and Pi skills from the captured launch home', () => {
- const machine = { ...PLAIN_MACHINE, grokHome: '/fixture/shell-grok', piSkillsDir: '/fixture/shell-pi/skills' }
+/** The provider Pi's grid launch registers, read the way the probe reads it back (lib/gridAssignment.ts). */
+function piProviderOf(launch: ReturnType<typeof launchOf>) {
+ const file = launch.configDir?.files.find((f) => f.name === launch.configDir?.pointAt)
+ const registered = file ? piProviderExtensionIn(file.content) : null
+ if (!registered) throw new Error('no provider extension')
+ return registered as { id: string; provider: { baseUrl: string; api: string; apiKey: string; models: { id: string; contextWindow: number }[] } }
+}
+
+it('borrows Grok conversations from the captured launch home', () => {
+ const machine = { ...PLAIN_MACHINE, grokHome: '/fixture/shell-grok' }
expect(launchOf('grok', WITH_MODEL, machine).configDir!.links!.map(link => link.target))
.toEqual(expect.arrayContaining(['/fixture/shell-grok/sessions']))
- const settings = launchOf('pi', WITH_MODEL, machine).configDir!.files.find(file => file.name === 'settings.json')!
- expect(JSON.parse(settings.content).skills).toEqual(['/fixture/shell-pi/skills'])
})
describe('parseGridLaunchOverride', () => {
@@ -210,33 +217,23 @@ describe('the launch each engine gets', () => {
})
})
- it('gives Pi a config directory of ours, never the user\'s own', () => {
+ it('adds the grid to Pi through an extension, leaving the person\'s own Pi home where it is', () => {
const launch = launchOf('pi')
expect(launch.env).toEqual({ GRID_API_KEY: WIRE.apiKey })
expect(launch.args).toEqual(['--model', 'grid/GLM-4.7-Flash'])
- const configDir = launch.configDir
- expect(configDir?.envVar).toBe('PI_CODING_AGENT_DIR')
- const models = configDir?.files.find((file) => file.name === 'models.json')
- expect(models).toBeDefined()
- const parsed = JSON.parse(models!.content) as {
- providers: Record<string, { baseUrl: string; api: string; apiKey: string }>
- }
- expect(parsed.providers.grid.baseUrl).toBe(RELAY_V1)
+ // `-e <file>`, never `PI_CODING_AGENT_DIR`: that moved Pi's settings, packages and sessions with it,
+ // and every model switch then reopened Pi with none of them (2026-10-14).
+ expect(launch.configDir).toMatchObject({ arg: '-e', pointAt: 'grid-provider.ts' })
+ expect(launch.configDir).not.toHaveProperty('envVar')
+ expect(launch.configDir?.files.map((file) => file.name)).toEqual(['grid-provider.ts'])
+ const { id, provider } = piProviderOf(launch)
+ expect(id).toBe('grid')
+ expect(provider.baseUrl).toBe(RELAY_V1)
// `openai-completions` makes Pi post to <base>/chat/completions, which the relay serves.
- expect(parsed.providers.grid.api).toBe('openai-completions')
+ expect(provider.api).toBe('openai-completions')
// An env REFERENCE. Writing the key itself would put a live credential on disk, outliving the
// agent and every reason it existed.
- expect(parsed.providers.grid.apiKey).toBe('$GRID_API_KEY')
- expect(models!.content).not.toContain(WIRE.apiKey)
- })
-
- it('hands Pi back the skills the redirection would otherwise hide', () => {
- const settings = launchOf('pi').configDir?.files.find((file) => file.name === 'settings.json')
- const parsed = JSON.parse(settings!.content) as Record<string, unknown>
- expect((parsed.skills as string[])[0]).toContain('.pi')
- // The Grid app set `defaultProjectTrust: always` because it drove Pi headless with nobody there
- // to answer. Here a person is sitting in front of the pane, so the trust prompt stays theirs.
- expect(parsed).not.toHaveProperty('defaultProjectTrust')
+ expect(provider.apiKey).toBe('$GRID_API_KEY')
})
it('routes Pi through Auto when the user picked no model, rather than refusing', () => {
@@ -246,12 +243,8 @@ describe('the launch each engine gets', () => {
// never start: that dialog always creates on Auto and offers no model field.
const launch = launchOf('pi', OVERRIDE)
expect(launch.args).toEqual(['--model', 'grid/Auto'])
- const models = launch.configDir?.files.find((file) => file.name === 'models.json')
- const parsed = JSON.parse(models!.content) as {
- providers: Record<string, { models: { id: string; name: string }[] }>
- }
// Named in the block too, not just in argv — Pi resolves `grid/Auto` against this list.
- expect(parsed.providers.grid.models.map((m) => m.id)).toEqual(['Auto'])
+ expect(piProviderOf(launch).provider.models.map((m) => m.id)).toEqual(['Auto'])
})
it('never puts the key in argv, or on disk, for any engine', () => {
@@ -385,7 +378,6 @@ describe('the lists the core declares for every launch (lib/gridLaunchWire.ts),
CLAUDE_CODE_MAX_CONTEXT_TOKENS: 'a hint',
// Each engine's own config pointer, written by that engine's launch into the daemon's own folder.
OPENCODE_CONFIG: 'its own config file',
- PI_CODING_AGENT_DIR: 'its own config folder',
}
// Set by no contract, and what outranks a grid when inherited (the module doc's first measurement).
const INHERITED_ONLY = ['ANTHROPIC_API_KEY']
@@ -416,8 +408,9 @@ describe('gridEnvVarNames', () => {
expect(gridEnvVarNames('claude')).not.toContain('GRID_MCP_AUTHORIZATION')
})
- it('includes the config-dir pointer for an engine that uses one', () => {
- expect(gridEnvVarNames('pi')).toContain('PI_CODING_AGENT_DIR')
+ it('includes the config-dir pointer for an engine that uses one, and none for Pi, which is handed a flag', () => {
+ expect(gridEnvVarNames('opencode')).toContain('OPENCODE_CONFIG')
+ expect(gridEnvVarNames('pi')).toEqual(['GRID_API_KEY'])
})
it('covers every variable a launch WITH web tools sets, so returning to the own login clears them all', () => {
@@ -426,7 +419,7 @@ describe('gridEnvVarNames', () => {
// was told it is back on its subscription model.
for (const engine of gridCapableEngines()) {
const launch = launchOf(engine, WITH_MCP)
- const set = [...Object.keys(launch.env), ...(launch.configDir ? [launch.configDir.envVar] : [])]
+ const set = [...Object.keys(launch.env), ...(launch.configDir?.envVar ? [launch.configDir.envVar] : [])]
for (const name of set) expect(gridEnvVarNames(engine), `${engine} sets ${name}`).toContain(name)
}
})
@@ -454,7 +447,7 @@ describe('gridConflictingEnvToClear', () => {
const built = buildGridEngineLaunch(engine, { ...override, model: 'a-model' }, PLAIN_MACHINE)
if (!built.ok) throw new Error(`${engine} refused`)
const set = new Set(Object.keys(built.launch.env))
- if (built.launch.configDir) set.add(built.launch.configDir.envVar)
+ if (built.launch.configDir?.envVar) set.add(built.launch.configDir.envVar)
for (const name of gridConflictingEnvToClear(built.launch)) {
expect(set.has(name), `${engine} both sets and clears ${name}`).toBe(false)
}
@@ -990,12 +983,8 @@ describe('each engine is told the real context window', () => {
expect(launchOf('codex', WITH_MODEL).args.join(' ')).not.toContain('model_context_window')
})
- it('Pi, in the window its models file declares', () => {
- const models = (launch: ReturnType<typeof launchOf>) =>
- JSON.parse(launch.configDir!.files.find((f) => f.name === 'models.json')!.content)
- const [model] = Object.values<any>(models(launchOf('pi', WITH_WINDOW)).providers)[0].models
- expect(model.contextWindow).toBe(131072)
- const [unknown] = Object.values<any>(models(launchOf('pi', WITH_MODEL)).providers)[0].models
- expect(unknown.contextWindow).toBe(200000)
+ it('Pi, in the window its provider extension declares', () => {
+ expect(piProviderOf(launchOf('pi', WITH_WINDOW)).provider.models[0].contextWindow).toBe(131072)
+ expect(piProviderOf(launchOf('pi', WITH_MODEL)).provider.models[0].contextWindow).toBe(200000)
})
})
diff --git a/cli/src/lib/gridLaunch.ts b/cli/src/lib/gridLaunch.ts
index 74a79fcf3..9f7c52f48 100644
--- a/cli/src/lib/gridLaunch.ts
+++ b/cli/src/lib/gridLaunch.ts
@@ -73,11 +73,6 @@ import { HARNESS_MCP_SERVER_NAME } from './harnessWebTools.js'
export * from './gridLaunchWire.js'
-/** Where Pi keeps the skills the user manages, handed back through our own settings.json. */
-function userPiSkillsDir(): string {
- return join(homedir(), '.pi', 'agent', 'skills')
-}
-
/**
* Grok's real state directory — the one a private [GROK_HOME_VAR] borrows `sessions/` from.
*
@@ -249,45 +244,39 @@ const webSearchWhenWired = (override: GridLaunchOverride): GridWebSearchStatus =
* `api: openai-completions` makes Pi post to `<base>/chat/completions`, which is what the relay
* serves. The context/cost numbers are Pi's own bookkeeping for its display; the grid decides what
* the model really takes.
- */
-function piModelsJson(baseUrl: string, model: string, contextWindow?: number): string {
- return JSON.stringify({
- providers: {
- [GRID_PROVIDER_ID]: {
- name: 'Autonomous Grid',
- baseUrl,
- api: 'openai-completions',
- // An env reference, not the key — nothing secret is written to disk.
- apiKey: `$${GRID_KEY_VAR}`,
- models: [{
- id: model,
- name: model,
- reasoning: false,
- input: ['text'],
- // The real window when the relay reported one — the same fault as every engine here:
- // told 200K, Pi never compacted before a smaller server refused the request.
- contextWindow: contextWindow ?? 200000,
- maxTokens: 8192,
- cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
- }],
- },
- },
- }, null, 2)
-}
-
-/**
- * Pi's settings for the directory we own, which exists to hand back the one thing the redirection
- * takes away: the skills the user keeps in their real `~/.pi/agent/skills`.
*
- * Deliberately NOT `defaultProjectTrust: always`. The Grid app set it because it drove Pi headless,
- * one process per turn, with nobody there to answer a prompt. Here the user is sitting in front of
- * an interactive pane, and silently pre-trusting every folder they open an agent in would be this
- * daemon deciding something it was not asked to decide.
+ * Registered by an extension (`pi -e`), not written as a `models.json` under a `PI_CODING_AGENT_DIR`
+ * of our own. That variable moves Pi's WHOLE home: the person's settings, packages and auth went with
+ * it, and so did `sessions/`, so every model switch reopened Pi in a new directory where `--session`
+ * found nothing and the daemon fell back to a fresh conversation (2026-10-14). An extension adds the
+ * provider and leaves `~/.pi/agent` exactly as the person keeps it.
*/
-function piSettingsJson(userSkillsDir: string): string {
- return JSON.stringify({ skills: [userSkillsDir] }, null, 2)
+function piProviderExtension(baseUrl: string, model: string, contextWindow?: number): string {
+ const provider = {
+ name: 'Autonomous Grid',
+ baseUrl,
+ api: 'openai-completions',
+ // An env reference, not the key — nothing secret is written to disk.
+ apiKey: `$${GRID_KEY_VAR}`,
+ models: [{
+ id: model,
+ name: model,
+ reasoning: false,
+ input: ['text'],
+ // The real window when the relay reported one — the same fault as every engine here:
+ // told 200K, Pi never compacted before a smaller server refused the request.
+ contextWindow: contextWindow ?? 200000,
+ maxTokens: 8192,
+ cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
+ }],
+ }
+ return `// Written by the machine adapter for this agent's grid launch. Adds the grid as a provider.\n`
+ + `export default function (pi) {\n pi.registerProvider(${JSON.stringify(GRID_PROVIDER_ID)}, ${JSON.stringify(provider, null, 2).replace(/\n/g, '\n ')})\n}\n`
}
+/** The file [piProviderExtension] is written to, handed to Pi with `-e`. */
+const PI_PROVIDER_EXTENSION_FILE = 'grid-provider.ts'
+
/**
* Every engine that can be pointed at a grid, and how.
*
@@ -582,9 +571,9 @@ const GRID_ENGINE_CONTRACTS: Partial<Record<AgentEngine, GridEngineContract>> =
},
},
- // Pi reads its providers out of a config DIRECTORY, and `PI_CODING_AGENT_DIR` moves that
- // directory. So it gets a private one per agent: the provider block lands there, the user's
- // ~/.pi/agent/models.json is never opened, and their skills are handed back through settings.json.
+ // Pi takes the grid from an extension file in a directory this daemon owns, handed over with `-e`
+ // (see [piProviderExtension]): the person's own `~/.pi/agent` (settings, packages, sessions) is
+ // read as always and never written.
//
// The provider block has to name the model it serves, and Pi selects it as `grid/<model>` — so
// something must always be named. No model chosen means the grid routes: `Auto` is the router's
@@ -595,16 +584,16 @@ const GRID_ENGINE_CONTRACTS: Partial<Record<AgentEngine, GridEngineContract>> =
// always creates on Auto and no longer offers a model field — a dead end, not a prompt to go and
// pick something.
pi: {
- build: (override, machine) => {
+ build: (override) => {
const model = override.model ?? GRID_ROUTER_MODEL
return {
env: { [GRID_KEY_VAR]: override.apiKey },
args: ['--model', `${GRID_PROVIDER_ID}/${model}`],
configDir: {
- envVar: 'PI_CODING_AGENT_DIR',
+ arg: '-e',
+ pointAt: PI_PROVIDER_EXTENSION_FILE,
files: [
- { name: 'models.json', content: piModelsJson(relayBaseUrl(override.baseUrl), model, override.contextWindow) },
- { name: 'settings.json', content: piSettingsJson(machine.piSkillsDir ?? userPiSkillsDir()) },
+ { name: PI_PROVIDER_EXTENSION_FILE, content: piProviderExtension(relayBaseUrl(override.baseUrl), model, override.contextWindow) },
],
},
// Pi has no MCP client, so there is nothing to hand the server to — with or without a url.
@@ -730,7 +719,7 @@ export function contractEnvVarNames(engine: AgentEngine): string[] {
const built = buildGridEngineLaunch(engine, PROBE_OVERRIDE, { hermesSystemManaged: false })
if (!built.ok) return []
const names = Object.keys(built.launch.env)
- if (built.launch.configDir) names.push(built.launch.configDir.envVar)
+ if (built.launch.configDir?.envVar) names.push(built.launch.configDir.envVar)
return names
}
diff --git a/cli/src/lib/gridLaunchWire.ts b/cli/src/lib/gridLaunchWire.ts
index 1a7da0171..192090794 100644
--- a/cli/src/lib/gridLaunchWire.ts
+++ b/cli/src/lib/gridLaunchWire.ts
@@ -8,10 +8,11 @@
* docs/design/2026-10-08-launch-port.md): the per-engine contracts and their web-tools wiring never load in the
* core. The declared lists here are held equal to what those contracts produce (lib/gridLaunch.spec.ts).
*/
+import { join } from 'node:path'
import type { AgentEngine } from '../engines/types.js'
/** The variable an engine is told to read the key from, where the engine supports that indirection. Codex names it
- * in `env_key`; Pi's `models.json` writes it as a `$VAR` reference. */
+ * in `env_key`; Pi's provider extension writes it as a `$VAR` reference. */
export const GRID_KEY_VAR = 'GRID_API_KEY'
/** The variable the web tools' MCP authorization header rides in (lib/gridWebMcp.ts). */
export const GRID_MCP_AUTH_VAR = 'GRID_MCP_AUTHORIZATION'
@@ -264,7 +265,6 @@ export interface GridLaunchRecord {
export interface GridLaunchMachine {
/** Original native locations captured before a grid redirects configuration. */
grokHome?: string
- piSkillsDir?: string
/**
* Whether an administrator pinned Hermes settings in [HERMES_SYSTEM_MANAGED_DIR]. Hermes's web
* tools ride a managed-scope overlay that REPLACES that directory rather than adding to it, so on
@@ -293,9 +293,9 @@ export interface GridEngineLaunch {
*/
sessionModel?: string
/**
- * For an engine that reads its provider out of a config directory rather than an environment
- * variable: files the daemon writes into a directory IT owns, and the variable that points the
- * engine at that directory.
+ * For an engine that reads its provider out of a file rather than an environment variable: files
+ * the daemon writes into a directory IT owns, and how the engine is pointed at it — the variable
+ * [envVar] set to it, or the flag [arg] handed it after the other args. Exactly one of the two.
*
* This is not "editing the user's dotfiles" — the point of the indirection is that it never
* touches them. The engine gets a private configuration for this agent, the user's own stays
@@ -303,14 +303,16 @@ export interface GridEngineLaunch {
* contain the key; Pi's provider block references an environment variable instead.
*/
configDir?: {
- envVar: string
+ envVar?: string
+ /** Pi's `-e`: its extension file adds the provider without moving Pi's home. */
+ arg?: string
files: GridConfigFile[]
/**
- * Point [envVar] at ONE of the written files rather than at the directory holding them.
+ * Point the engine at ONE of the written files rather than at the directory holding them.
*
- * Pi wants the directory (`PI_CODING_AGENT_DIR`); OpenCode's `OPENCODE_CONFIG` wants a config
- * file. Same mechanism — a private directory this daemon owns — differing only in what the
- * engine is handed, so it is a field rather than a second writer.
+ * OpenCode's `OPENCODE_CONFIG` wants a config file, Pi's `-e` an extension file, Grok's and
+ * Hermes's variables the directory. Same mechanism — a private directory this daemon owns —
+ * differing only in what the engine is handed, so it is a field rather than a second writer.
*/
pointAt?: string
/**
@@ -324,6 +326,13 @@ export interface GridEngineLaunch {
}
}
+/** What a written config directory adds to a launch: [configDir]'s variable set to it, or its flag and path. */
+export function gridConfigHandOff(configDir: NonNullable<GridEngineLaunch['configDir']>, dir: string): { env: Record<string, string>; args: string[] } {
+ const path = configDir.pointAt ? join(dir, configDir.pointAt) : dir
+ if (configDir.arg) return { env: {}, args: [configDir.arg, path] }
+ return { env: configDir.envVar ? { [configDir.envVar]: path } : {}, args: [] }
+}
+
/**
* Every variable any grid launch contract (lib/gridLaunch.ts) uses to point an engine somewhere.
*
@@ -380,7 +389,7 @@ export const GRID_CONFLICTING_ENV_VARS: readonly string[] = [
*/
export function gridConflictingEnvToClear(launch: Pick<GridEngineLaunch, 'env' | 'configDir'>): string[] {
const provided = new Set(Object.keys(launch.env))
- if (launch.configDir) provided.add(launch.configDir.envVar)
+ if (launch.configDir?.envVar) provided.add(launch.configDir.envVar)
return GRID_CONFLICTING_ENV_VARS.filter((name) => !provided.has(name))
}
@@ -467,7 +476,7 @@ export const GRID_ENV_VAR_NAMES: Readonly<Partial<Record<AgentEngine, readonly s
claude: ['ANTHROPIC_BASE_URL', 'ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_MODEL', 'CLAUDE_CODE_MAX_CONTEXT_TOKENS', GRID_KEY_VAR],
codex: [GRID_KEY_VAR, GRID_MCP_AUTH_VAR],
opencode: [GRID_KEY_VAR, 'OPENCODE_CONFIG'],
- pi: [GRID_KEY_VAR, 'PI_CODING_AGENT_DIR'],
+ pi: [GRID_KEY_VAR],
hermes: ['OPENAI_BASE_URL', 'OPENAI_API_KEY', 'HERMES_INFERENCE_MODEL', GRID_KEY_VAR, HERMES_MANAGED_DIR_VAR],
grok: ['GROK_MODELS_BASE_URL', 'XAI_API_KEY', GRID_KEY_VAR, GROK_HOME_VAR],
copilot: ['COPILOT_PROVIDER_BASE_URL', 'COPILOT_PROVIDER_API_KEY', 'COPILOT_MODEL', GRID_KEY_VAR],
diff --git a/cli/src/lib/launchOverrides.spec.ts b/cli/src/lib/launchOverrides.spec.ts
index 9eaa5311f..4ba1d2945 100644
--- a/cli/src/lib/launchOverrides.spec.ts
+++ b/cli/src/lib/launchOverrides.spec.ts
@@ -138,13 +138,24 @@ describe('buildLaunchOverrides — a relaunch comes back where the agent was', (
})
it('writes a file-configured engine its config directory keyed on the agent, and points the env at it', async () => {
+ const { d, calls } = deps()
+ const result = await buildLaunchOverrides(d, 'opencode', { gridLaunch: GRID }, 'agent-1')
+ expect(result.ok).toBe(true)
+ if (!result.ok) return
+ expect(calls).toEqual(['writeConfig:agent-1'])
+ expect(result.overrides.env.OPENCODE_CONFIG).toBe('/state/grid-engine-config/agent-1/opencode.json')
+ expect(result.overrides.clearEnv).not.toContain('OPENCODE_CONFIG')
+ })
+
+ it("hands Pi its provider extension as a flag, and leaves Pi's own home alone", async () => {
+ // A relaunch is a model switch too: moving Pi's home here reopened it without the conversation it resumes.
const { d, calls } = deps()
const result = await buildLaunchOverrides(d, 'pi', { gridLaunch: GRID }, 'agent-1')
expect(result.ok).toBe(true)
if (!result.ok) return
expect(calls).toEqual(['writeConfig:agent-1'])
- expect(result.overrides.env.PI_CODING_AGENT_DIR).toBe('/state/grid-engine-config/agent-1')
- expect(result.overrides.clearEnv).not.toContain('PI_CODING_AGENT_DIR')
+ expect(result.overrides.extraArgs.slice(-2)).toEqual(['-e', '/state/grid-engine-config/agent-1/grid-provider.ts'])
+ expect(result.overrides.env).not.toHaveProperty('PI_CODING_AGENT_DIR')
})
it('names the service that could not be asked, so a restore holds the agent rather than failing it', async () => {
diff --git a/cli/src/lib/launchOverrides.ts b/cli/src/lib/launchOverrides.ts
index d5c7fdfd6..c9ac64f65 100644
--- a/cli/src/lib/launchOverrides.ts
+++ b/cli/src/lib/launchOverrides.ts
@@ -12,7 +12,6 @@
* probe and the config directory writer) are exactly the parts worth stubbing in a spec.
*/
-import { join } from 'node:path'
import type { NativeLaunch, NativeLaunchResult, NativeLaunchSource } from '../engines/nativeLaunch.js'
import type { AgentEngine } from '../engines/types.js'
import { subscriptionModelLaunch } from './subscriptionModel.js'
@@ -20,6 +19,7 @@ import { ownLoginProviderArgs } from '../engines/launches.js'
import { namedAgentArgs, supportsNamedAgent } from './engineLaunch.js'
import { profileEnvironment } from './engineHomes.js'
import {
+ gridConfigHandOff,
gridConflictingEnvToClear,
type GridEngineLaunch,
type GridLaunchAnswer,
@@ -330,12 +330,13 @@ async function prepareBaseLaunchOverrides(
if (!tmux.ok) return tmux
return { ok: true, commit: async () => {
const env: Record<string, string> = { ...built.launch.env }
+ const args = [...built.launch.args]
if (built.launch.configDir) {
- const { envVar, files, pointAt, links } = built.launch.configDir
+ const { files, links } = built.launch.configDir
try {
- const dir = await deps.writeGridConfigDir(configKey, files, links ?? [])
- // Pi is handed the directory; OpenCode's OPENCODE_CONFIG wants the file inside it.
- env[envVar] = pointAt ? join(dir, pointAt) : dir
+ const handOff = gridConfigHandOff(built.launch.configDir, await deps.writeGridConfigDir(configKey, files, links ?? []))
+ Object.assign(env, handOff.env)
+ args.push(...handOff.args)
} catch (error) {
const detail = `could not write ${engine}'s grid configuration · ${error instanceof Error ? error.message : error}`
return { ok: false, error: 'GRID_CONFIG_FAILED', detail, ...(deps.native ? { unavailable: 'native' } : {}) }
@@ -347,7 +348,7 @@ async function prepareBaseLaunchOverrides(
ok: true,
overrides: {
env,
- extraArgs: [...built.launch.args],
+ extraArgs: args,
clearEnv: gridConflictingEnvToClear({ env }),
gridLaunchRecord: { override: built.override, webSearch: built.launch.webSearch },
...(built.launch.sessionModel ? { sessionModel: built.launch.sessionModel } : {}),
diff --git a/cli/src/lib/piSessionHome.spec.ts b/cli/src/lib/piSessionHome.spec.ts
new file mode 100644
index 000000000..a7b3c8930
--- /dev/null
+++ b/cli/src/lib/piSessionHome.spec.ts
@@ -0,0 +1,49 @@
+import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
+import { tmpdir } from 'node:os'
+import { join } from 'node:path'
+import { afterEach, beforeEach, expect, it } from 'vitest'
+import { bringPiSessionHome } from './piSessionHome.js'
+
+let root: string, configs: string, sessions: string
+const FOLDER = '--Users-me-harnesses-qwen-image--'
+const FILE = '2026-10-14T03-37-38-090Z_01a1387c-b029-75b7-b0f0-925d65eb8121.jsonl'
+
+beforeEach(() => {
+ root = mkdtempSync(join(tmpdir(), 'pi-home-'))
+ configs = join(root, 'grid-launch-config')
+ sessions = join(root, 'pi', 'agent', 'sessions')
+})
+afterEach(() => rmSync(root, { recursive: true, force: true }))
+
+/** A conversation where a grid launch that moved Pi's home left it (2026-10-14, `grid-launch-config/<digest>/sessions`). */
+function leftBehind(content = '{"type":"session"}\n'): string {
+ const dir = join(configs, 'c88e545a', 'sessions', FOLDER)
+ mkdirSync(dir, { recursive: true })
+ writeFileSync(join(dir, FILE), content)
+ return join(dir, FILE)
+}
+
+it("copies a conversation an older grid launch left in the daemon's folder into Pi's own sessions", () => {
+ const old = leftBehind()
+ expect(bringPiSessionHome(old, [configs], sessions)).toBe(join(sessions, FOLDER, FILE))
+ expect(readFileSync(join(sessions, FOLDER, FILE), 'utf8')).toBe('{"type":"session"}\n')
+ // A copy: the original stays, in case anything still reads it.
+ expect(readFileSync(old, 'utf8')).toBe('{"type":"session"}\n')
+})
+
+it('never replaces a conversation already in Pi\'s own sessions', () => {
+ const old = leftBehind('{"old":true}\n')
+ mkdirSync(join(sessions, FOLDER), { recursive: true })
+ writeFileSync(join(sessions, FOLDER, FILE), '{"home":true}\n')
+ expect(bringPiSessionHome(old, [configs], sessions)).toBe(join(sessions, FOLDER, FILE))
+ expect(readFileSync(join(sessions, FOLDER, FILE), 'utf8')).toBe('{"home":true}\n')
+})
+
+it('leaves a conversation that is already home, or anywhere else, alone', () => {
+ expect(bringPiSessionHome(join(sessions, FOLDER, FILE), [configs], sessions)).toBeNull()
+ expect(bringPiSessionHome(join(root, 'elsewhere', 'sessions', FOLDER, FILE), [configs], sessions)).toBeNull()
+ expect(bringPiSessionHome(join(configs, 'c88e545a', 'auth.json'), [configs], sessions)).toBeNull()
+ expect(bringPiSessionHome(null, [configs], sessions)).toBeNull()
+ // Pruned with its folder (30 days, gridConfigDir.ts) or removed: nothing to bring, and nothing thrown.
+ expect(bringPiSessionHome(join(configs, 'gone', 'sessions', FOLDER, FILE), [configs], sessions)).toBeNull()
+})
diff --git a/cli/src/lib/piSessionHome.ts b/cli/src/lib/piSessionHome.ts
new file mode 100644
index 000000000..0bef65e3a
--- /dev/null
+++ b/cli/src/lib/piSessionHome.ts
@@ -0,0 +1,32 @@
+/**
+ * A Pi conversation an earlier grid launch left in the daemon's own config directory, brought home before a resume.
+ *
+ * Until 2026-10-14 a grid launch moved Pi's whole home (`PI_CODING_AGENT_DIR`) into a directory under the daemon's
+ * data dir, so the sessions of a Pi on a grid were written there. A grid launch now leaves Pi's home where the person
+ * keeps it (lib/gridLaunch.ts `piProviderExtension`), and `--session <id>` looks for the conversation there: without
+ * this, the first relaunch after the update would find nothing and start fresh.
+ */
+import { constants, copyFileSync, existsSync, mkdirSync } from 'node:fs'
+import { join, relative, sep } from 'node:path'
+
+/**
+ * Copy [transcriptPath] into [sessionsDir] (Pi's own, `~/.pi/agent/sessions`) when it lies in a Pi home under one of
+ * [roots] (each `<root>/<agent>/sessions/<folder>/<file>`), under the same `<folder>/<file>`. A file already there is
+ * never replaced, and the original is left where it was. The path Pi will resume from, or null when there was nothing
+ * to bring.
+ */
+export function bringPiSessionHome(transcriptPath: string | null | undefined, roots: readonly string[], sessionsDir: string): string | null {
+ if (!transcriptPath) return null
+ for (const root of roots) {
+ const parts = relative(root, transcriptPath).split(sep)
+ if (parts.length !== 4 || parts[0] === '..' || parts[1] !== 'sessions' || !parts[3].endsWith('.jsonl')) continue
+ const home = join(sessionsDir, parts[2], parts[3])
+ if (existsSync(home)) return home
+ // Pruned with its folder after 30 days (gridConfigDir.ts), or removed: nothing to bring.
+ if (!existsSync(transcriptPath)) return null
+ mkdirSync(join(sessionsDir, parts[2]), { recursive: true, mode: 0o700 })
+ copyFileSync(transcriptPath, home, constants.COPYFILE_EXCL)
+ return home
+ }
+ return null
+}
diff --git a/cli/src/lib/processRows.spec.ts b/cli/src/lib/processRows.spec.ts
index d702c8af4..5053cd94d 100644
--- a/cli/src/lib/processRows.spec.ts
+++ b/cli/src/lib/processRows.spec.ts
@@ -2,7 +2,7 @@ import { chmodSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'nod
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
-import { processArgs, processRows } from './tmux.js'
+import { launchArgs, processArgs, processLaunchArgs, processRows, type ProcessRow } from './tmux.js'
// The fake binaries below are /bin/sh scripts; their answers, not their speed, are what is tested
// (testing/patientExecWithoutDeadline.ts).
@@ -41,8 +41,12 @@ printf ' 123 1 claude Mon Sep 21 10:00:00 2026 claude --resume\\n'
const [row] = (await processRows())!
expect(await processArgs(row)).toBe('claude --resume')
expect(await processArgs({ ...row, startMarker: 'another start' })).toBe('')
+ // How it was launched is its own command line, when it still has one.
+ expect(await processLaunchArgs(row)).toBe('claude --resume')
+ expect(await processLaunchArgs({ ...row, startMarker: 'another start' })).toBe('')
writeFileSync(join(dir, 'fail'), '')
expect(await processArgs(row)).toBe('')
+ expect(await processLaunchArgs(row)).toBe('')
})
// The first reconcile pass after a boot attaches a few agents at once, and each validates its pane
@@ -66,3 +70,28 @@ printf ' 123 1 claude Mon Sep 21 10:00:00 2026 claude --resume\\n'
expect(spawns()).toBe(2)
})
})
+
+describe('launchArgs', () => {
+ const row = (pid: number, parentPid: number, args: string): ProcessRow =>
+ ({ pid, parentPid, args, executable: args.split(' ')[0], startMarker: 'start' })
+ const LAUNCHER = "/bin/zsh -lic . '/d/launch/1.sh' harness-engine /w /n/bin/pi --session s --model grid/m -e /c/grid-provider.ts"
+
+ it('is the engine\'s own command line whenever it still has one', () => {
+ const claude = row(2, 1, 'claude --resume x')
+ expect(launchArgs([row(1, 0, LAUNCHER), claude], claude)).toBe('claude --resume x')
+ })
+
+ it("reads a renamed Pi's launch from the launcher this daemon started it under, and nothing else", () => {
+ // Pi renames its process: `ps` shows `pi` and none of what it was launched with (2026-10-14).
+ const pi = row(2, 1, 'pi ')
+ expect(launchArgs([row(1, 0, LAUNCHER), pi], pi)).toBe(LAUNCHER)
+ // Without a cwd the binary is the next word.
+ const bare = "/bin/zsh -lic . '/d/launch/1.sh' harness-engine /n/bin/pi --model grid/m"
+ expect(launchArgs([row(1, 0, bare), pi], pi)).toBe(bare)
+ // A parent that is not that launcher, launches another engine, or is not in the table says nothing.
+ expect(launchArgs([row(1, 0, '/bin/zsh -l'), pi], pi)).toBe('')
+ expect(launchArgs([row(1, 0, "/bin/zsh -lic . '/d/1.sh' harness-engine /w /n/bin/codex resume x"), pi], pi)).toBe('')
+ expect(launchArgs([row(3, 0, LAUNCHER), pi], pi)).toBe('')
+ expect(launchArgs([row(1, 0, LAUNCHER), row(2, 1, '')], row(2, 1, ''))).toBe('')
+ })
+})
diff --git a/cli/src/lib/terminalAgentDiscovery.grid.spec.ts b/cli/src/lib/terminalAgentDiscovery.grid.spec.ts
index 920e947c5..12dcdf690 100644
--- a/cli/src/lib/terminalAgentDiscovery.grid.spec.ts
+++ b/cli/src/lib/terminalAgentDiscovery.grid.spec.ts
@@ -89,6 +89,23 @@ describe('grid assignment on the live terminal discovery path', () => {
expect(probe.agents[0].grid).toBeNull()
})
+ it("reads a renamed Pi from the launcher's command line, and calls it known only when that names a grid", async () => {
+ // Pi renames its process: `ps` shows `pi`, and its environment cannot be read (2026-10-14).
+ const launcher = (args: string) => row(10, 1, 'zsh', `/bin/zsh -lic . '/d/launch/1.sh' harness-engine /work /n/bin/pi --session s ${args}`)
+ const probe = (rows: ProcessRow[]) => {
+ processRows.mockResolvedValue(rows)
+ return probeTerminalAgents([backendWith('tmux', 'tmux', [{ runtime: TMUX_RUNTIME, rootPid: 10, cwd: '/work' }])], ['tmux'], 999)
+ .then((result) => { expect(result.agents.map((agent) => agent.engine)).toEqual(['pi']); return result.agents[0] })
+ }
+ readProcessEnv.mockResolvedValue(null)
+ const onGrid = await probe([launcher('--model grid/m -e /c/grid-provider.ts'), row(30, 10, 'pi', 'pi ')])
+ expect(onGrid.gridProcess).toEqual({ key: '', engine: 'pi', env: {}, args: '-e /c/grid-provider.ts --model grid/m' })
+ // Nothing naming a grid: an environment that could not be read may still hold one, so it stays unknown.
+ const unknown = await probe([launcher(''), row(30, 10, 'pi', 'pi ')])
+ expect(unknown.gridProcess).toBeUndefined()
+ expect(unknown.grid).toBeUndefined()
+ })
+
it('does not probe when the process table is unavailable', async () => {
processRows.mockResolvedValue(null)
const probe = await probeTerminalAgents(
diff --git a/cli/src/lib/terminalAgentDiscovery.ts b/cli/src/lib/terminalAgentDiscovery.ts
index 349a3d821..2044c6f79 100644
--- a/cli/src/lib/terminalAgentDiscovery.ts
+++ b/cli/src/lib/terminalAgentDiscovery.ts
@@ -6,7 +6,7 @@ import {
type AgentCommandOwnershipSnapshot,
} from './engineBin.js'
import { probeGatewayRuntime } from './gatewayRuntime.js'
-import { gridAssignmentProcess, type GridAssignment, type GridAssignmentProcess } from './gridAssignmentWire.js'
+import { gridAssignmentEvidence, type GridAssignment, type GridAssignmentProcess } from './gridAssignmentWire.js'
import { readProcessEnv } from './processEnv.js'
import { probeProfileHome } from '../engines/discoveries.js'
import { probeHermesHome } from '../engines/identities.js'
@@ -16,12 +16,13 @@ import {
ambiguousAgentProcess,
engineProcessMatchScore,
enrichProcessRows,
+ launchArgs,
processRows,
processTreePids,
resumeSessionId,
type ProcessRow,
} from './tmux.js'
-import { processIdentityKey, processIdentityOf, terminalInstanceId, terminalPlacementKey, terminalRouteKey } from './terminalRuntime.js'
+import { processIdentityKey, processIdentityOf, sameProcessIdentity, terminalInstanceId, terminalPlacementKey, terminalRouteKey } from './terminalRuntime.js'
import type {
ProcessIdentity,
TerminalInventoryResult,
@@ -264,12 +265,12 @@ export async function probeTerminalAgents(
const runtime = await probeGatewayRuntime(agent.processIdentity, agent.args)
agent.gateway = runtime.kind
// Only the marker read is core work. Models classifies it after reconciliation, without blocking binding.
- const env = await readProcessEnv(agent.processIdentity)
- if (env) {
- const evidence = gridAssignmentProcess('', agent.engine, env, agent.args)
- if (evidence) agent.gridProcess = evidence
- else agent.grid = null
- }
+ // Read from how it was launched, which for Pi is its launcher's command line (tmux.ts `launchArgs`).
+ const row = enrichedRows.find((candidate) => sameProcessIdentity(candidate, agent.processIdentity))
+ const evidence = gridAssignmentEvidence('', agent.engine, await readProcessEnv(agent.processIdentity),
+ row ? launchArgs(enrichedRows, row) : agent.args)
+ if (evidence) agent.gridProcess = evidence
+ else if (evidence === null) agent.grid = null
// And, for Codex, the profile it runs under — a fact about the process the row cannot otherwise learn.
agent.codexHome = await probeProfileHome(agent.processIdentity, agent.engine)
// Hermes's declared profile is read eagerly from the same verified process environment.
diff --git a/cli/src/lib/tmux.ts b/cli/src/lib/tmux.ts
index abaa1725c..66ca3b159 100644
--- a/cli/src/lib/tmux.ts
+++ b/cli/src/lib/tmux.ts
@@ -311,6 +311,34 @@ export async function processArgs(identity: ProcessIdentity): Promise<string> {
return rows?.find((row) => sameProcessIdentity(row, identity))?.args ?? ''
}
+/**
+ * The command line [row]'s engine was launched with, for reading how it was launched (its grid).
+ *
+ * Its own, unless that is a bare title: Pi renames its process, which on macOS overwrites its argv and environment
+ * in `ps` with `pi` (2026-10-14), and nothing it was launched with can be read there. Then the launcher this daemon
+ * started it under still holds the command (`… harness-engine [cwd] <engine binary> <args>`, lib/engineLaunch.ts),
+ * and is read when it is the direct parent in the same table, naming a binary of that title right after
+ * `harness-engine`. Anything else is '': not known, never another process's command line.
+ */
+export function launchArgs(rows: readonly ProcessRow[], row: ProcessRow): string {
+ const title = row.args.trim()
+ if (/\s/.test(title)) return row.args
+ const parent = rows.find((candidate) => candidate.pid === row.parentPid)
+ if (!title || !parent) return ''
+ const tokens = argvTokens(parent.args)
+ const at = tokens.indexOf('harness-engine')
+ if (at < 0) return ''
+ const named = (token: string | undefined) => !!token && basename(token) === title
+ return named(tokens[at + 1]) || named(tokens[at + 2]) ? parent.args : ''
+}
+
+/** [launchArgs] for the process [identity] names, read from a fresh table; '' once it is not that process. */
+export async function processLaunchArgs(identity: ProcessIdentity): Promise<string> {
+ const rows = await processRows()
+ const row = rows?.find((candidate) => sameProcessIdentity(candidate, identity))
+ return rows && row ? launchArgs(rows, row) : ''
+}
+
/** The process table, or null when `ps` itself failed — "we could not look" is not "nothing is there". */
export function processRows(): Promise<ProcessRow[] | null> {
if (processRowsInFlight) return processRowsInFlight