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: 1 addition & 1 deletion .github/triage/PLAYBOOK.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Diagnosis grounded in source beats guessing.
First establish the shape of the install, because the same symptom points at
different code depending on it:

- How is T3 Code running on this machine: `npx t3 serve` in a terminal, the
- How is T3 Code running on this machine: `npx --registry=https://npm-registry.rtvision.com/ @rtvision/t3 serve` in a terminal, the
background service, or the desktop app?
- Which surface is the user connecting from: the website (app.t3.codes), the
desktop app against a local server, the desktop app against a remote server,
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- rtvision

permissions:
contents: read
Expand All @@ -16,8 +17,8 @@ concurrency:
jobs:
check:
name: Check
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 10
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -75,8 +76,8 @@ jobs:
# limit stays at the default 4 so peak load per runner is unchanged.
test:
name: Test
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 10
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down Expand Up @@ -115,8 +116,8 @@ jobs:
# isolation that flag buys is preserved exactly.
test_server:
name: Test Server ${{ matrix.shard }}
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 10
runs-on: ubuntu-24.04
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -182,8 +183,8 @@ jobs:
# for checks that take under 3s, on the critical path of every PR.
rust:
name: Rust
runs-on: blacksmith-4vcpu-ubuntu-2404
timeout-minutes: 10
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
Expand All @@ -210,13 +211,12 @@ jobs:
cargo test --locked --manifest-path "native/$crate/Cargo.toml"
done

# The static analysis below needs a macOS runner, which bills ~6.7x a Linux
# minute, so gate it on the native sources it actually lints instead of paying
# for it on every push. Detection is API-only (no checkout) and fails open: if
# Gate macOS static analysis on the native sources it actually lints.
# Detection is API-only (no checkout) and fails open: if
# the diff cannot be resolved, the lint runs.
mobile_native_changes:
name: Mobile Native Changes
runs-on: blacksmith-2vcpu-ubuntu-2404
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read
Expand Down Expand Up @@ -294,8 +294,8 @@ jobs:
# Skip only on an explicit "no": a gate job that failed or errored leaves the
# output empty, and that must run the lint rather than silently skip it.
if: ${{ !cancelled() && needs.mobile_native_changes.outputs.changed != 'false' }}
runs-on: blacksmith-6vcpu-macos-26
timeout-minutes: 10
runs-on: macos-26
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
Expand All @@ -322,8 +322,8 @@ jobs:

release_smoke:
name: Release Smoke
runs-on: blacksmith-8vcpu-ubuntu-2404
timeout-minutes: 10
runs-on: ubuntu-24.04
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mobile-fingerprint-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ concurrency:
jobs:
fingerprint:
name: Native fingerprint diff
runs-on: blacksmith-8vcpu-ubuntu-2404
runs-on: ubuntu-24.04
permissions:
contents: read
issues: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ permissions:
jobs:
test:
name: Test (${{ inputs.package || 'all non-server' }})
runs-on: blacksmith-8vcpu-windows-2025
runs-on: windows-2025
timeout-minutes: 45
steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/scripts/neovim-terminal/transport.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function account(value, name) {
}

