Skip to content

Commit b242610

Browse files
fix(acp): log child process stderr + global name alias (#3135, #3134)
- Forward ACP child process stderr to server logs so errors from claude-agent-acp (API key issues, crashes) are visible for debugging - Move 'name' alias from create-only to redactSession() so it's present in all session responses (GET, list, create)
1 parent 6313d9c commit b242610

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

src/routes/context.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ export function redactSession(session: Record<string, unknown>): Record<string,
310310
if (activeSubagents instanceof Set) {
311311
(redacted as Record<string, unknown>).activeSubagents = [...activeSubagents];
312312
}
313+
// Issue #3134: Add 'name' alias for backward compat (API consumers expect 'name')
314+
if (redacted.displayName !== undefined && redacted.name === undefined) {
315+
(redacted as Record<string, unknown>).name = redacted.displayName;
316+
}
313317
return redacted;
314318
}
315319

src/routes/sessions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,7 @@ export function registerSessionRoutes(app: FastifyInstance, ctx: RouteContext):
470470
? 'Session created but prompt not delivered: ACP is disabled. Set AEGIS_ACP_ENABLED=true or add "acpEnabled": true to config to enable Claude Code sessions.'
471471
: undefined;
472472

473-
// Issue #3134: Include 'name' alias for backward compat (API consumers expect 'name')
474-
const sessionResponse = redactSession(session as unknown as Record<string, unknown>);
475-
return reply.status(201).send({ ...sessionResponse, name: sessionResponse.displayName ?? sessionResponse.name, promptDelivery, ...(acpWarning ? { warning: acpWarning } : {}) });
473+
return reply.status(201).send({ ...redactSession(session as unknown as Record<string, unknown>), promptDelivery, ...(acpWarning ? { warning: acpWarning } : {}) });
476474
}
477475
registerWithLegacy(app, 'post', '/v1/sessions', {
478476
config: {

src/services/acp/backend.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,15 @@ export function createDefaultAcpBackendClient(
962962
...options.childProcessOptions,
963963
cwd: context.cwd,
964964
});
965+
// Issue #3135: Forward ACP child process stderr for debugging.
966+
// Without this, errors from claude-agent-acp (API key issues, crashes)
967+
// are silently discarded, making diagnosis impossible.
968+
child.on('stderr', (event) => {
969+
const text = typeof event.chunk === 'string' ? event.chunk.trim() : '';
970+
if (text) {
971+
console.error(`[ACP stderr:${context.durableSessionId.slice(0, 8)}] ${text}`);
972+
}
973+
});
965974
return new AcpJsonRpcClient({
966975
...options.jsonRpcClientOptions,
967976
child,

0 commit comments

Comments
 (0)