fix(cli): t3 triage points agents at log files that exist (#13685)

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Theo BrowneandClaude Opus 5.5 authored and GitHub committed 2026-09-25 19:15:06 -07:00
1 parent 20885cecf7
commit 7c901a37c4
8 files changed
+23 -14

No files matched your search

+3 -2
View File
@@ -59,8 +59,9 @@ different code depending on it:
Then work from evidence, not assumption. In rough order of value:
- The server log and the trace file (`server.trace.ndjson`) around the time of the
problem. Recent failures usually leave a trail here.
- The trace file (`server.trace.ndjson`) around the time of the problem, plus the
service log or desktop backend logs from the context file if they exist. Recent
failures usually leave a trail here.
- The provider event log, for problems with claude/codex/cursor sessions.
- The SQLite database. Read it freely, but only write when a write is necessary
to fix the problem the user described, and get their explicit permission
-1
View File
@@ -508,7 +508,6 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
resolved.terminalLogsDir,
resolved.attachmentsDir,
resolved.worktreesDir,
path.dirname(resolved.serverLogPath),
path.dirname(resolved.serverTracePath),
]) {
expect(yield* fs.exists(directory)).toBe(true);
+6 -1
View File
@@ -27,6 +27,7 @@ import * as Schema from "effect/Schema";
import { Command, Flag } from "effect/unstable/cli";
import packageJson from "../../package.json" with { type: "json" };
import * as BootService from "../cloud/bootService.ts";
import * as ServerConfig from "../config.ts";
import { resolveBaseDir } from "../os-jank.ts";
import { isProcessAlive, readPersistedServerRuntimeState } from "../serverRuntimeState.ts";
@@ -201,7 +202,11 @@ export const triageCommand = Command.make("triage", {
dbPath: paths.dbPath,
settingsPath: paths.settingsPath,
logsDir: paths.logsDir,
serverLogPath: paths.serverLogPath,
// The server writes no log file of its own. Service installs and the
// desktop app capture its output. The glob covers every desktop backend
// (such as WSL) and rotated copies; names come from DesktopObservability.ts.
serviceLogPath: path.join(paths.logsDir, BootService.BOOT_SERVICE_LOG_FILE),
desktopBackendLogGlob: path.join(paths.logsDir, "server-child*.log*"),
serverTracePath: paths.serverTracePath,
providerEventLogPath: paths.providerEventLogPath,
terminalLogsDir: paths.terminalLogsDir,
+4 -1
View File
@@ -52,7 +52,8 @@ it("context file carries every path the playbook depends on", () => {
dbPath: "/home/u/.t3/userdata/state.sqlite",
settingsPath: "/home/u/.t3/userdata/settings.json",
logsDir: "/home/u/.t3/userdata/logs",
serverLogPath: "/home/u/.t3/userdata/logs/server.log",
serviceLogPath: "/home/u/.t3/userdata/logs/boot-service.log",
desktopBackendLogGlob: "/home/u/.t3/userdata/logs/server-child*.log*",
serverTracePath: "/home/u/.t3/userdata/logs/server.trace.ndjson",
providerEventLogPath: "/home/u/.t3/userdata/logs/provider/events.log",
terminalLogsDir: "/home/u/.t3/userdata/logs/terminals",
@@ -63,6 +64,8 @@ it("context file carries every path the playbook depends on", () => {
});
assert.include(context, "/home/u/.t3/userdata/state.sqlite");
assert.include(context, "/home/u/.t3/userdata/logs/server.trace.ndjson");
assert.include(context, "/home/u/.t3/userdata/logs/boot-service.log");
assert.include(context, "/home/u/.t3/userdata/logs/server-child*.log*");
assert.include(context, "/home/u/.t3/userdata/logs/provider/events.log");
assert.include(context, "/home/u/.t3/userdata/secrets");
assert.include(context, "/home/u/.t3/source");
+7 -4
View File
@@ -71,8 +71,9 @@ different code depending on it:
Then work from evidence, not assumption. In rough order of value:
- The server log and the trace file (\`server.trace.ndjson\`) around the time of the
problem. Recent failures usually leave a trail here.
- The trace file (\`server.trace.ndjson\`) around the time of the problem, plus the
service log or desktop backend logs from the context file if they exist. Recent
failures usually leave a trail here.
- The provider event log, for problems with claude/codex/cursor sessions.
- The SQLite database. Read it freely, but only write when a write is necessary
to fix the problem the user described, and get their explicit permission
@@ -176,7 +177,8 @@ export interface TriageContextInput {
readonly dbPath: string;
readonly settingsPath: string;
readonly logsDir: string;
readonly serverLogPath: string;
readonly serviceLogPath: string;
readonly desktopBackendLogGlob: string;
readonly serverTracePath: string;
readonly providerEventLogPath: string;
readonly terminalLogsDir: string;
@@ -205,7 +207,8 @@ Generated by \`t3 triage\` at ${input.generatedAt}.
- Database (SQLite; write only with the user's explicit permission): ${input.paths.dbPath}
- Settings: ${input.paths.settingsPath}
- Logs dir: ${input.paths.logsDir}
- Server log: ${input.paths.serverLogPath}
- Service log (systemd/launchd service installs only): ${input.paths.serviceLogPath}
- Desktop backend logs (glob; one file per backend plus rotated copies; written only when a backend crashes or fails to start): ${input.paths.desktopBackendLogGlob}
- Server trace (ndjson): ${input.paths.serverTracePath}
- Provider event log: ${input.paths.providerEventLogPath}
- Terminal logs: ${input.paths.terminalLogsDir}
+3 -1
View File
@@ -43,6 +43,8 @@ const BOOT_SERVICE_UNIT_FILE = `${BOOT_SERVICE_NAME}.service`;
const BOOT_SERVICE_LAUNCHD_LABEL = "com.t3tools.t3code.service";
const BOOT_SERVICE_PLIST_FILE = `${BOOT_SERVICE_LAUNCHD_LABEL}.plist`;
const BOOT_SERVICE_UNIT_ENV = "T3_BOOT_SERVICE_UNIT";
/** File in the logs dir that receives the service's stdout and stderr. `t3 triage` points agents at it. */
export const BOOT_SERVICE_LOG_FILE = "boot-service.log";
/** systemd expands `%` specifiers, including in unquoted append-log paths. */
function escapeSystemdSpecifiers(value: string): string {
@@ -599,7 +601,7 @@ export const make = Effect.fn("cloud.boot_service.make")(function* (input: {
environmentPath,
});
const unitPath = detectedManager?.unitPath ?? "";
const logPath = path.join(input.logsDir, "boot-service.log");
const logPath = path.join(input.logsDir, BOOT_SERVICE_LOG_FILE);
const statePath = path.join(input.baseDir, "runtime", SERVICE_STATE_FILE);
const restartPendingPath = path.join(input.baseDir, "runtime", SERVICE_RESTART_PENDING_FILE);
const runtimePaths = pinnedRuntimePaths(path, input.baseDir, input.cliVersion, platform);
-2
View File
@@ -44,7 +44,6 @@ export interface ServerDerivedPaths {
/** Screenshots the agent asks the collaborative browser to keep for the user. */
readonly browserArtifactsDir: string;
readonly logsDir: string;
readonly serverLogPath: string;
readonly serverTracePath: string;
readonly providerLogsDir: string;
readonly providerEventLogPath: string;
@@ -154,7 +153,6 @@ export const deriveServerPaths = Effect.fn(function* (
attachmentsDir,
browserArtifactsDir: join(stateDir, "browser-artifacts"),
logsDir,
serverLogPath: join(logsDir, "server.log"),
serverTracePath: join(logsDir, "server.trace.ndjson"),
providerLogsDir,
providerEventLogPath: join(providerLogsDir, "events.log"),
-2
View File
@@ -603,5 +603,3 @@ Current high-value span and metric boundaries include:
- logs outside spans are not persisted in the trace file; SSH-managed launch stdout/stderr is still
captured in its launcher log
- metrics are not snapshotted locally
- the old `serverLogPath` still exists in config for compatibility, but the trace file is the primary
structured persisted artifact