Files
loki/scripts/test/executor-honesty-names-builder.ts
CatoandClaude 9a035a1f93 fix(control): no dead ends when nothing is running; name the builder that is online (#957)
From the same phone session as #954/#956:

- Control's peek drawer: Live streamed an empty grey box and Snapshot
  printed the runner's raw "No running agent for …". Both now say so in
  words, with one next action ("Start it from the project"), and show
  "Setting up — the agent starts next" when a kickoff is running, or
  "Queued — waiting for a builder" (+ Connect your computer) when that is
  where it stopped. A "Not running" row no longer fires a 45s peek at all.
- Activity's empty state had its hierarchy inverted on the dark surface (the
  heading dimmer than the body) and said "Dispatch a prompt" with nothing to
  press. It now reads "Setting up this project" during a kickoff, and
  otherwise explains what will land there with a button to start.
- Loki chat and Control's intent panel said a bare "Builder online" while
  Terminal showed the cloud builder grey — both true (only the laptop was
  up) but it read as a contradiction. With one builder up the chip now names
  it ("This computer online" / "Cloud builder online"); both up keeps the
  short label, so the composer row gains no width.


Claude-Session: https://claude.ai/code/session_016aYbEpWEk7bkf1qt44Xtbh

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-28 05:54:30 -07:00

40 lines
1.4 KiB
TypeScript

/**
* Unscoped surfaces (Loki chat, Control's intent panel) name WHICH builder is
* online. A bare "Builder online" sat beside Terminal's grey Cloud builder on
* 2026-09-28 — only the laptop was up — and read as a contradiction.
*
* Run: npx tsx scripts/test/executor-honesty-names-builder.ts
*/
import { deriveExecutorHonestyLabel } from "@/lib/executor-honesty";
import { EXECUTOR_COPY } from "@/config/executor-copy";
function assert(condition: unknown, message: string): asserts condition {
if (!condition) throw new Error(message);
}
const label = (presence: { cloud: boolean; local: boolean } | null) =>
deriveExecutorHonestyLabel({ runnerConnected: true, presence })?.label;
assert(
label({ cloud: false, local: true }) === EXECUTOR_COPY.builder.localComputerOnline,
"laptop only",
);
assert(label({ cloud: true, local: false }) === EXECUTOR_COPY.builder.cloudOnline, "cloud only");
assert(
label({ cloud: true, local: true }) === EXECUTOR_COPY.honesty.builderStarting,
"both up keeps the short label",
);
assert(
label(null) === EXECUTOR_COPY.honesty.builderStarting,
"unknown split keeps the generic label",
);
assert(
deriveExecutorHonestyLabel({
runnerConnected: true,
scope: "cloud",
presence: { cloud: false, local: true },
})?.label === EXECUTOR_COPY.builder.cloudOnline,
"an explicit scope still wins",
);
console.log("✓ executor honesty names the builder");