Skip to content

The open-source agent harness - the runtime layer that turns an LLM into a working agent.

feat: implement HTTP timeout for Daytona sandbox execution (#1101)

Sujai Kumar Guptad233f4477daf
diff --git a/.changeset/daytona-exec-http-timeout.md b/.changeset/daytona-exec-http-timeout.md
new file mode 100644
index 000000000..f0d16f9b9
--- /dev/null
+++ b/.changeset/daytona-exec-http-timeout.md
@@ -0,0 +1,5 @@
+---
+'@truefoundry/trueforge': patch
+---
+
+Set Daytona `requestTimeoutMs` to 60s so the SDK applies a per-exec HTTP deadline (command timeout + 5s) and a hung toolbox response cannot leave a turn blocked without a tool.response.
diff --git a/packages/trueforge-core/tests/core/sandbox/daytonaSnapshotRegistration.test.ts b/packages/trueforge-core/tests/core/sandbox/daytonaSnapshotRegistration.test.ts
index d6a4c3f81..9b3b8fdd9 100644
--- a/packages/trueforge-core/tests/core/sandbox/daytonaSnapshotRegistration.test.ts
+++ b/packages/trueforge-core/tests/core/sandbox/daytonaSnapshotRegistration.test.ts
@@ -21,7 +21,7 @@ const DEFAULT_TEST_ENVIRONMENT = createDaytonaSandboxEnvironment({
*/
function makeProvider(): DaytonaSandboxProvider {
// useDeprecatedPolling keeps the constructor from opening the event-stream WebSocket.
- const client = new Daytona({ apiKey: 'dtn-test', useDeprecatedPolling: true });
+ const client = new Daytona({ apiKey: 'dtn-test', useDeprecatedPolling: true, requestTimeoutMs: 1000 });
jest.spyOn(client.snapshot, 'get').mockRejectedValue(new DaytonaError('not found', NOT_FOUND_STATUS));
return new DaytonaSandboxProvider({
@@ -121,7 +121,7 @@ describe('DaytonaSandboxProvider register-only snapshot create', () => {
describe('DaytonaSandboxProvider exec', () => {
it('rethrows SandboxNotAvailableError when the sandbox is gone', async () => {
- const client = new Daytona({ apiKey: 'dtn-test', useDeprecatedPolling: true });
+ const client = new Daytona({ apiKey: 'dtn-test', useDeprecatedPolling: true, requestTimeoutMs: 1000 });
jest.spyOn(client, 'get').mockRejectedValue(new DaytonaError('not found', NOT_FOUND_STATUS));
const provider = new DaytonaSandboxProvider({
client,
diff --git a/packages/trueforge/src/sandbox/providerUtils.ts b/packages/trueforge/src/sandbox/providerUtils.ts
index cbf74bac4..fc74a1365 100644
--- a/packages/trueforge/src/sandbox/providerUtils.ts
+++ b/packages/trueforge/src/sandbox/providerUtils.ts
@@ -21,6 +21,12 @@ import { captureCriticalException } from '../sentry';
/** Bound Daytona RPCs so API requests and controller ticks cannot hang indefinitely. */
export const DAYTONA_RPC_TIMEOUT_MS = 5_000;
+/**
+ * Client-wide Daytona HTTP deadline. Unlocking this (any positive value) makes the SDK
+ * extend only `executeCommand` / `codeRun` waits to command-timeout + 5s; other calls stay at 60s.
+ */
+export const DAYTONA_REQUEST_TIMEOUT_MS = 60_000;
+
/** Provider rejected the credentials (401 unauthorized); retrying the same key cannot succeed. */
export function isDaytonaAuthError(error: unknown): boolean {
return error instanceof DaytonaError && error.statusCode === 401;
@@ -98,7 +104,7 @@ export function toDaytonaSandboxProvider({
}
const { apiKey, ...settings } = toDaytonaSandboxProviderInput(manifest);
return new DaytonaSandboxProvider({
- client: new Daytona({ apiKey }),
+ client: new Daytona({ apiKey, requestTimeoutMs: DAYTONA_REQUEST_TIMEOUT_MS }),
apiKey,
...settings,
tenantName: tenant_id,