From f20e35961e7e6f36c997e348ff9bf6097ba4cc09 Mon Sep 17 00:00:00 2001 From: t Date: Sun, 13 Sep 2026 19:31:20 +0800 Subject: [PATCH] fix(engine): point the control surface banner at a command that resolves MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The banner prepended to a session's first prompt advertised `ari`, but the launcher the agent runtime installs is `ari.cmd` on Windows. In the shell the agent actually runs, bare `ari` does not resolve, so an agent that tried it got "command not found" and reported it had no Ari tooling at all — while the block kept insisting it did. `ARI_CLI` holds the absolute launcher path and resolves in every shell. The block also never said where it came from, so agents had no way to tell it was added by the app rather than typed by the user, and read it as a prompt injection riding along in the input. It now states its own provenance. Co-Authored-By: Claude --- apps/desktop/src/main/agent-runtime.test.ts | 3 ++- apps/desktop/src/main/engine.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/main/agent-runtime.test.ts b/apps/desktop/src/main/agent-runtime.test.ts index 85a27bd0..d28ba3b9 100644 --- a/apps/desktop/src/main/agent-runtime.test.ts +++ b/apps/desktop/src/main/agent-runtime.test.ts @@ -117,7 +117,8 @@ it('runs the shipped CLI through scoped transport, a real isolated worker and ex await engine.quiesce(child.id) expect(seen.filter((s) => s.sessionId === child.id)).toHaveLength(1) expect(seen[0]?.workspacePath).not.toBe(repo) - expect(seen[0]?.prompt).toContain('ari --skill') + expect(seen[0]?.prompt).toContain('not written by the user') + expect(seen[0]?.prompt).toContain('$ARI_CLI --skill') expect(runtime.environment(child).ARI_CONTROL_TOKEN).not.toBe(env.ARI_CONTROL_TOKEN) const transcript = (await cli('session', 'read', child.id)) as { result: { messages: { text: string }[] } diff --git a/apps/desktop/src/main/engine.ts b/apps/desktop/src/main/engine.ts index 17f669f3..bdc3b5f6 100644 --- a/apps/desktop/src/main/engine.ts +++ b/apps/desktop/src/main/engine.ts @@ -536,7 +536,7 @@ export class Engine { workspacePath, prompt: runtimeEnv?.ARI_ENV === '1' - ? `[Ari control surface: this session can operate Ari. Commands: ari env, ari agents, ari session spawn|prompt|wait|read|diff|integrate|stop|destroy. Full protocol: ari --skill. Never disclose ARI_CONTROL_TOKEN.]\n\n${prompt}` + ? `[Ari control surface: added automatically by the Ari desktop app, not written by the user. This session can operate Ari through the CLI at $ARI_CLI. Commands: env, agents, session spawn|prompt|wait|read|diff|integrate|stop|destroy. Full protocol: $ARI_CLI --skill. Never disclose ARI_CONTROL_TOKEN.]\n\n${prompt}` : prompt, modelId: session.modelId, permissionMode: session.permissionMode,