Skip to content

fix: surface setup phase failures - #160

Merged
delete-cloud merged 1 commit into
mainfrom
fix/setup-phase-error-detail
May 14, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
fix/setup-phase-error-detail

Conversation

@delete-cloud

@delete-cloud delete-cloud commented May 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • return a concise setup phase failure detail from HTTP session creation
  • include redacted setup stdout/stderr notes instead of raw Docker command strings
  • cover HTTP and CLI display paths

Dogfood context

Setup fail-closed worked, but the CLI displayed the full Docker command from CalledProcessError. The provider already redacts setup stdout/stderr into exception notes; this PR preserves those notes at the HTTP boundary.

Validation

  • uv run pytest tests/ui/test_http_server.py -k "redacted_setup_failure_detail" -q
  • uv run pytest tests/cli/test_remote_client.py -k "setup_failure_without_docker_command" -q
  • uv run pytest tests/ui/test_http_server.py -k "create_session or redacted_setup_failure_detail or remote_phases" -q
  • uv run pytest tests/cli/test_remote_client.py -k "session_create or setup_failure_without_docker_command or request_error_on_session_create" -q
  • uv run basedpyright --level error src/coding_agent/ui/http_server.py tests/ui/test_http_server.py tests/cli/test_remote_client.py
  • uv run ruff format --check src/coding_agent/ui/http_server.py tests/ui/test_http_server.py tests/cli/test_remote_client.py
  • git diff --check

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error handling for setup phase failures with standardized error details including exit codes and stderr output.
  • Tests

    • Added regression tests to verify proper error reporting when session setup fails.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: b48fe08d-b249-43e2-8bbb-accb3894c090

📥 Commits

Reviewing files that changed from the base of the PR and between 9b34856 and 5a91124.

📒 Files selected for processing (3)
  • coding-agent/src/coding_agent/ui/http_server.py
  • coding-agent/tests/cli/test_remote_client.py
  • coding-agent/tests/ui/test_http_server.py

📝 Walkthrough

Walkthrough

This PR improves error reporting for setup-phase failures in remote session creation. Helper functions extract structured error details from exceptions containing setup notes and return codes, then integrate these into the /sessions endpoint to replace raw exception strings. Unit and CLI tests validate the HTTP 500 response format and end-to-end failure reporting.

Changes

Setup Phase Error Detail Reporting

Layer / File(s) Summary
Error detail extraction helpers
src/coding_agent/ui/http_server.py
_setup_phase_exception_detail and _http_exception_detail parse exception __notes__ and returncode to build structured error messages for setup-phase failures.
Session creation error handling integration
src/coding_agent/ui/http_server.py
Session creation endpoint replaces generic str(exc) error details with calls to _http_exception_detail, preserving existing HTTP status-code mappings while improving error clarity.
HTTP server test for setup-phase error response
tests/ui/test_http_server.py
Unit test verifies that /sessions endpoint returns HTTP 500 with error detail including exit code and sanitized stdout/stderr, while excluding raw docker command and container identifiers.
CLI end-to-end test for setup-phase failure reporting
tests/cli/test_remote_client.py
Regression test simulates remote session setup failure and validates that the CLI exits non-zero with expected error output, without leaking docker command details.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • delete-cloud/Coding-Agent-Loop#138: The new /sessions error-detail extraction using __notes__/returncode is directly tied to this PR's implementation of remote setup phase that surfaces stdout/stderr via exception notes and redaction.

Poem

🐰 Errors now surface with grace,
Exit codes in the right place,
Setup failures, no more lies—
Redacted notes, sanitized sighs.
Remote sessions report with care,
CLI shows just what you share!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: surface setup phase failures' directly and clearly describes the main objective of the changeset: improving how setup phase failures are surfaced to users.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/setup-phase-error-detail

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@delete-cloud
delete-cloud merged commit b4395a5 into main May 14, 2026
1 check passed
@delete-cloud
delete-cloud deleted the fix/setup-phase-error-detail branch May 14, 2026 13:23
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.

1 participant