Files
loki/scripts/test/agent-launch-check.ts
CatoandClaude Opus 5.5 afb39da877 fix(agents): each project is offered what its own builder has, and a missing CLI is said, not launched (#1262)
* fix(agents): each project is offered what its own builder has, and a missing CLI is said, not launched

- Control offered one agent list for the whole panel, read from the
  computer's report first, so a cloud project was offered Codex because the
  laptop had it. Each card now gets the list of the builder that will run
  that project (the same answer dispatch gives: locus lock, builder_pref,
  cloud), and an agent that builder lacks reads "not on the cloud builder".
  A builder that has not reported changes nothing (unknown, not none).
- A builder about to launch a CLI it does not have used to open a terminal
  on "command not found", and the run read as an agent that never answered.
  launchAgentPty now refuses first: "Codex is not installed on the cloud
  builder, so nothing was started. Switch this project to an agent installed
  there, or install Codex on the cloud builder, then try again."
- The next-step suggestions told the model the agent was "Claude Code" in
  every session. They now name the agent actually running (looked up from
  its adapter id; no free text reaches the system prompt).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* chore(desktop): Fleet Runner 0.8.43 — the launch check reaches computers

The launch check lives in desktop/src/main/pty-runtime.ts, so it reaches a
computer only with a release; desktop-release-drift (new on main) is right to
refuse it at 0.8.42. Bump and record the release.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-17 18:41:08 +02:00

27 lines
1.2 KiB
TypeScript

/**
* A builder refuses to launch an agent CLI it does not have, in words
* (src/lib/agents/launch-check.ts). Before, a Codex project sent to the cloud
* builder opened a terminal on "codex: command not found" and the run read as
* an agent that never answered.
*
* Run: npx tsx scripts/test/agent-launch-check.ts
*/
import assert from "node:assert/strict";
import { agentNotInstalledMessage, missingAgentReason } from "@/lib/agents/launch-check";
const cloud = agentNotInstalledMessage("Codex", "cloud");
assert.match(cloud, /^Codex is not installed on the cloud builder, so nothing was started\./);
assert.match(cloud, /Switch this project to an agent installed there/);
assert.match(cloud, /or install Codex on the cloud builder/);
assert.match(agentNotInstalledMessage("Grok", "local"), /not installed on this computer/);
assert.match(agentNotInstalledMessage("Grok", null), /not installed on this builder/);
assert.equal(missingAgentReason("claude", "cloud"), null, "Claude is never refused here");
assert.equal(
missingAgentReason("no-such-agent", "cloud"),
null,
"unknown ids are refused elsewhere",
);
console.log("✓ agent-launch-check: 7 checks passed");