From b3f2aad51a6065f20d2be7ca890c9d5c30a22389 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Tue, 7 Jul 2026 01:06:29 -0500 Subject: [PATCH] refac --- cptr/env.py | 3 +++ cptr/utils/agents/claude_code.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/cptr/env.py b/cptr/env.py index b71f82b..aaa9d50 100644 --- a/cptr/env.py +++ b/cptr/env.py @@ -64,6 +64,9 @@ ENABLE_CHAT_RECONCILE_ON_STARTUP: bool = os.environ.get( CHAT_TOOL_MAX_CHARS = int(os.environ.get("CHAT_TOOL_MAX_CHARS", "50000")) CHAT_TOOL_COMMAND_MAX_CHARS = int(os.environ.get("CHAT_TOOL_COMMAND_MAX_CHARS", "8000")) CHAT_COMPACT_TOKEN_THRESHOLD = int(os.environ.get("CHAT_COMPACT_TOKEN_THRESHOLD", "80000")) +# Claude SDK stdout JSON buffer; chat/tool output caps apply later after parsing. +CLAUDE_CODE_MAX_BUFFER_SIZE = _env_int("CPTR_CLAUDE_CODE_MAX_BUFFER_SIZE", 128 * 1024 * 1024) +CLAUDE_CODE_MAX_BUFFER_SIZE = _env_int("CPTR_CLAUDE_CODE_MAX_BUFFER_SIZE", 128 * 1024 * 1024) # ── Execute timeout ───────────────────────────────────────── # Default wait (seconds) for run_command / check_task when the caller diff --git a/cptr/utils/agents/claude_code.py b/cptr/utils/agents/claude_code.py index ecc8792..e0e4a18 100644 --- a/cptr/utils/agents/claude_code.py +++ b/cptr/utils/agents/claude_code.py @@ -7,6 +7,7 @@ import os import shlex from typing import Any, AsyncIterator +from cptr.env import CLAUDE_CODE_MAX_BUFFER_SIZE from cptr.utils.agents.attachments import PreparedAgentAttachments from cptr.utils.agents.events import ( AgentDone, @@ -128,6 +129,7 @@ async def run_claude_code_agent( "permission_mode": permission_mode, "env": env, "include_partial_messages": True, + "max_buffer_size": CLAUDE_CODE_MAX_BUFFER_SIZE, } if workspace: options_kwargs["cwd"] = workspace