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

推荐订阅源

G
Google Developers Blog
Apple Machine Learning Research
Apple Machine Learning Research
小众软件
小众软件
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
IT之家
IT之家
A
About on SuperTechFans
量子位
Engineering at Meta
Engineering at Meta
B
Blog
The Cloudflare Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Y
Y Combinator Blog
J
Java Code Geeks
D
DataBreaches.Net
aimingoo的专栏
aimingoo的专栏
T
Tailwind CSS Blog
H
Help Net Security
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
C
Check Point Blog
酷 壳 – CoolShell
酷 壳 – CoolShell

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(codex): preserve app-server exit diagnostics · opencl...
steipete · 2026-05-03 · via Recent Commits to openclaw:main

@@ -28,6 +28,7 @@ const CODEX_APP_SERVER_PARSE_LOG_MAX = 500;

2828

const CODEX_APP_SERVER_PARSE_BUFFER_MAX = 1_000_000;

2929

const CODEX_APP_SERVER_PARSE_BUFFER_MAX_LINES = 1_000;

3030

const CODEX_DYNAMIC_TOOL_SERVER_REQUEST_TIMEOUT_MS = 30_000;

31+

const CODEX_APP_SERVER_STDERR_TAIL_MAX = 2_000;

31323233

type PendingRequest = {

3334

method: string;

@@ -76,6 +77,8 @@ export class CodexAppServerClient {

7677

private nextId = 1;

7778

private initialized = false;

7879

private closed = false;

80+

private closeError: Error | undefined;

81+

private stderrTail = "";

7982

private pendingParse:

8083

| {

8184

text: string;

@@ -89,20 +92,18 @@ export class CodexAppServerClient {

8992

this.lines = createInterface({ input: child.stdout });

9093

this.lines.on("line", (line) => this.handleLine(line));

9194

child.stderr.on("data", (chunk: Buffer | string) => {

92-

const text = chunk.toString("utf8").trim();

93-

if (text) {

94-

embeddedAgentLog.debug(`codex app-server stderr: ${text}`);

95+

const text = chunk.toString("utf8");

96+

this.stderrTail = appendBoundedTail(this.stderrTail, text, CODEX_APP_SERVER_STDERR_TAIL_MAX);

97+

const trimmed = text.trim();

98+

if (trimmed) {

99+

embeddedAgentLog.debug(`codex app-server stderr: ${trimmed}`);

95100

}

96101

});

97102

child.once("error", (error) =>

98103

this.closeWithError(error instanceof Error ? error : new Error(String(error))),

99104

);

100105

child.once("exit", (code, signal) => {

101-

this.closeWithError(

102-

new Error(

103-

`codex app-server exited: code=${formatExitValue(code)} signal=${formatExitValue(signal)}`,

104-

),

105-

);

106+

this.closeWithError(buildCodexAppServerExitError(code, signal, this.stderrTail));

106107

});

107108

// Guard against unhandled EPIPE / write-after-close errors on the stdin

108109

// stream. When the child process terminates abruptly the pipe can break

@@ -171,7 +172,7 @@ export class CodexAppServerClient {

171172

): Promise<T> {

172173

options ??= {};

173174

if (this.closed) {

174-

return Promise.reject(new Error("codex app-server client is closed"));

175+

return Promise.reject(this.closeError ?? new Error("codex app-server client is closed"));

175176

}

176177

if (options.signal?.aborted) {

177178

return Promise.reject(new Error(`${method} aborted`));

@@ -451,6 +452,7 @@ export class CodexAppServerClient {

451452

return false;

452453

}

453454

this.closed = true;

455+

this.closeError = error;

454456

this.lines.close();

455457

this.rejectPendingRequests(error);

456458

return true;

@@ -596,12 +598,31 @@ function redactCodexAppServerLinePreview(value: string): string {

596598

.replace(

597599

/("(?:api_?key|authorization|token|access_token|refresh_token)"\s*:\s*")([^"]+)(")/gi,

598600

"$1<redacted>$3",

601+

)

602+

.replace(

603+

/\b([a-z0-9_]*(?:api_?key|authorization|access_token|refresh_token|token))(\s*=\s*)(["']?)[^\s"']+(\3)/gi,

604+

"$1$2$3<redacted>$4",

599605

);

600606

return redacted.length > CODEX_APP_SERVER_PARSE_LOG_MAX

601607

? `${redacted.slice(0, CODEX_APP_SERVER_PARSE_LOG_MAX)}...`

602608

: redacted;

603609

}

604610611+

function appendBoundedTail(current: string, next: string, maxLength: number): string {

612+

const combined = `${current}${next}`;

613+

return combined.length > maxLength ? combined.slice(combined.length - maxLength) : combined;

614+

}

615+616+

function buildCodexAppServerExitError(code: unknown, signal: unknown, stderrTail: string): Error {

617+

const stderrPreview = redactCodexAppServerLinePreview(stderrTail);

618+

const suffix = stderrPreview ? ` stderr=${JSON.stringify(stderrPreview)}` : "";

619+

return new Error(

620+

`codex app-server exited: code=${formatExitValue(code)} signal=${formatExitValue(

621+

signal,

622+

)}${suffix}`,

623+

);

624+

}

625+605626

function shouldBufferCodexAppServerParseFailure(value: string, error: unknown): boolean {

606627

if (!value.startsWith("{") && !value.startsWith("[")) {

607628

return false;