The best way to control Claude Code, Codex and more from any computer or phone
feat(observability): name the command on subprocess spans (#13701)
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Theo Browne committed
Sep 25, 2026 at 19:14 UTC
20885cecf77e205b8931ca1b29f0a2832836a157
2 files changed
+12
apps/server/src/processRunner.test.ts
+8
@@ -412,3 +412,11 @@ describe("isWindowsCommandNotFound", () => {
412
}),
413
);
414
});
415
+
416
+describe("commandName", () => {
417
+ it("drops the directory from POSIX and Windows paths", () => {
418
+ expect(ProcessRunner.commandName("/Users/me/.local/bin/claude")).toBe("claude");
419
+ expect(ProcessRunner.commandName("C:\\Program Files\\nodejs\\npx.cmd")).toBe("npx.cmd");
420
+ expect(ProcessRunner.commandName("git")).toBe("git");
421
+ });
422
+});
apps/server/src/processRunner.ts
+4
@@ -285,10 +285,14 @@ function finalizeRunProcess<R>(
285
);
286
}
287
288
+/** The executable name without its directory, recorded as `process.command` on process spans. */
289
+export const commandName = (command: string) => command.replace(/^.*[\\/]/, "");
290
+
291
const runProcessCore = Effect.fn("processRunner.runProcessCore")(function* (
292
spawner: ChildProcessSpawner.ChildProcessSpawner["Service"],
293
input: ProcessRunInput,
294
): Effect.fn.Return<ProcessRunOutput, ProcessRunError, Scope.Scope> {
295
+ yield* Effect.annotateCurrentSpan("process.command", commandName(input.command));
296
const maxOutputBytes = input.maxOutputBytes ?? DEFAULT_MAX_OUTPUT_BYTES;
297
const outputMode = input.outputMode ?? "error";
298
const truncatedMarker = input.truncatedMarker ?? "";