Skip to content

feat(cloud-agent-next): stream redacted setup command output to users#4583

Merged
eshurakov merged 1 commit into
mainfrom
concrete-hexagon
Jul 16, 2026
Merged

feat(cloud-agent-next): stream redacted setup command output to users#4583
eshurakov merged 1 commit into
mainfrom
concrete-hexagon

Conversation

@eshurakov

@eshurakov eshurakov commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Forward sanitized, redacted setup command stdout/stderr to the client during
workspace preparation instead of a generic "still running" pulse. Output is
stripped of ANSI/control codes and spinners, and secrets (bearer/basic auth,
URL credentials, cookies, KEY=VALUE secret names, secret-bearing CLI flags)
are redacted before reaching the client or failure diagnostics.

  • wrapper: add redact-output module and a setup output reporter that
    buffers line-by-line; expose the redacted command plus a bounded output tail
    on failure. Drop failFast so setup commands always fail; mark setup command
    failures non-retryable while keeping timeouts retryable.
  • orchestrator: extract translateKnownWrapperFailure and apply it on
    wrapper startup so non-retryable workspace setup failures surface instead of
    being masked as retryable wrapper start failures.
  • web: add SetupLogPanel and a setupLog service-state atom, rendered in
    the chat during the setup_commands preparing step and cleared on
    ready/failed/stopped.

Verification

  • Manually verified streaming of redacted setup command output locally during workspace preparation.

Visual Changes

Screenshot 2026-07-16 at 14 00 20 Screenshot 2026-07-16 at 14 00 26

Reviewer Notes

  • Secret redaction lives in wrapper/src/redact-output.ts; focus on regex
    coverage and false-negatives for bearer/basic auth, URL credentials, cookies,
    KEY=VALUE secret names, and --token/--key/... CLI flags.
  • Setup failure handling changed: failFast dropped (setup commands now always
    fail rather than fast-abort) and setup-command failures are non-retryable,
    while timeouts remain retryable. translateKnownWrapperFailure ensures these
    surface as non-retryable instead of being masked as retryable wrapper start
    failures.
  • setupLog service-state atom lifecycle: rendered only during the
    setup_commands preparing step and cleared on ready/failed/stopped.

Comment thread services/cloud-agent-next/wrapper/src/main.ts Outdated
Comment thread apps/web/src/components/cloud-agent-next/CloudChatPage.tsx Outdated
Comment thread apps/mobile/src/components/agents/session-detail-content.tsx Outdated
@kilo-code-bot

kilo-code-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

All 4 previously flagged issues (unredacted error passthrough, workspace_setup step-key collision, non-memoized Map in CloudChatPage, and O(n²) indexOf lookup in mobile session rendering) are fixed in the incremental commits; no new issues were found in the changed files.

Files Reviewed (9 files)
  • apps/mobile/src/components/agents/session-detail-content.tsx - fixed (id-based lookup replaces indexOf)
  • apps/web/src/components/cloud-agent-next/CloudChatPage.tsx - fixed (preparationByMessageId now wrapped in useMemo)
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.ts - fixed (renamed to sandbox_provision, no longer collides with wrapper's workspace_setup)
  • services/cloud-agent-next/src/kilo-facade/cloud-agent-extension-events.test.ts
  • services/cloud-agent-next/src/kilo-facade/cloud-agent-extension-events.ts - sandbox_provision step added to public status union
  • services/cloud-agent-next/src/session/preparation-progress.test.ts - new regression test covers sandbox_provision/workspace_setup distinctness
  • services/cloud-agent-next/src/shared/protocol.ts - sandbox_provision added to PreparingStep
  • services/cloud-agent-next/test/unit/execution/orchestrator.test.ts
  • services/cloud-agent-next/wrapper/src/main.ts - fixed (unclassified errors now map to a fixed safe message instead of raw error.message; WrapperBootstrapError/RestoredWorkspaceReconciliationError messages are already safe, controlled strings)
Previous Review Summary (commit ccbf2ad)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit ccbf2ad)

Status: 4 Issues Found | Recommendation: Address before merge

Executive Summary

An unclassified session/ready failure forwards the raw, unredacted error.message to the client's live preparation stream, undermining the PR's core secret-redaction goal in wrapper/src/main.ts.

Overview

Severity Count
CRITICAL 1
WARNING 3
SUGGESTION 0
Issue Details (click to expand)

CRITICAL

File Line Issue
services/cloud-agent-next/wrapper/src/main.ts 857 Unredacted error.message streamed to client for unclassified preparation failures, bypassing redactSecrets

WARNING

