From 21e5233c1fab8cb5e774986057b76a01ff25a861 Mon Sep 17 00:00:00 2001 From: damocles Date: Wed, 17 Jun 2026 10:05:21 +0200 Subject: [PATCH] ci-log: graceful message when a run's logs are gc'd (404/500) instead of raw http error --- hive-forge/src/verbs/ci_log.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/hive-forge/src/verbs/ci_log.rs b/hive-forge/src/verbs/ci_log.rs index 5b5a779b..17720bfc 100644 --- a/hive-forge/src/verbs/ci_log.rs +++ b/hive-forge/src/verbs/ci_log.rs @@ -73,7 +73,20 @@ pub fn run(client: &Client, args: Args) -> Result<()> { let path = format!("/{repo}/actions/runs/{}/jobs/{}", args.run, args.job); // 1. Discover the job's steps (state is returned regardless of cursors). - let view = client.post_json_web(&path, &json!({ "logCursors": [] }))?; + // A 404 (run/job gone) or 500 ("task ... resource does not exist", which + // the forge returns once act_runner has pruned a completed run's task + // record) surfaces here as an Err — translate it into the same + // logs-unavailable guidance rather than leaking the raw HTTP error. + let view = match client.post_json_web(&path, &json!({ "logCursors": [] })) { + Ok(v) => v, + Err(e) => bail!( + "run #{} job {} unavailable — the run/job may not exist, or its logs were \ + garbage-collected (act_runner prunes completed-run task records; ci-log \ + is reliable on live + recently-finished runs). Underlying: {e}", + args.run, + args.job + ), + }; let steps = steps_of(&view); if steps.is_empty() { bail!(