Garry's Opinionated OpenClaw/Hermes Agent Brain
TypeScript
fix(cli): pending --json output carries top-level request_id and state (O-DX-1)
garrytanc27421c31cda
diff --git a/src/commands/persistence-delegate.ts b/src/commands/persistence-delegate.tsindex c7aad4eb52..7ddede87d3 100644--- a/src/commands/persistence-delegate.ts+++ b/src/commands/persistence-delegate.ts@@ -19,7 +19,8 @@ export async function reportPersistenceCliError(error: unknown, json = false,// PENDING_WRITE_EXIT_CODE (0 with --accept-pending) and names how to poll.const pending = pendingReceiptOf(error);const acceptPending = acceptPendingRequested(getCliOptions().acceptPending);- if (json) await out(JSON.stringify(pending ? { ...detail, poll_command: pollCommand(pending.request_id) } : detail, null, 2) + '\n');+ if (json) await out(JSON.stringify(pending ? { ...detail, request_id: pending.request_id, state: pending.state,+ poll_command: pollCommand(pending.request_id) } : detail, null, 2) + '\n');console.error(pending ? `Pending [write_pending]: ${detail.message} It may still commit.`: error instanceof OperationError || error instanceof RemoteMcpError? `Error [${'write_error' in detail && detail.write_error || detail.error}]: ${detail.message}` : error.message);diff --git a/test/pending-write-exit.serial.test.ts b/test/pending-write-exit.serial.test.tsindex e101369086..225be07894 100644--- a/test/pending-write-exit.serial.test.ts+++ b/test/pending-write-exit.serial.test.ts@@ -111,6 +111,7 @@ describe('resident owner: pending-write exit codes', () => {if (outcome === 'pending') {const body = JSON.parse(result.stdout);expect(body.write_request).toMatchObject({ request_id: ID, state: 'running' });+ expect(body).toMatchObject({ request_id: ID, state: 'running' });expect(body.poll_command).toBe(`gbrain call get_write_request '{"request_id":"${ID}"}'`);}});