feat(actions): wire log/artifact tools to v16 token REST API + add run-cancel tool #14

Open
opened 2026-07-10 13:57:21 +00:00 by Phil · 0 comments
Owner

Problem

This fork exposes get_job_logs, get_run_logs, and artifact-download tools, but they do not work against our instance on Forgejo v14. On v14 there is no token-authenticatable REST endpoint for Action job/run logs or artifact download — the web log route requires a session cookie, so a PAT gets a 404. Today we route around this with the "upload artifact → also attach to an issue/release → pull via the token-readable attachment API" workaround. The tools exist but hit a wall.

Unblocked by Forgejo v16

Forgejo v16 (GA ~2026-07-16) ships token-authenticated REST endpoints for exactly this (v16 milestone #70071; May-2026 monthly report):

  • GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs — plaintext, supports ?step=N and HTTP Range: (PR #12666).
  • GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs — zip of all job logs in the run.
  • GET /repos/{owner}/{repo}/actions/runs/{id}/jobs — list a run's jobs.
  • Artifact download REST API (PR #12140, closes #8004). Caveat: not actions/download-artifact-compatible — the client must not assume drop-in v4 behavior.
  • POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel — new run-cancel endpoint.

Exact log endpoint shape has a known ambiguity (milestone note uses the flat actions/jobs/{job_id}/logs; an earlier PR used actions/runs/{run_id}/jobs/{job_index}/logs). Verify against v16.next.forgejo.org / the running v16 instance before wiring.

Scope

  1. Repoint get_job_logs / get_run_logs (and artifact download) to the v16 token REST endpoints; remove the cookie/attachment workaround path once verified.
  2. Add a new cancel_workflow_run tool on the v16 cancel endpoint. This gives us a clean tool-call for the ENOSPC→deadlock and zombie-run hygiene that we currently fix via SQL-cancel + runner restart. (This is infra hygiene, NOT the E2E-behavior fix — that lives in #13, the merge-gating issue.)
  3. Optionally surface list_run_jobs if not already present.

Depends on

Philflow/flow.raven-deployment#267 (server upgrade v14 → v16). This work cannot be verified until v16 is live on forgejo.philflow.me. Can be developed/branched earlier against v16.next.forgejo.org.

Acceptance criteria

  • get_job_logs / get_run_logs return real logs against the v16 instance using only a PAT (no cookie).
  • Artifact download works via the v16 REST API; the non-download-artifact-compat caveat is handled/documented.
  • New cancel_workflow_run tool cancels an in-flight run via PAT.
  • The old attachment-workaround code path is removed (or gated behind a version check) once v16 is confirmed.
  • Exact endpoint paths verified against the live v16 API, not assumed from release notes.

References

  • Blocked on Philflow/flow.raven-deployment#267 (Forgejo v16 upgrade).
  • Related: #13 (this repo) — the merge-gating fix (independent of the upgrade).
## Problem This fork exposes `get_job_logs`, `get_run_logs`, and artifact-download tools, but **they do not work against our instance on Forgejo v14**. On v14 there is no token-authenticatable REST endpoint for Action job/run logs or artifact download — the web log route requires a session cookie, so a PAT gets a 404. Today we route around this with the "upload artifact → also attach to an issue/release → pull via the token-readable attachment API" workaround. The tools exist but hit a wall. ## Unblocked by Forgejo v16 Forgejo **v16** (GA ~2026-07-16) ships token-authenticated REST endpoints for exactly this (v16 milestone #70071; May-2026 monthly report): - `GET /repos/{owner}/{repo}/actions/jobs/{job_id}/logs` — plaintext, supports `?step=N` and HTTP `Range:` (PR #12666). - `GET /repos/{owner}/{repo}/actions/runs/{run_id}/logs` — zip of all job logs in the run. - `GET /repos/{owner}/{repo}/actions/runs/{id}/jobs` — list a run's jobs. - Artifact download REST API (PR #12140, closes #8004). **Caveat: not `actions/download-artifact`-compatible** — the client must not assume drop-in v4 behavior. - `POST /repos/{owner}/{repo}/actions/runs/{run_id}/cancel` — new run-cancel endpoint. > Exact log endpoint shape has a known ambiguity (milestone note uses the flat `actions/jobs/{job_id}/logs`; an earlier PR used `actions/runs/{run_id}/jobs/{job_index}/logs`). **Verify against `v16.next.forgejo.org` / the running v16 instance before wiring.** ## Scope 1. Repoint `get_job_logs` / `get_run_logs` (and artifact download) to the v16 token REST endpoints; remove the cookie/attachment workaround path once verified. 2. Add a new **`cancel_workflow_run`** tool on the v16 cancel endpoint. This gives us a clean tool-call for the ENOSPC→deadlock and zombie-run hygiene that we currently fix via SQL-cancel + runner restart. (This is infra hygiene, NOT the E2E-behavior fix — that lives in `#13`, the merge-gating issue.) 3. Optionally surface `list_run_jobs` if not already present. ## Depends on **`Philflow/flow.raven-deployment#267`** (server upgrade v14 → v16). This work cannot be verified until v16 is live on `forgejo.philflow.me`. Can be developed/branched earlier against `v16.next.forgejo.org`. ## Acceptance criteria - [ ] `get_job_logs` / `get_run_logs` return real logs against the v16 instance using only a PAT (no cookie). - [ ] Artifact download works via the v16 REST API; the non-`download-artifact`-compat caveat is handled/documented. - [ ] New `cancel_workflow_run` tool cancels an in-flight run via PAT. - [ ] The old attachment-workaround code path is removed (or gated behind a version check) once v16 is confirmed. - [ ] Exact endpoint paths verified against the live v16 API, not assumed from release notes. ## References - Blocked on `Philflow/flow.raven-deployment#267` (Forgejo v16 upgrade). - Related: `#13` (this repo) — the merge-gating fix (independent of the upgrade).
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Phil/forgejo-mcp#14
No description provided.