fix(cli): show safe cloud failure details

OM
2mo ago
+473-0

Summary

Fixes #1741.

agent-relay cloud status <runId> now shows validated structured workflow failure details in human-readable output when available.

The human renderer only exposes the allowlisted structural fields:

  • phase
  • code
  • dispatchType
  • occurredAt
  • sandboxId

Missing or malformed values are omitted, and arbitrary failure content such as messages, causes, provider/agent output, signed URLs, and credential-like values is not rendered.

--json behavior is unchanged.

Test Plan

  • Tests added/updated
  • Manual testing completed

Validated with:

  • npx vitest run packages/cli/src/cli/commands/cloud.test.ts
  • npm run typecheck
  • npm run lint
  • npm test
  • git diff --check

Full test suite:

  • 195 test files passed
  • 3524 tests passed
  • 3 test files / 32 tests skipped

Added a RelayFlow regression case that verifies the base behavior omits structured failure details and the fixed behavior renders only the safe allowlisted fields.

RelayFlow Proof

  • Change type: bugfix
  • RelayFlow case: 1741-cloud-status-failure-details

Screenshots

N/A


[!NOTE]
Low Risk
CLI presentation-only change with strict field allowlisting; JSON and API behavior are unchanged, with regression tests for sensitive or malformed failure payloads.

Overview
Fixes #1741 by extending human agent-relay cloud status <runId> output with a Failure: block when the run failed and the API returns structured failure data.

Presentation is CLI-only and allowlisted: only phase, code, dispatchType, occurredAt, and sandboxId are shown after regex, calendar-date, and credential-prefix checks. Malformed values and free-form fields (message, cause, provider/agent output, signed URLs, etc.) are omitted rather than printed. --json still dumps the full status object unchanged.

Coverage includes new cloud.test.ts cases (partial fields, bad dates, secret-like codes, sentinel leakage) and a RelayFlow proof case 1741-cloud-status-failure-details.

Reviewed by Cursor Bugbot for commit 2f27a8c6672af5cb65bdf382ab6014ad5dfef202. Bugbot is set up for automated code reviews on this repo. Configure here.