Skip to content

Commit ff8dd80

Browse files
fix(acp): forward child process stderr for diagnostics + global name alias (#3135 #3134)
PR #3147 — approved by aegis-gh-agent[bot] (Argus) ACP stderr forwarding for debugging. Name alias moved to global redactSession().
1 parent b37b358 commit ff8dd80

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
@@ -311,6 +311,10 @@ export function redactSession(session: Record<string, unknown>): Record<string,
311311
if (activeSubagents instanceof Set) {
312312
(redacted as Record<string, unknown>).activeSubagents = [...activeSubagents];
313313
}
314+
// Issue #3134: Add 'name' alias for backward compat (API consumers expect 'name')
315+
if (redacted.displayName !== undefined && redacted.name === undefined) {
316+
(redacted as Record<string, unknown>).name = redacted.displayName;
317+
}
314318
return redacted;
315319
}
316320

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)