From 0a365274b6173a4068d77ba7e1396a9403d8b5fc Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 31 Oct 2026 07:11:13 -0700 Subject: [PATCH] docs(agent): a PR comment posts to the issues endpoint, and an empty jq body is silent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Measured while commenting on PR 102: POST /pulls/102/comments answers 405 to a plain body (it is the review-comment store); the conversation thread is POST /issues//comments, which answers 201 and returns an html_url on the PR. Gitea maintains one issue index, so the PR number is the same number. The trap that hid it: building the body with jq --rawfile b /dev/stdin inside a command substitution feeds jq nothing (the substitution does not inherit the heredoc), Gitea answers 422, and jq -r .id on the error prints nothing — a silent no-op that looked like a posted comment. The body goes in a file. --- serverAppConfigs-docs/Agent/Issue Tracker.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/serverAppConfigs-docs/Agent/Issue Tracker.md b/serverAppConfigs-docs/Agent/Issue Tracker.md index cd53cce..093847e 100644 --- a/serverAppConfigs-docs/Agent/Issue Tracker.md +++ b/serverAppConfigs-docs/Agent/Issue Tracker.md @@ -48,6 +48,14 @@ Use the `Authorization: token` header for everything. - **Read an issue**: `curl -s -K "$cfg" $API/issues/` (fields: `number`, `title`, `body`, `labels[].name`, `state`) - **List issues**: `curl -s -K "$cfg" "$API/issues?state=open&limit=50"` — add `&labels=` to filter - **Comment**: `curl -s -K "$cfg" -X POST -d "$(jq -n --rawfile b "$BODY" '{body:$b}')" $API/issues//comments` +- **Comment on a PR**: the conversation thread is `POST $API/issues//comments` + (201, and the answer's `html_url` points at `pulls/`; Gitea's issue index is + unified, so the PR's number is the same number). `$API/pulls//comments` is the + **review**-comment store and answers `405` to a plain body. +- **A body built by `jq --rawfile b /dev/stdin` inside `$(…)` is empty**: the command + substitution does not inherit the heredoc, so Gitea receives `{}` and answers 422 — + and `jq -r '.id'` on the error prints nothing, which reads as success. Write the + body to a file and pass `--rawfile` that file. - **Apply labels**: `POST $API/issues//labels` with `{"labels":[]}` — Gitea wants numeric label **IDs**, not names; resolve them from `GET $API/labels` (see [[Triage Labels]] for which labels exist) - **Remove a label**: `DELETE $API/issues//labels/` - **Close**: `PATCH $API/issues/` with `{"state":"closed"}`