run logs: find a run far back in the task list by bisection instead of an incomplete walk (CLS-1060) #303
Loading…
Reference in a new issue
No description provided.
Delete branch "stephen/cls-1060-task-lookup"
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?
fj run logsfinds a run's task ids by walkingGET /actions/tasksnewest first (Forgejo 16 ignores therunfilter), up to 40 pages of 50. On a very busy repository, a run older than that read as an incomplete task list, so its jobs reported a retrieval error even though their logs exist.list_run_tasksnow bisects the page numbers. The list is newest first, so a page's lowest id falls as the page number rises. It finds the first page holding a task at or below the newest still-unresolved id, and resumes the walk one page early (tasks added between reads push entries down a page). A run 10,000 pages back takes about 20 reads.total_count. A run in the first pages never pays for a probe, the older-server path (no wanted ids) still walks to exhaustion, and a list withouttotal_countstill walks to the cap and reports incomplete.Failure paths
total_count(the list grew): a task is called absent only when the page after the computed last page is empty. Otherwise the walk carries on to the cap and reports the list incomplete, never a shorter answer.Fix scope
list_run_tasks(both entry points:RemoteTasksfor the Loki fallback and the older-server exhaustive walk) and the probe pages. Self-review (three rounds) found the assumed page size, the stale total, probes dropping the tasks they read, and a jump aimed at already-found ids; each has a test./actions/tasks, counted requests): a run 10,000 pages back, the last page, a task older than the list, a failing probe, a clamped page size, a list longer than its total, tasks separated by a rerun, tasks further apart than the cap, a probe that read a task before a later probe failed, and a run near the top making exactly one read.cargo test --bin fj workflow_logspasses (55).cargo clippy -D warningsalready fails onpr_line_comment.rswith this toolchain, untouched here; nothing new in this file.Known edge cases (follow-up)
Automated Codex review (read-only) of head
6d97929708.No new correctness, security, or failure-path problems found against STANDARDS.md. Checked probe retention, repeated jumps, completion decisions, and both RemoteTasks entry points.
The accepted deletion-between-probes edge case remains unchanged, as documented under “Known edge cases (follow-up).”
BLOCKING: 0
Reviewed head
6d97929708at 2026-11-01T01:44:41Z by codex exec (read-only sandbox).