Files
cobble/src/bots-queue/compose-envs-note.test.ts
T
tbenandClaude Opus 5.5 2896e76256 Stop computer bash commands on the computer itself
The sandbox ignores sandbox_execute_bash's timeout and runs every call in
one shared shell session, so a command that never ended (a network read
without a timeout, a prompt) kept running after the call gave up, and
every later command on that computer, from any run, timed out behind it.
Each command now runs in its own bash under coreutils timeout (at most
ComputerCommandMaxSeconds, below McpToolTimeoutMs), reading no input, and
says when it was stopped.

Replies' env list says where each key comes from and that workspace,
computer and install-wide envs reach every bot there, so bots stop
telling users a workspace's keys must be set per bot. The computer
prompt says installed programs may be gone after a restart. An empty
open-only task list says closed tasks aren't shown, and update_task says
when a status was already set.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-28 04:34:39 +01:00

42 lines
1.8 KiB
TypeScript

import { describe, expect, test } from "bun:test";
import composeEnvsNote from "./compose-envs-note";
describe("composeEnvsNote", () => {
test("lists the computer's envs and the tools-only ones apart", () => {
const note = composeEnvsNote({
on_computer: [{ key: "DB_PASSWORD", description: "Production database" }],
tools_only: [{ key: "API_TOKEN", description: "" }],
has_computer: true,
});
expect(note).toContain("- DB_PASSWORD: Production database");
expect(note).toContain("- API_TOKEN");
expect(note).not.toContain("- API_TOKEN:");
expect(note.indexOf("DB_PASSWORD")).toBeLessThan(note.indexOf("Only in tools"));
expect(note).toContain("Don't ask the user for them");
});
test("says where each env comes from", () => {
const note = composeEnvsNote({
on_computer: [{ key: "DB_PASSWORD", description: "Production database", paradigm: "workspace" }],
tools_only: [{ key: "TOKEN", description: "", paradigm: "user" }],
has_computer: true,
});
expect(note).toContain("- DB_PASSWORD (this workspace's, every bot in it has it): Production database");
expect(note).toContain("- TOKEN (this user's own, for you)");
expect(note).toContain("never needs setting again per bot");
});
test("never mentions values", () => {
const note = composeEnvsNote({ on_computer: [{ key: "K", description: "d" }], tools_only: [], has_computer: true });
expect(note).not.toContain("Only in tools");
expect(note).toContain("you never see values");
});
test("says so when nothing is set", () => {
expect(composeEnvsNote({ on_computer: [], tools_only: [], has_computer: false })).toContain("No envs are set");
});
});