Skip to content

Commit e1f2845

Browse files
committed
fix(gh): pass through gh pr merge instead of canned response (rtk-ai#938)
pr_merge() was using run_filtered with a filter_fn that ignored stdout and always returned "ok merged". This made AI agents believe PRs were merged when they weren't. Switch to run_passthrough so the real gh output is shown. gh pr merge is a destructive action — the user must see exactly what happened. Signed-off-by: Patrick szymkowiak <patrick.szymkowiak@innovtech.eu>
1 parent 5bd35a3 commit e1f2845

1 file changed

Lines changed: 7 additions & 25 deletions

File tree

src/cmds/git/gh_cmd.rs

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -785,31 +785,13 @@ fn pr_create(args: &[String], _verbose: u8) -> Result<i32> {
785785
}
786786

787787
fn pr_merge(args: &[String], _verbose: u8) -> Result<i32> {
788-
let pr_num = args
789-
.iter()
790-
.find(|a| !a.starts_with('-'))
791-
.map(|s| s.as_str())
792-
.unwrap_or("")
793-
.to_string();
794-
let mut cmd = resolved_command("gh");
795-
cmd.args(["pr", "merge"]);
796-
for arg in args {
797-
cmd.arg(arg);
798-
}
799-
runner::run_filtered(
800-
cmd,
801-
"gh",
802-
"pr merge",
803-
move |_stdout| {
804-
let detail = if !pr_num.is_empty() {
805-
format!("#{}", pr_num)
806-
} else {
807-
String::new()
808-
};
809-
ok_confirmation("merged", &detail)
810-
},
811-
RunOptions::stdout_only().early_exit_on_failure(),
812-
)
788+
// gh pr merge is a destructive action — pass through the real output
789+
// so the user (or AI agent) sees exactly what happened.
790+
run_passthrough("gh", "pr", &{
791+
let mut a = vec!["merge".to_string()];
792+
a.extend_from_slice(args);
793+
a
794+
})
813795
}
814796

815797
/// Flags that change `gh pr diff` output from unified diff to a different format.

0 commit comments

Comments
 (0)