Skip to content

fix(cloud-agent-next): include step and error detail in session restore failure messages#957

Merged
eshurakov merged 1 commit intomainfrom
eshurakov/cloud-agent-next-restore-session-logs
Mar 10, 2026
Merged

fix(cloud-agent-next): include step and error detail in session restore failure messages#957
eshurakov merged 1 commit intomainfrom
eshurakov/cloud-agent-next-restore-session-logs

Conversation

@eshurakov
Copy link
Copy Markdown
Contributor

Summary

When kilo-restore-session.js fails, the structured stdout (containing step, error, and code fields) was logged locally inside the Durable Object but lost by the time the error propagated through the tRPC chain to logpush. The error message only said "Cold-start session restore failed: exit 1", making it impossible to diagnose failures from logpush alone.

This change enriches the SessionSnapshotRestoreError message at the throw site to include step and error fields extracted from the restore script's JSON stdout. The richer message flows naturally through the existing error chain (SessionSnapshotRestoreErrorExecutionError.workspaceSetupFailedTRPCError) without any downstream changes.

Before: "Failed to prepare workspace: Cold-start session restore failed: exit 1"
After: "Failed to prepare workspace: Cold-start session restore failed: exit 1, step=import, error=kilo import failed exitCode=1"

Verification

  • pnpm run typecheck — passed (tsgo + wrapper)
  • pnpm run test — 642 tests passed, 25 test files
  • Verified existing test assertions use substring matching (toThrow('Cold-start session restore failed')) and remain compatible with the enriched message

Visual Changes

N/A

Reviewer Notes

  • Single file change: cloud-agent-next/src/session-service.ts — extends the existing stdout JSON parsing block (which already extracts code) to also extract step and error.
  • No new error class fields, no changes to orchestrator/CloudAgentSession/session-execution.
  • The as Record<string, unknown> cast on JSON.parse matches the existing pattern at this location.

@eshurakov eshurakov marked this pull request as ready for review March 9, 2026 21:53
@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot Bot commented Mar 9, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 files)
  • cloud-agent-next/src/session-service.ts

@eshurakov eshurakov merged commit ba616e5 into main Mar 10, 2026
18 checks passed
@eshurakov eshurakov deleted the eshurakov/cloud-agent-next-restore-session-logs branch March 10, 2026 08:18
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