Skip to content

feat(sdk): add skipAccumulation to prevent OutputMessage OOM#990

Open
Pangjiping wants to merge 1 commit into
opensandbox-group:mainfrom
Pangjiping:feat/sdk-skip-accumulation
Open

feat(sdk): add skipAccumulation to prevent OutputMessage OOM#990
Pangjiping wants to merge 1 commit into
opensandbox-group:mainfrom
Pangjiping:feat/sdk-skip-accumulation

Conversation

@Pangjiping
Copy link
Copy Markdown
Collaborator

Summary

  • Add skipAccumulation option to ExecutionHandlers across all SDK languages (Kotlin, Python async/sync, TypeScript, Go, C#)
  • When enabled, stdout/stderr messages are delivered to handler callbacks without being appended to ExecutionLogs, enabling constant-memory streaming for long-running executions
  • Default false — fully backward compatible, no breaking changes

Motivation

Production OOM caused by unbounded OutputMessage accumulation when streaming handlers are provided (41M objects observed in Java heap dump). Users who provide streaming handlers have no way to opt out of message buffering.

Changes

SDK Files
Kotlin ExecutionModels.kt, ExecutionEventDispatcher.kt
Python (async) execd.py, execution_event_dispatcher.py
Python (sync) execd_sync.py, sync execution_event_dispatcher.py
TypeScript execution.ts, executionEventDispatcher.ts
Go execution.go
C# Execution.cs, ExecutionEventDispatcher.cs

Test plan

  • Go: go test ./... passes
  • TypeScript: npx tsc --noEmit + npm test passes
  • Python: pytest passes + manual import verification
  • Kotlin: needs JVM 17+ (not available in local env, CI will verify)
  • C#: CI will verify

Closes #981

🤖 Generated with Claude Code

…t OOM

When streaming handlers are provided for long-running executions, the SDK
unconditionally accumulates every stdout/stderr message in memory, causing
OOM for executions with large output volumes.

Add `skipAccumulation` (default false) to ExecutionHandlers across all SDK
languages. When enabled, messages are delivered to handler callbacks without
being appended to ExecutionLogs, allowing constant-memory streaming.

Closes opensandbox-group#981

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Pangjiping Pangjiping added feature New feature or request sdks labels Jun 6, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 642a5e3e5b

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread sdks/sandbox/go/execution.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request sdks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support handler-only mode in SDK Execution to prevent OutputMessage OOM from unbounded accumulation

2 participants