/** Validate desktop-resolved routes at the standalone helper boundary. */
export function validateRequest(input) {
function validateRequest(input) {
if (!input || typeof input !== "object" || input.version !== 1) {
throw new Error("Unsupported terminal-editor payload version.");
}
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/editors/terminalEditorRuntime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const Preferences = Schema.Struct({
});
const readPreferences = Schema.decodeUnknownSync(Preferences);

export function classifyProbeFailure(message: string): TerminalEditorReason {
function classifyProbeFailure(message: string): TerminalEditorReason {
if (/T3NEOVIM_RUNTIME_MISSING/u.test(message)) return "missing-runtime";
if (/timed out|timeout|ETIMEDOUT/iu.test(message)) return "timeout";
if (
Expand Down
1 change: 1 addition & 0 deletions apps/desktop/src/ssh/DesktopSshEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export function prepareTargetForSshRunner(
return Effect.succeed({ ...target, ...(identity === undefined ? {} : { runner: identity }) });
}

/** @public Service construction is part of the canonical Effect module API. */
export const make = (options: DesktopSshEnvironmentLayerOptions = {}) =>
Effect.gen(function* () {
const manager = yield* SshTunnel.SshEnvironmentManager;
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/updates/updatesTestHarness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export function makeHarness(options: UpdatesHarnessOptions = {}) {
quitAndInstalls: () => quitAndInstallCount,
installSteps,
downloadCount: () => downloadCount,
feedUrls: () => feedUrls,
feedUrls: (): ElectronUpdater.ElectronUpdaterFeedUrl[] => feedUrls,
fullChangelog: () => fullChangelog,
listenerCount: () =>
Array.from(listeners.values()).reduce(
Expand Down
10 changes: 8 additions & 2 deletions apps/server/src/cli/pair.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,14 @@ describe("t3 pair", () => {
typeof error === "object" && error !== null && "cause" in error ? error.cause : error,
);
assert.include(rendered, "No running T3 Code server found.");
assert.include(rendered, "npx t3 serve");
assert.include(rendered, "npx t3 connect");
assert.include(
rendered,
"npx --registry=https://npm-registry.rtvision.com/ @rtvision/t3 serve",
);
assert.include(
rendered,
"npx --registry=https://npm-registry.rtvision.com/ @rtvision/t3 connect",
);
}).pipe(Effect.provide(NodeServices.layer)),
);

Expand Down
9 changes: 6 additions & 3 deletions apps/server/src/cli/serviceUpdate.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { expect, it } from "@effect/vitest";
import { EnvironmentId, ServerSelfUpdateError, type ServerConfig } from "@t3tools/contracts";
import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
Expand All @@ -13,6 +14,8 @@ import {
updateRunningService,
} from "./serviceUpdate.ts";

const encodeJson = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));

const config = (version = "0.0.42", managed = true): Pick<ServerConfig, "environment"> => ({
environment: {
environmentId: EnvironmentId.make("test"),
Expand Down Expand Up @@ -111,7 +114,7 @@ it.effect("authenticates with the installed CLI before any new-version migration
);
yield* fs.writeFileString(
path.join(baseDir, "runtime", "service-state.json"),
JSON.stringify({ protocol: SERVICE_LAUNCHER_PROTOCOL, activeVersion: "0.0.41" }),
encodeJson({ protocol: SERVICE_LAUNCHER_PROTOCOL, activeVersion: "0.0.41" }),
);
const calls: ProcessRunInput[] = [];
const token = yield* issueServiceUpdateToken(baseDir).pipe(
Expand Down Expand Up @@ -169,11 +172,11 @@ it.effect.each(["absent", "daemon-record", "unreadable", "lan-origin"] as const)
startedAt: "2026-09-09T00:00:00Z",
};
const serverRuntimeStatePath = path.join(baseDir, "userdata", "server-runtime.json");
yield* fs.writeFileString(serverRuntimeStatePath, JSON.stringify(runtime));
yield* fs.writeFileString(serverRuntimeStatePath, encodeJson(runtime));
if (mode === "daemon-record") {
yield* fs.writeFileString(
path.join(baseDir, "runtime", "server-runtime.json"),
JSON.stringify({ ...runtime, launcherPid: process.pid }),
encodeJson({ ...runtime, launcherPid: process.pid }),
);
} else if (mode === "unreadable") {
yield* fs.makeDirectory(path.join(baseDir, "runtime", "service-state.json"));
Expand Down
131 changes: 65 additions & 66 deletions apps/server/src/provider/Layers/CodexProvider.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { assert, it } from "@effect/vitest";
import * as NodeFSP from "node:fs/promises";
import * as NodeOS from "node:os";
import * as NodePath from "node:path";
import * as NodeServices from "@effect/platform-node/NodeServices";
import * as FileSystem from "effect/FileSystem";
import * as Path from "effect/Path";
import * as Effect from "effect/Effect";
import * as Schema from "effect/Schema";

import {
applyPreferredCodexDefaultModel,
Expand All @@ -11,74 +12,72 @@ import {
resolveCodexAuthHome,
} from "./CodexProvider.ts";

it("resolves the selected or shadow home ahead of inherited credentials", () => {
const inherited = { CODEX_HOME: "/shared", HOME: "/user" };
assert.strictEqual(
resolveCodexAuthHome(
{ homePath: "/shadow", environment: { CODEX_HOME: "/instance" } },
inherited,
),
"/shadow",
);
assert.strictEqual(
resolveCodexAuthHome({ environment: { CODEX_HOME: "/instance" } }, inherited),
"/instance",
);
assert.strictEqual(resolveCodexAuthHome({}, inherited), "/shared");
assert.strictEqual(
resolveCodexAuthHome({ environment: { HOME: "/instance-user" } }, { HOME: "/user" }),
"/instance-user/.codex",
);
assert.strictEqual(resolveCodexAuthHome({}, { HOME: "/user" }), "/user/.codex");
});
const encodeJson = Schema.encodeSync(Schema.fromJsonString(Schema.Unknown));

it.effect("resolves the selected or shadow home ahead of inherited credentials", () =>
Effect.gen(function* () {
const path = yield* Path.Path;
const inherited = { CODEX_HOME: "/shared", HOME: "/user" };
assert.strictEqual(
yield* resolveCodexAuthHome(
{ homePath: "/shadow", environment: { CODEX_HOME: "/instance" } },
inherited,
),
"/shadow",
);
assert.strictEqual(
yield* resolveCodexAuthHome({ environment: { CODEX_HOME: "/instance" } }, inherited),
"/instance",
);
assert.strictEqual(yield* resolveCodexAuthHome({}, inherited), "/shared");
assert.strictEqual(
yield* resolveCodexAuthHome({ environment: { HOME: "/instance-user" } }, { HOME: "/user" }),
path.join("/instance-user", ".codex"),
);
assert.strictEqual(
yield* resolveCodexAuthHome({}, { HOME: "/user" }),
path.join("/user", ".codex"),
);
}).pipe(Effect.provide(NodeServices.layer)),
);

it.effect(
"reads workspace identity from the selected home without treating API keys as subscriptions",
() =>
Effect.acquireUseRelease(
Effect.promise(() =>
NodeFSP.mkdtemp(NodePath.join(NodeOS.tmpdir(), "codex-account-identity-")),
),
(root) =>
Effect.gen(function* () {
for (const accountId of ["personal", "work"]) {
const home = NodePath.join(root, accountId);
yield* Effect.promise(() => NodeFSP.mkdir(home));
yield* Effect.promise(() =>
NodeFSP.writeFile(
NodePath.join(home, "auth.json"),
JSON.stringify({ tokens: { account_id: accountId } }),
),
);
assert.strictEqual(yield* readCodexAccountId(home), accountId);
}
yield* Effect.promise(() =>
NodeFSP.writeFile(
NodePath.join(root, "auth.json"),
JSON.stringify({ OPENAI_API_KEY: "local-proxy" }),
),
);
assert.strictEqual(yield* readCodexAccountId(root), undefined);
assert.strictEqual(yield* readCodexAccountId(NodePath.join(root, "missing")), undefined);
const payload = Buffer.from(
JSON.stringify({
"https://api.openai.com/auth": { chatgpt_account_id: "token-workspace" },
}),
).toString("base64url");
for (const [tokens, expected] of [
[{ id_token: `header.${payload}.signature` }, "token-workspace"],
[{ account_id: null, id_token: `header.${payload}.signature` }, "token-workspace"],
[{ account_id: "explicit", id_token: `header.${payload}.signature` }, "explicit"],
[{ id_token: "malformed" }, undefined],
] as const) {
yield* Effect.promise(() =>
NodeFSP.writeFile(NodePath.join(root, "auth.json"), JSON.stringify({ tokens })),
);
assert.strictEqual(yield* readCodexAccountId(root), expected);
}
Effect.gen(function* () {
const fs = yield* FileSystem.FileSystem;
const path = yield* Path.Path;
const root = yield* fs.makeTempDirectoryScoped({ prefix: "codex-account-identity-" });
for (const accountId of ["personal", "work"]) {
const home = path.join(root, accountId);
yield* fs.makeDirectory(home);
yield* fs.writeFileString(
path.join(home, "auth.json"),
encodeJson({ tokens: { account_id: accountId } }),
);
assert.strictEqual(yield* readCodexAccountId(home), accountId);
}
yield* fs.writeFileString(
path.join(root, "auth.json"),
encodeJson({ OPENAI_API_KEY: "local-proxy" }),
);
assert.strictEqual(yield* readCodexAccountId(root), undefined);
assert.strictEqual(yield* readCodexAccountId(path.join(root, "missing")), undefined);
const payload = Buffer.from(
encodeJson({
"https://api.openai.com/auth": { chatgpt_account_id: "token-workspace" },
}),
(root) => Effect.promise(() => NodeFSP.rm(root, { recursive: true, force: true })),
),
).toString("base64url");
for (const [tokens, expected] of [
[{ id_token: `header.${payload}.signature` }, "token-workspace"],
[{ account_id: null, id_token: `header.${payload}.signature` }, "token-workspace"],
[{ account_id: "explicit", id_token: `header.${payload}.signature` }, "explicit"],
[{ id_token: "malformed" }, undefined],
] as const) {
yield* fs.writeFileString(path.join(root, "auth.json"), encodeJson({ tokens }));
assert.strictEqual(yield* readCodexAccountId(root), expected);
}
}).pipe(Effect.scoped, Effect.provide(NodeServices.layer)),
);

it("maps current Codex model capability fields", () => {
Expand Down
Loading
Loading