fix(gh-run-wait): use url field and show wait details

This commit is contained in:
James Peter
2026-01-01 15:11:13 +10:00
parent bd21f9f9e2
commit a7f6402a53
2 changed files with 72 additions and 2 deletions
+2 -2
View File
@@ -8901,7 +8901,7 @@ async fn handle_gh_run_wait(
"view",
&run_id,
"--json",
"status,conclusion,jobs,htmlURL,displayTitle,workflowName",
"status,conclusion,jobs,url,displayTitle,workflowName",
],
repo.as_deref(),
)
@@ -8939,7 +8939,7 @@ async fn handle_gh_run_wait(
.and_then(|v| v.as_str())
.map(|s| s.to_string());
let html_url = view
.get("htmlURL")
.get("url")
.and_then(|v| v.as_str())
.map(|s| s.to_string());
+70
View File
@@ -158,12 +158,80 @@ impl RunningToolCallCell {
duration
}
fn compact_duration(duration: Duration) -> String {
Self::strip_zero_seconds_suffix(format_duration(duration)).replace(' ', "")
}
fn spinner_frame(&self) -> &'static str {
const FRAMES: [&str; 4] = ["◐", "◓", "◑", "◒"];
let idx = ((self.start_clock.elapsed().as_millis() / 100) as usize) % FRAMES.len();
FRAMES[idx]
}
fn is_gh_run_wait(&self) -> bool {
self.state.title == "Gh Run Wait..."
}
fn tool_argument_text(&self, name: &str) -> Option<String> {
self.state
.arguments
.iter()
.find(|arg| arg.name == name)
.and_then(|arg| match &arg.value {
ArgumentValue::Text(text) => Some(text.clone()),
ArgumentValue::Json(json) => {
let raw = json.to_string();
Some(format_json_compact(&raw).unwrap_or(raw))
}
ArgumentValue::Secret => None,
})
.map(|text| text.trim().to_string())
.filter(|text| !text.is_empty())
}
fn render_gh_run_wait(&self, elapsed: Duration) -> Vec<Line<'static>> {
let mut lines: Vec<Line<'static>> = Vec::new();
lines.push(Line::styled(
"Monitoring GitHub Workflow",
Style::default()
.fg(crate::colors::info())
.add_modifier(Modifier::BOLD),
));
let dim = Style::default().fg(crate::colors::text_dim());
let text = Style::default().fg(crate::colors::text());
if let Some(branch) = self.tool_argument_text("branch") {
lines.push(Line::from(vec![
Span::styled("│ ", dim),
Span::styled("branch ", dim),
Span::styled(branch, text),
]));
}
if let Some(run_id) = self.tool_argument_text("run_id") {
lines.push(Line::from(vec![
Span::styled("│ ", dim),
Span::styled("run ", dim),
Span::styled(run_id, text),
]));
}
if let Some(workflow) = self.tool_argument_text("workflow") {
lines.push(Line::from(vec![
Span::styled("│ ", dim),
Span::styled("workflow ", dim),
Span::styled(workflow, text),
]));
}
let elapsed_str = Self::compact_duration(elapsed);
lines.push(Line::from(vec![
Span::styled("└ ", dim),
Span::styled("Waiting for ", dim),
Span::styled(elapsed_str, text),
]));
lines.push(Line::from(""));
lines
}
pub(crate) fn has_title(&self, title: &str) -> bool {
self.state.title == title
}
@@ -235,6 +303,8 @@ impl HistoryCell for RunningToolCallCell {
Style::default().fg(crate::colors::text_dim()),
));
lines.push(Line::from(spans));
} else if self.is_gh_run_wait() {
return self.render_gh_run_wait(elapsed);
} else {
lines.push(Line::styled(
format!("{} ({})", self.state.title, format_duration(elapsed)),