Skip to content

fix: avoid snapshot diff next steps - #158

Merged
delete-cloud merged 1 commit into
mainfrom
fix/remote-run-snapshot-next-steps
May 14, 2026
Merged

delete-cloud merged 1 commit into
mainfrom
fix/remote-run-snapshot-next-steps

Conversation

@delete-cloud

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

Copy link
Copy Markdown
Owner

Summary

  • only print remote diff/patch next steps for Git-backed remote runs
  • keep snapshot and empty workspace sessions focused on result/download/close actions
  • update CLI tests for snapshot and empty workspace next-step output

Dogfood context

A production-mode snapshot fallback dogfood run succeeded, but the post-run guidance still suggested remote diff/patch even though snapshot sessions cannot use those commands.

Validation

  • uv run pytest tests/cli/test_remote_client.py -k "does_not_download_or_cleanup_by_default or empty_workspace or clean_git_repo_uses_git_workspace_source" -q
  • uv run pytest tests/cli/test_remote_client.py -k "remote_diff or remote_patch or remote_run" -q
  • uv run basedpyright --level error src/coding_agent/main.py tests/cli/test_remote_client.py
  • uv run ruff format --check src/coding_agent/main.py tests/cli/test_remote_client.py
  • git diff --check

Summary by CodeRabbit

  • Improvements
    • Remote session follow-up instructions now intelligently adapt based on workspace source type. Commands for viewing changed files and exporting patches appear only for Git-backed workspaces, streamlining output and providing more relevant guidance tailored to your specific workflow.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 14, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR adds workspace-source-aware capability gating to remote session result commands. When a one-shot remote session completes, the cleanup code now checks whether the workspace is Git-backed and conditionally displays the remote diff and remote patch follow-up commands only for Git sources.

Changes

Git-backed capability gating for remote diff/patch commands

Layer / File(s) Summary
Git-backed capability gating and conditional output
coding-agent/src/coding_agent/__main__.py, coding-agent/tests/cli/test_remote_client.py
_remote_run_once detects workspace source kind and passes a can_diff_patch capability flag to _print_remote_result_next_steps. The function signature is extended with the flag parameter, and "Show changed files" and "Export patch" CLI commands are now emitted conditionally. Test assertions are updated to verify commands appear or are absent based on whether the workspace is Git-backed.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 A git-aware leap forward, with bounds both neat and clean,
Where diff and patch commands know where they belong,
Only dancing forth when roots run deep and strong—
A workspace source sprite grants them their say,
Keeping stray commands at bay! 🌿

🚥 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: avoid snapshot diff next steps' clearly summarizes the main change: preventing diff/patch next steps from appearing for non-Git-backed remote sessions (snapshots). It directly relates to the primary objective of the changeset.
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/remote-run-snapshot-next-steps

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
coding-agent/tests/cli/test_remote_client.py (1)

1873-1983: ⚡ Quick win

Add assertions for diff/patch commands in Git-backed session test.

The test test_remote_run_clean_git_repo_uses_git_workspace_source verifies Git-backed sessions show the publish command but doesn't verify that diff and patch commands also appear. Since both capabilities use the same has_git_workspace_source flag, they should be tested together.

🧪 Recommended test assertions to add

Add these assertions after line 1960:

     assert (
         "coding_agent remote publish dev --session sess-git --branch coding-agent/session-sess-git"
         in result.output
     )
+    assert "coding_agent remote diff dev --session sess-git" in result.output
+    assert "coding_agent remote patch dev --session sess-git" in result.output
     assert calls == [
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@coding-agent/tests/cli/test_remote_client.py` around lines 1873 - 1983, The
test test_remote_run_clean_git_repo_uses_git_workspace_source currently asserts
the publish command is printed but misses verifying the diff and patch publish
commands; update this test to also assert that the diff and patch command
strings containing the session id "sess-git" and branch
"coding-agent/session-sess-git" are present in result.output. After the existing
publish assertion in test_remote_run_clean_git_repo_uses_git_workspace_source,
add assertions that result.output includes the diff command and the patch
command (both using --session sess-git and --branch
coding-agent/session-sess-git) so diff/patch are validated alongside publish.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@coding-agent/tests/cli/test_remote_client.py`:
- Around line 1873-1983: The test
test_remote_run_clean_git_repo_uses_git_workspace_source currently asserts the
publish command is printed but misses verifying the diff and patch publish
commands; update this test to also assert that the diff and patch command
strings containing the session id "sess-git" and branch
"coding-agent/session-sess-git" are present in result.output. After the existing
publish assertion in test_remote_run_clean_git_repo_uses_git_workspace_source,
add assertions that result.output includes the diff command and the patch
command (both using --session sess-git and --branch
coding-agent/session-sess-git) so diff/patch are validated alongside publish.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d23ab81-209d-43fb-879b-1625d68653fb

📥 Commits

Reviewing files that changed from the base of the PR and between 6238fc5 and abc29ca.

📒 Files selected for processing (2)
  • coding-agent/src/coding_agent/__main__.py
  • coding-agent/tests/cli/test_remote_client.py

@delete-cloud
delete-cloud merged commit 3916976 into main May 14, 2026
1 check passed
@delete-cloud
delete-cloud deleted the fix/remote-run-snapshot-next-steps branch May 14, 2026 10:56
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