Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/mobile/src/state/thread-task-permissions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ vi.mock("./threads", async () => {
sequenceAtom: () => Atom.make(0),
pendingRequestsAtom: () => Atom.make(state.pendingRequests),
},
sandboxStartQueue: { sandboxStartRunId: () => Atom.make(null) },
threadEnvironment: {
respondToApproval: state.approve,
respondToUserInput: state.answer,
Expand Down
13 changes: 10 additions & 3 deletions apps/server/src/sandbox/sandboxSetup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,13 +196,16 @@ echo x >>"$HOME/curl.calls"
);
});

// Stand-ins for sudo and Tailscale's binaries, so the scripts run without root. The daemon never
// gets a TUN device, which is what a container gives tailscaled. `up` returns before the node has
// registered, as when its first register request hangs past the timeout and a retry succeeds.
// Stand-ins for sudo, systemctl, and Tailscale's binaries, so the scripts run without root and
// never touch the host's tailscaled unit. The daemon never gets a TUN device, which is what a
// container gives tailscaled. `up` returns before the node has registered, as when its first
// register request hangs past the timeout and a retry succeeds.
const TAILSCALE_STUBS = {
sudo: `#!/bin/sh
[ "$1" = -n ] && shift
exec "$@"`,
systemctl: `#!/bin/sh
exit 1`,
tailscaled: `#!/bin/sh
echo "$*" >"$T3_STUB/tailscaled.args"
echo "$TS_ASSUME_NETWORK_UP_FOR_TEST" >"$T3_STUB/tailscaled.assume-up"
Expand Down Expand Up @@ -277,6 +280,9 @@ describe("tailscaleScript", () => {
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const root = `${stub}/root`;
// Any character device passes the script's TUN check, so kernel mode is tried first.
yield* fs.makeDirectory(`${root}/dev/net`, { recursive: true });
yield* fs.symlink("/dev/null", `${root}/dev/net/tun`);
const authKey = "tskey-auth-'$(touch pwned)\"";
const join = tailscaleScript({ authKey, hostname: "t3-sandbox-web", root });
expect(revealsSecret(join.command, authKey)).toBe(false);
Expand All @@ -302,6 +308,7 @@ describe("tailscaleScript", () => {

// A daemon that still answers in the recorded mode is left running.
const starts = yield* fs.readFileString(`${stub}/starts`);
expect(starts).toBe("start\nstart\n");
const restart = tailscaleScript({ hostname: "t3-sandbox-web", root });
expect(restart.secrets).toBeUndefined();
const resumed = parseTailscaleReport(yield* run(restart));
Expand Down
3 changes: 2 additions & 1 deletion apps/server/src/sandbox/sandboxSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ const AS_ROOT = `as_root() {

// `root` prefixes every system path, so tests can run the scripts without root.
const tailscalePaths = (root: string) => ({
tun: `${root}/dev/net/tun`,
run: `${root}/run/tailscale`,
socket: `${root}/run/tailscale/tailscaled.sock`,
pidFile: `${root}/run/tailscale/t3-tailscaled.pid`,
Expand Down Expand Up @@ -387,7 +388,7 @@ if answering; then
fi
fi
if [ -z "$mode" ]; then
if [ -c /dev/net/tun ] && start kernel && has_tun; then
if [ -c ${paths.tun} ] && start kernel && has_tun; then
mode=kernel
else
stop
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { EnvironmentId, ThreadId, type OrchestrationV2ThreadShell } from "@t3tools/contracts";
import {
EnvironmentId,
ProviderInstanceId,
ThreadId,
type OrchestrationV2ThreadShell,
} from "@t3tools/contracts";
import * as Cause from "effect/Cause";
import { expect, it, vi } from "vite-plus/test";

Expand All @@ -12,10 +17,11 @@ const { read, toast } = vi.hoisted(() => ({
const childEnvironmentId = EnvironmentId.make("child-environment");
const childThreadId = ThreadId.make("child-thread");
const parentEnvironmentId = EnvironmentId.make("parent-environment");
// The panel reads only identity, lineage and delegation from the current thread.
// The panel reads only identity, model, lineage and delegation from the current thread.
const child = {
id: childThreadId,
title: "Child",
modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5" },
lineage: { rootThreadId: childThreadId, parentThreadId: null, relationshipToParent: null },
forkedFrom: null,
delegatedFrom: {
Expand Down