run view --log-failed: one missing job log no longer fails the whole command (CLS-963) #300
Loading…
Reference in a new issue
No description provided.
Delete branch "stephen/cls-963-log-failed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CLS-963:
fj run view <run> --log-failedprintederror: Loki fallback needs workflow task metadata for job index Nand no log, so a real lint failure read as infrastructure and ci-fix recommended a rerun.Cause (in
fj, not the gateway):fetch_run_logs_with_sourcesasked Forgejo for each selected job's log in turn and, on the first job that answeredresource does not exist(a job with no task yet, like 120671 in run 4719), threw away the jobs that had loaded and fell back to Loki for the whole run. Loki needs the run's task list, which the gateway path did not supply, so the command failed with the metadata error. The same job log fetched directly returned fine.Now each job is settled on its own:
log unavailable for this job: <reason>in its own lines instead of failing the command;log retrieval failed for this job: <error>, the other jobs still print, and the command exits non-zero after printing (ensure_logs_complete).--jsoncarries the same inerrors. If nothing at all could be retrieved, the failure is still the command's error, as before;TaskSource::loadnow returns aResult, so a failed task-list read can no longer pass as an empty list.sourcereadsforgejo-api,loki,forgejo-api+loki, ornone.Failure paths
one_missing_job_log_does_not_discard_the_others.a_missing_job_log_falls_back_to_loki_for_that_job_only.no_task_metadata_reports_each_job_as_unavailable.a_failed_task_list_read_keeps_loaded_logs_and_records_the_failure, and with nothing retrieved at alla_failed_task_list_read_with_no_logs_at_all_fails_the_run.a_failing_loki_query_keeps_the_logs_that_loaded, and when it is the only sourcea_failing_loki_query_still_fails_the_run.Fix scope: invariant is that one job's missing or failed log never hides the others, and a failed retrieval never exits as a complete read. Callers checked:
run view --log/--log-failedandrun log, text and--json.Known edge cases (follow-up): CLS-1022 collects two. A missing task-list entry on Forgejo 16 (where
/actions/tasksignores itsrunfilter and can be capped) still printslog unavailableand exits 0, and the older-server path (fetch_run_logs_from_tasks) still returns on the first failed Loki query.Tests:
cargo test --bin fj workflow_logspasses (31), run locally.cargo clippy -D warningsfails onsrc/cli/pr_line_comment.rs:65(chunks_exact_to_as_chunks), which is onmainand unrelated to this change. Not run: the CLI against a live gateway; that needs a deployed build.Automated Codex review (read-only) of head
40d7176cc4.No new blocking findings.
src/api/workflow_logs.rs:1061,1213: The completeness and partial-failure invariants retain the two accepted deferrals in CLS-1022: capped task metadata can producelog unavailablewith exit 0, and the older-server adapter discards loaded logs after a later Loki failure. Both affectrun viewandrun log, including JSON. Follow-up fix: establish metadata completeness and settle older-server jobs independently. No new evidence warrants reopening either as blocking.BLOCKING: 0
Reviewed head
40d7176cc4at 2026-10-29T20:53:35Z by codex exec (read-only sandbox).