get_run_logs / get_job_logs always 404 on private repos #25
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Symptom
get_run_logsandget_job_logsreturnlogs 404for every private repo, even when the run exists. Example: flow.raven run_number 27531, DB id 41915, api-tests.yml, job agent-tools, status failure. On 2026-09-19, all 7 log fetches since 12:30 UTC failed identically, in flow.raven, flow.raven-deployment and RavenBot.Root cause (not a Forgejo outage, not log storage)
router: completed GET /Philflow/flow.raven/actions/runs/27531/jobs/0/attempt/1/logs ... 404 Not Found in 3.2ms @ context/repo.go:456(context.RepoAssignment).services/auth/method/basic.go:43readsif !middleware.IsAPIPath(req) && !isContainerPath(req) && !isAttachmentDownload(req) && !isGitRawOrAttachOrLFSPath(req) { return &auth.AuthenticationNotAttempted{} }, andoauth2.go:222has the same guard. The token sent byDoRawis ignored, so the request counts as anonymous. For a private repo, anonymous access means 404. This was confirmed in-cluster: anonymousGET /Philflow/flow.ravenand/api/v1/repos/Philflow/flow.ravenboth return 404.routers/api/v1/api.go:888-893exposes only/actions/tasks,/actions/runsand/actions/runs/{run_id}.diagnoseLogs404then tells the caller to retry with the run_number. That sends agents in circles, because the run_number was already correct.The web-route approach came in with
3c2b705("drop fictitious /api/v1 paths, use Forgejo web routes"). It can only work for public repos.To decide
Until one of them lands, the tool should say plainly that logs are not reachable for private repos instead of blaming the id.
Refs Philflow/auto-issue-orchestrator#215
Workaround finding (2026-09-19): A browser session that is already logged in can read the job logs. In the logged-in browser,
fetch('/Philflow/flow.raven/actions/runs/<run_number>/jobs/<job_index>/attempt/1/logs')returns 200 with the full log (29,517 lines for run 27582). The session cookie authenticates the web route; an API token does not (see the analysis above).This confirms the diagnosis: the route and the log storage work, and only token-based authentication on the web route is missing. It is not a clean fix for agents, because it depends on a human's browser session. The decision between a separate log access and an upstream API is still open.