The open-source agent harness - the runtime layer that turns an LLM into a working agent.
Improve error messages in local sandbox probe
Chirag Jain9d45ef9edc2b
diff --git a/packages/trueforge/src/sandbox/local/core/hostRun.ts b/packages/trueforge/src/sandbox/local/core/hostRun.tsindex 2453713fc..c96f7f9c7 100644--- a/packages/trueforge/src/sandbox/local/core/hostRun.ts+++ b/packages/trueforge/src/sandbox/local/core/hostRun.ts@@ -126,10 +126,21 @@ export const SRT_HOST_BINARIES_BY_PLATFORM = {darwin: [],} as const satisfies Record<LocalSandboxPlatform, readonly string[]>;+/** PATH executable → package name for install / support messages. */+export const SRT_HOST_BINARY_LABELS: Readonly<Record<string, string>> = {+ bwrap: 'bubblewrap',+ socat: 'socat',+ rg: 'ripgrep',+};+export function srtHostBinaryNames(platform: LocalSandboxPlatform): readonly string[] {return SRT_HOST_BINARIES_BY_PLATFORM[platform];}+export function srtHostBinaryLabel(executable: string): string {+ return SRT_HOST_BINARY_LABELS[executable] ?? executable;+}+/** SRT's own host-dep check (bwrap/socat/rg on Linux). Does not require initSrt. */export async function checkSrtHostDependencies(): Promise<{ errors: string[]; warnings: string[] }> {const result = await SandboxManager.checkDependenciesAsync();diff --git a/packages/trueforge/src/sandbox/local/provider/LocalSandboxProvider.ts b/packages/trueforge/src/sandbox/local/provider/LocalSandboxProvider.tsindex d03f8cada..b69625010 100644--- a/packages/trueforge/src/sandbox/local/provider/LocalSandboxProvider.ts+++ b/packages/trueforge/src/sandbox/local/provider/LocalSandboxProvider.ts@@ -41,6 +41,7 @@ import {resolvePythonExecutableOnHost,runSupervisorSession,SANDBOX_VENV_DIR,+ srtHostBinaryLabel,srtHostBinaryNames,type LocalSandboxPlatform,type SessionResult,@@ -94,11 +95,16 @@ export function formatLocalSandboxSupportReason(params: {return details.length === 0 ? params.summary : `${params.summary}: ${details}`;}+function supportAttemptLabel(attempt: LocalSandboxSupportProbeAttempt): string {+ return attempt.kind === 'host' ? srtHostBinaryLabel(attempt.name) : attempt.name;+}+function formatLocalSandboxSupportAttempt(attempt: LocalSandboxSupportProbeAttempt): string {+ const label = supportAttemptLabel(attempt);if (attempt.resolved === undefined) {- return attempt.kind === 'host' ? `${attempt.name}: not on PATH` : `${attempt.name}: not on sandbox PATH`;+ return `${label} binary not found. Either it is not installed or not on PATH`;}- const parts = [`${attempt.name}: resolved=${attempt.resolved}`];+ const parts = [`${label}: resolved=${attempt.resolved}`];if (attempt.executable !== undefined && attempt.executable !== attempt.resolved) {parts.push(`executable=${attempt.executable}`);}@@ -279,7 +285,7 @@ export class LocalSandboxProvider implements SandboxProvider {hostAttempts.push({ kind: 'host', name, resolved });}if (hostAttempts.some(attempt => attempt.resolved === undefined)) {- const required = srtHostBinaryNames(platform).join(', ');+ const required = srtHostBinaryNames(platform).map(srtHostBinaryLabel).join(', ');return unsupported({platform,attempts: hostAttempts,diff --git a/packages/trueforge/tests/unit/sandbox/local/provider/supportReason.test.ts b/packages/trueforge/tests/unit/sandbox/local/provider/supportReason.test.tsindex 93f6d2d82..21d384641 100644--- a/packages/trueforge/tests/unit/sandbox/local/provider/supportReason.test.ts+++ b/packages/trueforge/tests/unit/sandbox/local/provider/supportReason.test.ts@@ -1,4 +1,4 @@-import { srtHostBinaryNames } from '../../../../../src/sandbox/local/core/hostRun';+import { srtHostBinaryLabel, srtHostBinaryNames } from '../../../../../src/sandbox/local/core/hostRun';import { formatLocalSandboxSupportReason } from '../../../../../src/sandbox/local/provider/LocalSandboxProvider';describe('SRT host binaries', () => {@@ -6,16 +6,20 @@ describe('SRT host binaries', () => {expect(srtHostBinaryNames('linux')).toEqual(['bwrap', 'socat', 'rg']);});+ it('labels PATH executables with installable package names', () => {+ expect(srtHostBinaryNames('linux').map(srtHostBinaryLabel)).toEqual(['bubblewrap', 'socat', 'ripgrep']);+ });+it('requires no extra host binaries on macOS (seatbelt, no rg scan)', () => {expect(srtHostBinaryNames('darwin')).toEqual([]);});});describe('formatLocalSandboxSupportReason', () => {- it('reports missing host SRT binaries on PATH', () => {+ it('reports missing host SRT binaries with package names', () => {expect(formatLocalSandboxSupportReason({- summary: 'SRT host dependencies missing (linux: bwrap, socat, rg)',+ summary: 'SRT host dependencies missing (linux: bubblewrap, socat, ripgrep)',attempts: [{ kind: 'host', name: 'bwrap', resolved: undefined },{ kind: 'host', name: 'socat', resolved: '/usr/bin/socat' },@@ -23,7 +27,7 @@ describe('formatLocalSandboxSupportReason', () => {],}),).toBe(- 'SRT host dependencies missing (linux: bwrap, socat, rg): bwrap: not on PATH; socat: resolved=/usr/bin/socat; rg: not on PATH',+ 'SRT host dependencies missing (linux: bubblewrap, socat, ripgrep): bubblewrap binary not found. Either it is not installed or not on PATH; socat: resolved=/usr/bin/socat; ripgrep binary not found. Either it is not installed or not on PATH',);});