Skip to content

Commit faf7e93

Browse files
Bill LeoutsakosBill Leoutsakos
authored andcommitted
fix(sandbox): enforce Daytona output limits on success
Fail closed when Daytona resolves log delivery after a callback overflow, matching E2B provider behavior.
1 parent dae67ff commit faf7e93

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

apps/sim/lib/execution/remote-sandbox/conformance.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ describe.each(PROVIDERS)('sandbox conformance [%s]', (provider) => {
150150
mockGetSessionCommandLogs.mockImplementation(
151151
async (_sessionId: string, _commandId: string, onStdout: (chunk: string) => void) => {
152152
onStdout('12345')
153-
onStdout('6')
153+
try {
154+
onStdout('6')
155+
} catch {
156+
// Daytona may finish log delivery after recording a callback error.
157+
}
154158
}
155159
)
156160
}

apps/sim/lib/execution/remote-sandbox/daytona.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,14 @@ class DaytonaSandboxHandle implements SandboxHandle {
222222
}
223223

224224
const finished = await this.sandbox.process.getSessionCommand(sessionId, commandId)
225+
if (limiter.exceeded()) {
226+
return {
227+
stdout: '',
228+
stderr: 'Sandbox command output limit exceeded',
229+
exitCode: 137,
230+
outputLimitExceeded: true,
231+
}
232+
}
225233
return { stdout, stderr, exitCode: finished.exitCode ?? 0 }
226234
} catch (error) {
227235
return { stdout, stderr: stderr || getErrorMessage(error), exitCode: 1 }

0 commit comments

Comments
 (0)