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
2 changes: 2 additions & 0 deletions apps/mobile/src/components/ui/AppSymbol.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ import IconListNumbers from "@tabler/icons-react-native/IconListNumbers";
import IconMenu2 from "@tabler/icons-react-native/IconMenu2";
import IconMessageCircleQuestion from "@tabler/icons-react-native/IconMessageCircleQuestion";
import IconMessage from "@tabler/icons-react-native/IconMessage";
import IconMail from "@tabler/icons-react-native/IconMail";
import IconMessageDots from "@tabler/icons-react-native/IconMessageDots";
import IconMessagePlus from "@tabler/icons-react-native/IconMessagePlus";
import IconMinus from "@tabler/icons-react-native/IconMinus";
Expand Down Expand Up @@ -208,6 +209,7 @@ const ANDROID_ICON_BY_SF_SYMBOL = {
ellipsis: IconDots,
moon: IconMoon,
"ellipsis.circle": IconDotsCircleHorizontal,
"envelope.badge": IconMail,
"exclamationmark.triangle": IconAlertTriangle,
"exclamationmark.circle": IconAlertCircle,
eye: IconEye,
Expand Down
9 changes: 9 additions & 0 deletions apps/mobile/src/features/threads/thread-list-v2-items.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
});

const visitThread = useAtomCommand(threadEnvironment.visit, { reportFailure: false });
const markThreadUnread = useAtomCommand(threadEnvironment.markUnread, { reportFailure: false });
const handleAcknowledgeWoke = useCallback(() => {
if (props.wokeAt === null) return;
void visitThread({
Expand Down Expand Up @@ -945,6 +946,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
supported: props.titleRegenerationSupported,
isRegenerating: isRegeneratingTitle,
}),
{ id: "mark-unread", title: "Mark unread", image: "envelope.badge" },
...(canTurnIntoProject
? [
{
Expand Down Expand Up @@ -1059,6 +1061,12 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
if (nativeEvent.event === "rename") handleRename();
if (nativeEvent.event === "regenerate-title") handleRegenerateTitle();
if (nativeEvent.event === "turn-into-project") void turnThreadIntoProject(thread);
if (nativeEvent.event === "mark-unread") {
void markThreadUnread({
environmentId: thread.environmentId,
input: { threadId: thread.id },
});
}
if (nativeEvent.event === "copy-thread") {
const target = threadChipCopyTarget(
{ environmentId: thread.environmentId, threadId: thread.id },
Expand Down Expand Up @@ -1107,6 +1115,7 @@ export const ThreadListV2Row = memo(function ThreadListV2Row(props: {
handleUnpin,
handleUnsettle,
handleUnsnooze,
markThreadUnread,
setCustomSnoozeOpen,
snoozePresets,
props.snoozePresets,
Expand Down
66 changes: 66 additions & 0 deletions apps/server/src/cli/pair.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,72 @@ describe("t3 pair", () => {
assert.include(String(error), "127.0.0.2");
}).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
);

// regression: #37459 - on Linux without an operator, tailscaled refuses Serve config
// from a normal user, and the CLI must say how to fix it.
it.effect("explains the operator fix when Tailscale denies the Serve config", () =>
Effect.gen(function* () {
const baseDir = NodeFS.mkdtempSync(NodePath.join(NodeOS.tmpdir(), "t3-pair-remote-"));
yield* persistServerRuntimeState({
path: NodePath.join(baseDir, "userdata", "server-runtime.json"),
state: yield* makePersistedServerRuntimeState({
config: { host: "127.0.0.1", devUrl: undefined },
port: 3773,
}),
});
const spawner = ChildProcessSpawner.make((command) => {
const { args } = command as unknown as { readonly args: ReadonlyArray<string> };
const serve = args[0] === "serve" && args[1] !== "status";
return Effect.succeed(
ChildProcessSpawner.makeHandle({
pid: ChildProcessSpawner.ProcessId(1),
exitCode: Effect.succeed(ChildProcessSpawner.ExitCode(serve ? 1 : 0)),
isRunning: Effect.succeed(false),
kill: () => Effect.void,
unref: Effect.succeed(Effect.void),
stdin: Sink.drain,
stdout: Stream.make(
new TextEncoder().encode(
serve
? ""
: args[0] === "status"
? '{"Self":{"DNSName":"pair-test.tail.ts.net."}}'
: "{}",
),
),
stderr: Stream.make(
new TextEncoder().encode(
serve
? "sending serve config: Access denied: serve config denied\n\nUse 'sudo tailscale serve --https=443 --bg http://127.0.0.1:3773'.\nTo not require root, use 'sudo tailscale set --operator=$USER' once.\n"
: "",
),
),
all: Stream.empty,
getInputFd: () => Sink.drain,
getOutputFd: () => Stream.empty,
}),
);
});

const error = yield* provideCliTestLayers(
runCli(["pair", "--base-dir", baseDir, "--tailscale"]).pipe(
Effect.provideService(ChildProcessSpawner.ChildProcessSpawner, spawner),
Effect.provideService(HostProcess.Platform, "linux"),
Effect.provideService(FetchHttpClient.Fetch, async (input) => {
if (String(input) === "http://127.0.0.1:3773/.well-known/t3/environment") {
return Response.json(testDescriptor);
}
assert.equal(String(input), "https://pair-test.tail.ts.net/.well-known/t3/environment");
return new Response(null, { status: 503 });
}),
Effect.flip,
),
);

assert.include(String(error), "sudo tailscale set --operator=$USER");
assert.notInclude(String(error), "by hand to see why");
}).pipe(Effect.provide(Layer.mergeAll(NodeServices.layer, NodeCrypto.layer))),
);
});

describe("auth scope options", () => {
Expand Down
29 changes: 22 additions & 7 deletions apps/server/src/cli/pair.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,15 @@ export class TailscaleServeFailedError extends Schema.TaggedError<TailscaleServe
}
}

export class TailscaleOperatorRequiredError extends Schema.TaggedError<TailscaleOperatorRequiredError>()(
"TailscaleOperatorRequiredError",
{ cause: Schema.Defect() },
) {
override get message(): string {
return "Tailscale refused the Serve config because this user is not its operator. Run `sudo tailscale set --operator=$USER` once, then run this command again.";
}
}

export class TailscaleServeTargetRefusedError extends Schema.TaggedError<TailscaleServeTargetRefusedError>()(
"TailscaleServeTargetRefusedError",
{ localHost: Schema.String },
Expand Down Expand Up @@ -425,6 +434,7 @@ const resolveTailscalePairingBase = Effect.fn("pair.resolveTailscalePairingBase"
}
// The probe above fails whenever this host cannot reach its own MagicDNS name, so the Serve
// config, not the probe, decides whether the port is free.
const platform = yield* HostProcess.Platform;
const holder = yield* readTailscaleServeRootHolder(input.servePort, {
host: (localTarget.localHost ?? "127.0.0.1").replace(/^\[|\]$/gu, ""),
port: localTarget.localPort,
Expand All @@ -437,13 +447,18 @@ const resolveTailscalePairingBase = Effect.fn("pair.resolveTailscalePairingBase"
servePort: input.servePort,
...(localTarget.localHost !== undefined ? { localHost: localTarget.localHost } : {}),
}).pipe(
Effect.mapError((cause) =>
cause._tag === "TailscaleCommandExitError" &&
cause.stderrDiagnostic === "unsupported-target" &&
localTarget.localHost !== undefined
? new TailscaleServeTargetRefusedError({ localHost: localTarget.localHost })
: new TailscaleServeFailedError({ servePort: input.servePort, cause }),
),
Effect.mapError((cause) => {
const diagnostic =
cause._tag === "TailscaleCommandExitError" ? cause.stderrDiagnostic : undefined;
if (diagnostic === "unsupported-target" && localTarget.localHost !== undefined) {
return new TailscaleServeTargetRefusedError({ localHost: localTarget.localHost });
}
// Only Linux tailscaled has an operator; elsewhere a denial needs another fix.
if (diagnostic === "permission-denied" && platform === "linux") {
return new TailscaleOperatorRequiredError({ cause });
}
return new TailscaleServeFailedError({ servePort: input.servePort, cause });
}),
);
notes.push(
`Tailscale Serve now maps ${baseUrl} to this server and persists across restarts. Remove it with \`tailscale serve --https=${String(input.servePort)} --set-path=/ off\`.`,
Expand Down
89 changes: 43 additions & 46 deletions apps/server/src/provider/ProviderRegistry.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1375,57 +1375,24 @@ it.layer(
);
});

it("drops Grok models a completed probe no longer advertises", () => {
it.each([
["grok", "warning"],
["cursor", "error"],
["muse", "error"],
["fx", "warning"],
] as const)("drops %s models a completed listing no longer returns", (driver, failedStatus) => {
const previousProvider = {
instanceId: ProviderInstanceId.make("grok"),
driver: ProviderDriverKind.make("grok"),
status: "ready",
enabled: true,
installed: true,
auth: { status: "authenticated" },
checkedAt: "2026-09-30T00:00:00.000Z",
version: "1.0.44",
models: [
{ slug: "grok-4.7", name: "Grok 4.7", isCustom: false, capabilities: null },
{ slug: "codexhub-removed", name: "Removed", isCustom: false, capabilities: null },
],
slashCommands: [],
skills: [],
} as const satisfies ServerProvider;
const refreshedProvider = {
...previousProvider,
checkedAt: "2026-09-30T00:01:00.000Z",
models: [previousProvider.models[0]],
} satisfies ServerProvider;
const acpFailedProvider = {
...refreshedProvider,
status: "warning",
message: "Grok CLI is installed but ACP initialize failed.",
} satisfies ServerProvider;

assert.deepStrictEqual(
ProviderRegistry.mergeProviderSnapshot(previousProvider, refreshedProvider).models,
[previousProvider.models[0]],
);
assert.deepStrictEqual(
ProviderRegistry.mergeProviderSnapshot(previousProvider, acpFailedProvider).models,
[...previousProvider.models],
);
});

it("drops Cursor models a completed catalog read no longer returns", () => {
const previousProvider = {
instanceId: ProviderInstanceId.make("cursor"),
driver: ProviderDriverKind.make("cursor"),
instanceId: ProviderInstanceId.make(driver),
driver: ProviderDriverKind.make(driver),
status: "ready",
enabled: true,
installed: true,
auth: { status: "authenticated" },
checkedAt: "2026-10-30T00:00:00.000Z",
version: "1.0.0",
models: [
{ slug: "composer-2", name: "Composer 2", isCustom: false, capabilities: null },
{ slug: "retired-model-x", name: "Retired", isCustom: false, capabilities: null },
{ slug: "current-model", name: "Current", isCustom: false, capabilities: null },
{ slug: "retired-model", name: "Retired", isCustom: false, capabilities: null },
],
slashCommands: [],
skills: [],
Expand All @@ -1437,9 +1404,7 @@ it.layer(
} satisfies ServerProvider;
const failedProvider = {
...refreshedProvider,
status: "error",
auth: { status: "unknown" },
message: "Cursor SDK model discovery timed out.",
status: failedStatus,
} satisfies ServerProvider;

assert.deepStrictEqual(
Expand All @@ -1452,6 +1417,38 @@ it.layer(
);
});

it.each(["kiro", "claudeAgent"] as const)(
"keeps %s models a ready probe can omit",
(driver) => {
const previousProvider = {
instanceId: ProviderInstanceId.make(driver),
driver: ProviderDriverKind.make(driver),
status: "ready",
enabled: true,
installed: true,
auth: { status: "authenticated" },
checkedAt: "2026-10-30T00:00:00.000Z",
version: "1.0.0",
models: [
{ slug: "built-in-model", name: "Built-in", isCustom: false, capabilities: null },
{ slug: "listed-model", name: "Listed", isCustom: false, capabilities: null },
],
slashCommands: [],
skills: [],
} as const satisfies ServerProvider;
const partialProvider = {
...previousProvider,
checkedAt: "2026-10-30T00:01:00.000Z",
models: [previousProvider.models[0]],
} satisfies ServerProvider;

assert.deepStrictEqual(
ProviderRegistry.mergeProviderSnapshot(previousProvider, partialProvider).models,
[...previousProvider.models],
);
},
);

it("retains stale OpenCode models when a refresh fails or lists none", () => {
const previousProvider = {
instanceId: ProviderInstanceId.make("opencode"),
Expand Down
22 changes: 14 additions & 8 deletions apps/server/src/provider/ProviderRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,20 +210,26 @@ const shouldRetainMissingProviderModels = (provider: ServerProvider): boolean =>
);
}

if (
provider.driver === ProviderDriverKind.make("grok") ||
provider.driver === ProviderDriverKind.make("cursor")
) {
// Grok and Cursor report ready only after they discover a model list; the pending,
// failed, empty-inventory, and logged-out probes are warning/error.
return !(provider.installed && provider.status === "ready");
if (provider.driver === ProviderDriverKind.make("kiro")) {
// Kiro is ready once `whoami` confirms the account, even when `--list-models` failed and
// the snapshot fell back to the built-in list.
return true;
}

if (provider.driver === ProviderDriverKind.make("claudeAgent")) {
// Claude Code keeps one gateway model cache per Claude home, for one base URL at a time, so a
// ready probe can omit this instance's gateway models after another instance or a terminal
// `claude` on a different gateway rewrote that cache.
return true;
}

const isAntigravity = provider.driver === ProviderDriverKind.make("antigravity");
const isCodex = provider.driver === ProviderDriverKind.make("codex");
const isOpenCode = provider.driver === ProviderDriverKind.make("opencode");
if (!isAntigravity && !isCodex && !isOpenCode) {
return true;
// Any other driver must report ready only after a completed model listing, or opt out above:
// a ready list is authoritative, and warning/error probes keep the old models.
return !(provider.installed && provider.status === "ready");
}

if (
Expand Down
Loading
Loading