Skip to content
Open
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
5 changes: 5 additions & 0 deletions .mux/tool_env
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
# Keep PATH resolution and step logging deterministic across tool calls.
# This mirrors the proven workflow the team liked in coder-k8s.

# Leaked SSH vars make Debian's /etc/bash.bashrc SSH heuristic source itself in
# non-interactive make recipe shells, where its unguarded $PS1 fails under
# `.SHELLFLAGS -eu` and breaks make targets.
unset SSH_CLIENT SSH_CONNECTION SSH2_CLIENT

mux_use_nix_devshell_path() {
local flake_root=""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,18 @@ export function useDevToolsSubscription(workspaceId: string) {
case "step-updated":
setStepsByRun((previousStepsByRun) => upsertStep(previousStepsByRun, event.step));
break;
case "runs-evicted": {
const evictedRunIds = new Set(event.runIds);
setRuns((previousRuns) => previousRuns.filter((run) => !evictedRunIds.has(run.id)));
setStepsByRun((previousStepsByRun) => {
const nextStepsByRun = new Map(previousStepsByRun);
for (const runId of evictedRunIds) {
nextStepsByRun.delete(runId);
}
return nextStepsByRun;
});
break;
}
case "cleared":
setRuns([]);
setStepsByRun(new Map());
Expand Down
4 changes: 4 additions & 0 deletions src/common/orpc/schemas/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2481,6 +2481,10 @@ const DevToolsEventSchema = z.discriminatedUnion("type", [
type: z.literal("step-updated"),
step: DevToolsStepSchema,
}),
z.object({
type: z.literal("runs-evicted"),
runIds: z.array(z.string()),
}),
z.object({
type: z.literal("cleared"),
}),
Expand Down
13 changes: 11 additions & 2 deletions src/common/types/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,19 @@ export type DevToolsEvent =
| { type: "run-updated"; run: DevToolsRunSummary }
| { type: "step-created"; step: DevToolsStep }
| { type: "step-updated"; step: DevToolsStep }
| { type: "runs-evicted"; runIds: string[] }
| { type: "cleared" };

/** One line in devtools.jsonl — append-only log format. */
/**
* One line in devtools.jsonl — append-only log format. The meta entries pair
* a rotated snapshot with the live log written after it: loading skips a live
* log whose generation predates the snapshot's, so a crash between the
* snapshot rename and the live-log rewrite cannot resurrect evicted runs.
*/
export type DevToolsLogEntry =
| { type: "run"; run: DevToolsRun }
| { type: "step"; step: DevToolsStep }
| { type: "step-update"; stepId: string; update: Partial<DevToolsStep> };
| { type: "step-update"; stepId: string; update: Partial<DevToolsStep> }
| { type: "snapshot-meta"; generation: number }
| { type: "log-meta"; generation: number }
| { type: "log-retire"; generation: number };
4 changes: 4 additions & 0 deletions src/constants/devtools.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Live workspaces can accumulate API debug logs indefinitely.
export const DEVTOOLS_LOG_MAX_BYTES = 50 * 1024 * 1024;

export const DEVTOOLS_LOG_ROTATED_SUFFIX = ".1";
Loading
Loading