File Line Issue
services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.ts 529 New workspace_setup step collides with the wrapper's existing workspace_setup step key, erasing the sandbox-provisioning step record
apps/web/src/components/cloud-agent-next/CloudChatPage.tsx 758 Non-memoized Map rebuilt every render defeats DynamicMessages memoization
apps/mobile/src/components/agents/session-detail-content.tsx 362 indexOf lookup in renderItem makes list rendering O(n²), replacing a prior O(1) index lookup
Files Reviewed (49 files)
  • apps/mobile/src/components/agents/preparation-group.tsx
  • apps/mobile/src/components/agents/session-detail-content.tsx - 1 issue
  • apps/web/src/components/cloud-agent-next/CloudChatPage.tsx - 1 issue
  • apps/web/src/components/cloud-agent-next/PreparationDrawer.tsx
  • apps/web/src/components/cloud-agent-next/PreparationRow.tsx
  • apps/web/src/components/cloud-agent-next/hooks/useStickToBottom.ts
  • apps/web/src/components/cloud-agent-next/preparation-phases.test.ts
  • apps/web/src/components/cloud-agent-next/preparation-phases.ts
  • apps/web/src/components/cloud-agent-next/preparation-summary.test.ts
  • apps/web/src/components/cloud-agent-next/preparation-summary.ts
  • apps/web/src/lib/cloud-agent-sdk/index.ts
  • apps/web/src/lib/cloud-agent-sdk/normalizer.test.ts
  • apps/web/src/lib/cloud-agent-sdk/normalizer.ts
  • apps/web/src/lib/cloud-agent-sdk/schemas.ts
  • apps/web/src/lib/cloud-agent-sdk/service-state.test.ts
  • apps/web/src/lib/cloud-agent-sdk/service-state.ts
  • apps/web/src/lib/cloud-agent-sdk/session-manager.test.ts
  • apps/web/src/lib/cloud-agent-sdk/session-manager.ts
  • apps/web/src/lib/cloud-agent-sdk/types.ts
  • services/cloud-agent-next/src/agent-sandbox/cloudflare/cloudflare-agent-sandbox.ts - 1 issue
  • services/cloud-agent-next/src/execution/orchestrator.test.ts
  • services/cloud-agent-next/src/execution/orchestrator.ts
  • services/cloud-agent-next/src/execution/types.ts
  • services/cloud-agent-next/src/kilo-facade/cloud-agent-extension-events.ts
  • services/cloud-agent-next/src/persistence/CloudAgentSession.ts
  • services/cloud-agent-next/src/session-service.test.ts
  • services/cloud-agent-next/src/session-service.ts
  • services/cloud-agent-next/src/session/preparation-history.test.ts
  • services/cloud-agent-next/src/session/preparation-history.ts
  • services/cloud-agent-next/src/session/preparation-progress.test.ts
  • services/cloud-agent-next/src/session/preparation-progress.ts
  • services/cloud-agent-next/src/session/preparation-test-helpers.ts
  • services/cloud-agent-next/src/session/queries/events.ts
  • services/cloud-agent-next/src/session/session-message-queue.test.ts
  • services/cloud-agent-next/src/shared/protocol.ts
  • services/cloud-agent-next/src/shared/wrapper-bootstrap.ts
  • services/cloud-agent-next/src/websocket/ingest.ts
  • services/cloud-agent-next/src/websocket/stream.ts
  • services/cloud-agent-next/test/unit/execution/orchestrator.test.ts
  • services/cloud-agent-next/wrapper/src/connection.ts
  • services/cloud-agent-next/wrapper/src/main.ts - 1 issue
  • services/cloud-agent-next/wrapper/src/redact-output.test.ts
  • services/cloud-agent-next/wrapper/src/redact-output.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.test.ts
  • services/cloud-agent-next/wrapper/src/session-bootstrap.ts
  • services/cloud-agent-next/wrapper/src/state.test.ts
  • services/cloud-agent-next/wrapper/src/state.ts

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5 · Input: 34 · Output: 4.6K · Cached: 728.3K

Review guidance: REVIEW.md from base branch main

Forward sanitized, redacted setup command stdout/stderr to the client
during workspace preparation instead of a generic "still running" pulse.
Output is stripped of ANSI/control codes and spinners, and secrets
(bearer/basic auth, URL credentials, cookies, KEY=VALUE secret names,
secret-bearing CLI flags) are redacted before reaching the client or
failure diagnostics.

- wrapper: add redact-output module and a setup output reporter that
  buffers line-by-line; expose redacted command + bounded output tail
  on failure. Drop failFast so setup commands always fail; mark setup
  command failures non-retryable while keeping timeouts retryable.
- orchestrator: extract translateKnownWrapperFailure and apply it on
  wrapper startup so non-retryable workspace setup failures surface
  instead of being masked as retryable wrapper start failures.
- web: add SetupLogPanel and a setupLog service-state atom, rendered in
  the chat during the setup_commands preparing step and cleared on
  ready/failed/stopped.
@eshurakov eshurakov merged commit a10b9b7 into main Jul 16, 2026
19 checks passed
@eshurakov eshurakov deleted the concrete-hexagon branch July 16, 2026 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants