惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
About on SuperTechFans
小众软件
小众软件
WordPress大学
WordPress大学
Microsoft Azure Blog
Microsoft Azure Blog
Recent Announcements
Recent Announcements
博客园 - 三生石上(FineUI控件)
博客园_首页
N
Netflix TechBlog - Medium
IT之家
IT之家
H
Help Net Security
博客园 - 聂微东
Google DeepMind News
Google DeepMind News
罗磊的独立博客
T
Tailwind CSS Blog
F
Fortinet All Blogs
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
V
V2EX
量子位
云风的 BLOG
云风的 BLOG
爱范儿
爱范儿
博客园 - 司徒正美
The Cloudflare Blog
Engineering at Meta
Engineering at Meta

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix: make claude live output limits configurable · opencl...
steipete · 2026-05-02 · via Recent Commits to openclaw:main

@@ -19,6 +19,7 @@ type ProcessSupervisor = ReturnType<

1919

type ManagedRun = Awaited<ReturnType<ProcessSupervisor["spawn"]>>;

2020

type ClaudeLiveTurn = {

2121

backend: CliBackendConfig;

22+

outputLimits: ClaudeLiveOutputLimits;

2223

startedAtMs: number;

2324

rawLines: string[];

2425

rawChars: number;

@@ -49,13 +50,21 @@ type ClaudeLiveSession = {

4950

type ClaudeLiveRunResult = {

5051

output: CliOutput;

5152

};

53+

type ClaudeLiveOutputLimits = {

54+

maxTurnRawChars: number;

55+

maxPendingLineChars: number;

56+

maxTurnLines: number;

57+

};

52585359

const CLAUDE_LIVE_IDLE_TIMEOUT_MS = 10 * 60 * 1_000;

5460

const CLAUDE_LIVE_MAX_SESSIONS = 16;

5561

const CLAUDE_LIVE_MAX_STDERR_CHARS = 64 * 1024;

56-

const CLAUDE_LIVE_MAX_TURN_RAW_CHARS = 2 * 1024 * 1024;

57-

const CLAUDE_LIVE_MAX_PENDING_LINE_CHARS = CLAUDE_LIVE_MAX_TURN_RAW_CHARS;

58-

const CLAUDE_LIVE_MAX_TURN_LINES = 5_000;

62+

const CLAUDE_LIVE_DEFAULT_MAX_TURN_RAW_CHARS = 8 * 1024 * 1024;

63+

const CLAUDE_LIVE_MIN_TURN_RAW_CHARS = 1_024;

64+

const CLAUDE_LIVE_MAX_CONFIGURABLE_TURN_RAW_CHARS = 64 * 1024 * 1024;

65+

const CLAUDE_LIVE_DEFAULT_MAX_TURN_LINES = 20_000;

66+

const CLAUDE_LIVE_MIN_TURN_LINES = 100;

67+

const CLAUDE_LIVE_MAX_CONFIGURABLE_TURN_LINES = 100_000;

5968

const CLAUDE_LIVE_CLOSE_WAIT_TIMEOUT_MS = 5_000;

6069

const liveSessions = new Map<string, ClaudeLiveSession>();

6170

const liveSessionCreates = new Map<string, Promise<ClaudeLiveSession>>();

@@ -439,11 +448,45 @@ function isRecord(value: unknown): value is Record<string, unknown> {

439448

return Boolean(value && typeof value === "object" && !Array.isArray(value));

440449

}

441450451+

function normalizePositiveInt(

452+

value: number | undefined,

453+

fallback: number,

454+

min: number,

455+

max: number,

456+

): number {

457+

if (!Number.isInteger(value)) {

458+

return fallback;

459+

}

460+

return Math.min(Math.max(value, min), max);

461+

}

462+463+

function resolveClaudeLiveOutputLimits(backend: CliBackendConfig): ClaudeLiveOutputLimits {

464+

const configured = backend.reliability?.outputLimits;

465+

const maxTurnRawChars = normalizePositiveInt(

466+

configured?.maxTurnRawChars,

467+

CLAUDE_LIVE_DEFAULT_MAX_TURN_RAW_CHARS,

468+

CLAUDE_LIVE_MIN_TURN_RAW_CHARS,

469+

CLAUDE_LIVE_MAX_CONFIGURABLE_TURN_RAW_CHARS,

470+

);

471+

return {

472+

maxTurnRawChars,

473+

maxPendingLineChars: maxTurnRawChars,

474+

maxTurnLines: normalizePositiveInt(

475+

configured?.maxTurnLines,

476+

CLAUDE_LIVE_DEFAULT_MAX_TURN_LINES,

477+

CLAUDE_LIVE_MIN_TURN_LINES,

478+

CLAUDE_LIVE_MAX_CONFIGURABLE_TURN_LINES,

479+

),

480+

};

481+

}

482+442483

function parseClaudeLiveJsonLine(

443484

session: ClaudeLiveSession,

444485

trimmed: string,

445486

): Record<string, unknown> | null {

446-

if (trimmed.length > CLAUDE_LIVE_MAX_PENDING_LINE_CHARS) {

487+

const maxPendingLineChars =

488+

session.currentTurn?.outputLimits.maxPendingLineChars ?? CLAUDE_LIVE_DEFAULT_MAX_TURN_RAW_CHARS;

489+

if (trimmed.length > maxPendingLineChars) {

447490

closeLiveSession(

448491

session,

449492

"abort",

@@ -504,8 +547,8 @@ function handleClaudeLiveLine(session: ClaudeLiveSession, line: string): void {

504547

}

505548

turn.rawChars += trimmed.length + 1;

506549

if (

507-

turn.rawChars > CLAUDE_LIVE_MAX_TURN_RAW_CHARS ||

508-

turn.rawLines.length >= CLAUDE_LIVE_MAX_TURN_LINES

550+

turn.rawChars > turn.outputLimits.maxTurnRawChars ||

551+

turn.rawLines.length >= turn.outputLimits.maxTurnLines

509552

) {

510553

closeLiveSession(

511554

session,

@@ -541,7 +584,9 @@ function handleClaudeLiveLine(session: ClaudeLiveSession, line: string): void {

541584

function handleClaudeStdout(session: ClaudeLiveSession, chunk: string) {

542585

resetNoOutputTimer(session);

543586

session.stdoutBuffer += chunk;

544-

if (session.stdoutBuffer.length > CLAUDE_LIVE_MAX_PENDING_LINE_CHARS) {

587+

const maxPendingLineChars =

588+

session.currentTurn?.outputLimits.maxPendingLineChars ?? CLAUDE_LIVE_DEFAULT_MAX_TURN_RAW_CHARS;

589+

if (session.stdoutBuffer.length > maxPendingLineChars) {

545590

closeLiveSession(

546591

session,

547592

"abort",

@@ -719,6 +764,7 @@ function createTurn(params: {

719764

}): ClaudeLiveTurn {

720765

const turn: ClaudeLiveTurn = {

721766

backend: params.context.preparedBackend.backend,

767+

outputLimits: resolveClaudeLiveOutputLimits(params.context.preparedBackend.backend),

722768

startedAtMs: Date.now(),

723769

rawLines: [],

724770

rawChars: 0,