From 961f4118a9b4e8883ea9d3407e71b47f3dd9b13a Mon Sep 17 00:00:00 2001 From: eshurakov <54751+eshurakov@users.noreply.github.com> Date: Thu, 2 Jul 2026 08:17:04 +0000 Subject: [PATCH] refactor(cloud-agent-next): drop elapsed ms from process diagnostic The 'elapsed Nms' clause in createSafeProcessDiagnostic offered no operational signal to recipients (it varied by host, command, and redaction) and inflated the user-facing termination detail that gets re-prefixed by safe-failure-projection for every workspace-setup and command-runner error path. Internal ExecResult.elapsedMs is preserved for telemetry. Updates affected unit tests in wrapper/src and test/unit/wrapper/. Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com> --- .../cloud-agent-next/src/kilo/wrapper-ready-error.test.ts | 4 ++-- services/cloud-agent-next/test/unit/wrapper/utils.test.ts | 4 ++-- services/cloud-agent-next/wrapper/src/server.test.ts | 4 ++-- .../cloud-agent-next/wrapper/src/session-bootstrap.test.ts | 2 +- services/cloud-agent-next/wrapper/src/utils.ts | 1 - 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/services/cloud-agent-next/src/kilo/wrapper-ready-error.test.ts b/services/cloud-agent-next/src/kilo/wrapper-ready-error.test.ts index 2be1b3eb44..df1487cc76 100644 --- a/services/cloud-agent-next/src/kilo/wrapper-ready-error.test.ts +++ b/services/cloud-agent-next/src/kilo/wrapper-ready-error.test.ts @@ -11,7 +11,7 @@ describe('wrapper ready error parsing', () => { error: 'WORKSPACE_SETUP_FAILED', subtype: 'git_clone_timeout', message: 'Repository clone timed out', - detail: 'termination timeout, elapsed 120000ms, output truncated', + detail: 'termination timeout, output truncated', retryable: true, wrapperRunId: 'wrapper_run_1', }) @@ -19,7 +19,7 @@ describe('wrapper ready error parsing', () => { error: 'WORKSPACE_SETUP_FAILED', subtype: 'git_clone_timeout', message: 'Repository clone timed out', - detail: 'termination timeout, elapsed 120000ms, output truncated', + detail: 'termination timeout, output truncated', retryable: true, wrapperRunId: 'wrapper_run_1', }); diff --git a/services/cloud-agent-next/test/unit/wrapper/utils.test.ts b/services/cloud-agent-next/test/unit/wrapper/utils.test.ts index 5bf9507e29..c2a7a1eef1 100644 --- a/services/cloud-agent-next/test/unit/wrapper/utils.test.ts +++ b/services/cloud-agent-next/test/unit/wrapper/utils.test.ts @@ -63,7 +63,7 @@ describe('createSafeProcessDiagnostic', () => { stdoutTruncated: true, }); - expect(detail).toBe('termination nonzero exit, exit code 2, elapsed 42ms, output truncated'); + expect(detail).toBe('termination nonzero exit, exit code 2, output truncated'); for (const sensitiveValue of sensitiveValues) expect(detail).not.toContain(sensitiveValue); }); @@ -78,7 +78,7 @@ describe('createSafeProcessDiagnostic', () => { }, { result: { stdout: '', stderr: '', exitCode: 0, elapsedMs: 7 }, - expected: 'termination completed, elapsed 7ms', + expected: 'termination completed', }, ])('reports structured termination metadata', ({ result, expected }) => { expect(createSafeProcessDiagnostic(result)).toBe(expected); diff --git a/services/cloud-agent-next/wrapper/src/server.test.ts b/services/cloud-agent-next/wrapper/src/server.test.ts index 7c16f01dd8..098f0d8c8a 100644 --- a/services/cloud-agent-next/wrapper/src/server.test.ts +++ b/services/cloud-agent-next/wrapper/src/server.test.ts @@ -121,7 +121,7 @@ describe('session readiness errors', () => { code: 'WORKSPACE_SETUP_FAILED', subtype: 'git_clone_timeout', message: 'Repository clone timed out', - detail: 'termination timeout, elapsed 120000ms, output truncated', + detail: 'termination timeout, output truncated', retryable: true, }, }), @@ -156,7 +156,7 @@ describe('session readiness errors', () => { error: 'WORKSPACE_SETUP_FAILED', subtype: 'git_clone_timeout', message: 'Repository clone timed out', - detail: 'termination timeout, elapsed 120000ms, output truncated', + detail: 'termination timeout, output truncated', retryable: true, }); expect(fetchHandler).toBeDefined(); diff --git a/services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts b/services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts index 30bacf09e2..317da59365 100644 --- a/services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts +++ b/services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts @@ -738,7 +738,7 @@ describe('prepareWrapperBootstrapWorkspace', () => { }); expect(setupError.message).toBe('Setup command 1 failed'); expect(setupError).toMatchObject({ - detail: 'termination nonzero exit, exit code 1, elapsed 17ms, output truncated', + detail: 'termination nonzero exit, exit code 1, output truncated', }); const projectedError = JSON.stringify(setupError); for (const sensitiveValue of [ diff --git a/services/cloud-agent-next/wrapper/src/utils.ts b/services/cloud-agent-next/wrapper/src/utils.ts index 1e633bd136..9baefb4046 100644 --- a/services/cloud-agent-next/wrapper/src/utils.ts +++ b/services/cloud-agent-next/wrapper/src/utils.ts @@ -80,7 +80,6 @@ export function createSafeProcessDiagnostic(result: ExecResult): string { result.terminationReason === undefined && result.exitCode !== 0 ? `exit code ${result.exitCode}` : undefined, - result.elapsedMs === undefined ? undefined : `elapsed ${result.elapsedMs}ms`, result.stdoutTruncated === true || result.stderrTruncated === true ? TRUNCATION_MARKER : undefined,