From abc29caa6cc0b943641ce4ae21863bb1f0d0367c Mon Sep 17 00:00:00 2001 From: kina0630 Date: Thu, 14 May 2026 18:52:05 +0800 Subject: [PATCH] fix: avoid snapshot diff next steps --- coding-agent/src/coding_agent/__main__.py | 67 ++++++++++---------- coding-agent/tests/cli/test_remote_client.py | 10 +-- 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/coding-agent/src/coding_agent/__main__.py b/coding-agent/src/coding_agent/__main__.py index c763e83d0..acd45ec7d 100644 --- a/coding-agent/src/coding_agent/__main__.py +++ b/coding-agent/src/coding_agent/__main__.py @@ -798,14 +798,15 @@ def _remote_run_once( else: raise else: + has_git_workspace_source = ( + workspace_source is not None and workspace_source.get("kind") == "git" + ) _print_remote_result_next_steps( remote_name=name, session_id=session_id, repo_path=repo_path, - can_publish_branch=( - workspace_source is not None - and workspace_source.get("kind") == "git" - ), + can_diff_patch=has_git_workspace_source, + can_publish_branch=has_git_workspace_source, ) if stream_error is not None: raise stream_error @@ -916,6 +917,7 @@ def _print_remote_result_next_steps( remote_name: str, session_id: str, repo_path: Path | None, + can_diff_patch: bool, can_publish_branch: bool, ) -> None: click.echo(f"Remote session {session_id} left open for result inspection.") @@ -934,36 +936,37 @@ def _print_remote_result_next_steps( ] ) ) - click.echo( - "Show changed files: " - + _format_cli_command( - [ - "python", - "-m", - "coding_agent", - "remote", - "diff", - remote_name, - "--session", - session_id, - ] + if can_diff_patch: + click.echo( + "Show changed files: " + + _format_cli_command( + [ + "python", + "-m", + "coding_agent", + "remote", + "diff", + remote_name, + "--session", + session_id, + ] + ) ) - ) - click.echo( - "Export patch: " - + _format_cli_command( - [ - "python", - "-m", - "coding_agent", - "remote", - "patch", - remote_name, - "--session", - session_id, - ] + click.echo( + "Export patch: " + + _format_cli_command( + [ + "python", + "-m", + "coding_agent", + "remote", + "patch", + remote_name, + "--session", + session_id, + ] + ) ) - ) if can_publish_branch: click.echo( "Publish review branch: " diff --git a/coding-agent/tests/cli/test_remote_client.py b/coding-agent/tests/cli/test_remote_client.py index 916fc93a4..c23079cee 100644 --- a/coding-agent/tests/cli/test_remote_client.py +++ b/coding-agent/tests/cli/test_remote_client.py @@ -490,8 +490,9 @@ def fake_stream_prompt( assert result.exit_code == 0 assert "Created one-shot remote session sess-run on remote dev" in result.output assert "Remote session sess-run left open for result inspection." in result.output - assert "coding_agent remote diff dev --session sess-run" in result.output - assert "coding_agent remote patch dev --session sess-run" in result.output + assert "coding_agent remote result dev --session sess-run" in result.output + assert "coding_agent remote diff dev --session sess-run" not in result.output + assert "coding_agent remote patch dev --session sess-run" not in result.output assert "coding_agent remote publish dev" not in result.output assert "coding_agent remote sessions close dev sess-run" in result.output assert calls == [ @@ -1840,8 +1841,9 @@ def fake_stream_prompt( assert result.exit_code == 0 assert "Remote session sess-run left open for result inspection." in result.output - assert "coding_agent remote diff dev --session sess-run" in result.output - assert "coding_agent remote patch dev --session sess-run" in result.output + assert "coding_agent remote result dev --session sess-run" in result.output + assert "coding_agent remote diff dev --session sess-run" not in result.output + assert "coding_agent remote patch dev --session sess-run" not in result.output assert "coding_agent remote publish dev" not in result.output assert "coding_agent remote download dev --session sess-run --repo" in result.output assert "Downloaded remote workspace snapshot" not in result.output