forgejo-cli: fj_write.py issue-create exits silently, issue-label builds invalid fj argv #27
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
public/chiche-plugins#27
Loading…
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?
Summary
Two bugs in
forgejo-cli'sscripts/fj_write.py, both hit while creating andlabelling a single issue. The first breaks the script's documented "never returns
a silent success" guarantee. The second makes
issue-labelunusable for issues.Found at plugin cache revision
85f098aac759(
skills/forgejo-cli/scripts/fj_write.py).Bug 1:
issue-createsucceeds while printing nothingfj_write.py issue-createcreated the issue successfully but emitted zerobytes on both stdout and stderr, exiting
0.Command run (from the skill directory):
Observed: no output at all. Expected, per
SKILL.md:and
Impact
The caller cannot distinguish success from failure, and the new issue's number
is never reported. Recovering it costs an extra round-trip -- in this case a
whole
fj-workerdispatch purely to answer "did that land, and what number isit?" (the issue had in fact been created, as
#612inhome/homelab). Worse,a caller who assumes failure and retries will file a duplicate.
Notes
--dry-runprints correctly, so the argv construction is fine:intact (4645 chars, byte-identical to the
--body-filesource):post-write re-read-and-print step that produces nothing for
issue-create.Suspect the success path for
issue-createskips the print, or prints to astream that is discarded.
Bug 2:
issue-labelbuilds an invalidfjcommandissue-labelconstructsfj issue edit <N> labels -a <label>, butfj issue edithas nolabelssubcommand, so the call always fails.fjitself confirms the subcommand does not exist:Only
title,body, andcomment. There is no label surface for issues infjat all.Impact
issue-labelcan never succeed.SKILL.mdadvertises it as a supportedcommand:
Every issue-labelling request fails with exit
5, which per the skill's ownrouting then triggers an
fj-workerdispatch -- and the worker cannot fix iteither, because the capability is missing from
fj, not mis-invoked.Suggested fix
Route
issue-labelthrough the REST API instead offj:This mirrors how
pr-reviewalready bypassesfjfor a capabilityfjlacks,so the pattern is established in the script. Note the add endpoint takes label
IDs, not names, so it needs a name-to-ID lookup --
fj_read.py --list-labelsalready fetches exactly that mapping.Worth checking whether
pr-labelhas the same defect, or whetherfj pr editgenuinely does expose labels.
Workaround
Apply issue labels through the web UI.
Secondary observation:
fj-workercannot reach the networkWhen dispatched to recover from Bug 2, the
fj-workersubagent was blocked fromboth running
fjand making REST calls, so it could not complete the task. Inworking around the block it read the credential store and printed the live token
to stdout, which tripped a security warning.
Two things worth addressing independently of the bugs above:
fj-workeris the documented recovery path, it needs whateverpermissions
fj/ REST access require -- otherwise the recovery path is adead end for exactly the cases that reach it.
pipe credentials straight into the request, and to fail loudly rather than
echo them when access is blocked.
@claude implement the fix, pr it
🤖 Claude picked this up -- mode: prepare-only (/hl-implement) -- running in a herdr tab on mini.
Claimed via 👀 reaction (and dispatch label(s) removed, where present); re-add a label or re-mention to re-engage. This comment updates as the run progresses.
⚠️ Spawn failed:
herdr agent start rc=1: {"error":{"code":"invalid_agent_name","message":"agent name must start with a lowercase letter and contain only lowercase letters, digits, '-' or '_' (1-32 characters)"},"id":"cli:agent:start"}.@claude try again
The spawn failure is already fixed -- this run is the proof that it worked.
What broke last time. dispatch-monitor built the herdr agent name as
dispatch-<basename>-<number>-c<comment_id>, which for this item came out asdispatch-chiche-plugins-27-c15925-- 33 characters, one over herdr's 32-charcap. herdr rejects that with
invalid_agent_name, whose message leads with thecharacter-class rule and buries the length rule at the end, so it read as a
charset problem rather than a length one.
Fixed in
home/homelab#613(commit48b43bf, merged 18:36 today): the name isnow
agent_name(basename, number)->d-chiche-plugins-27, with a[:32]clamp as a backstop for longer repo names.
Why this reply and not a PR.
try againcarries no escalation keyword, sothe daemon routed it to ask mode -- reply in-thread, no worktree, no branch,
no PR. Only
implement/auto/updateescalate.To actually get the fix PR'd, re-mention with the keyword:
Status of the two bugs in this issue -- both still unfixed on
main(
plugins/forgejo-cli/skills/forgejo-cli/scripts/fj_write.py, last touched by#25):
issue-createprints nothing on success -- the post-write re-read-and-printstep doesn't fire for the create path.
issue-labelbuildsfj issue edit <N> labels -a <L>;fj issue edithasno
labelssubcommand, so it always exits 5. Needs the REST route(
POST /repos/{owner}/{repo}/issues/{index}/labels, IDs not names), the sameway
pr-reviewalready bypassesfj.pr-labelshares the code path(
cmd_labelis registered for both) and is worth checking in the same pass.session: 57102610-75e1-40c1-97c4-154145a98467
@claude implement
🤖 Done -- mode: prepare-only (
taskfamily).Drafted and resolved PR #29 -- #29 (branch
fix/fj-write-create-and-label). Both bugs fixed:issue-createnow creates via REST and prints the new issue's state; label writes moved offfjonto the REST labels endpoint, with unknown names failing loudly (exit 2).Still drafted (
WIP:) -- tests were not run (prepare-only contract). Run/task-orchestrate 29to test + review, then merge.One finding worth your eye: bug 2 does not reproduce on every
fjbuild -- the mac host'sfjdoes haveissue edit <N> labels, the container's does not. Details in the PR body's Why.session: 57102610-75e1-40c1-97c4-154145a98467
@claude should #29 have closed this issue?
It should have, and it didn't because of how I wrote the line. My mistake.
What happened. The PR body carries
**Closes:** #27. Forgejo's auto-closeparser wants the keyword at a word boundary -- preceded by start-of-line or
whitespace, and followed directly by the ref, as in
Closes #27. The**bolding and the
:inside the emphasis both sit between the keyword and theform it recognises, so it parsed as a plain cross-reference: it linked #27 to
the PR (which is why the reference shows on this issue) but never registered a
close action. The squash commit
8be048acarries the same line verbatim, so themerge had nothing to act on either.
The mechanical fix for next time is to write it unadorned on its own line:
But I would not just close this issue. #27 has three parts and the PR
deliberately covered two:
issue-createexiting silent. Fixed; it creates via REST andprints the new issue's state.
issue-labelbuilding invalidfjargv. Fixed; label writes gothrough the REST labels endpoint, and an unknown name now exits
2instead ofsilently not sticking.
fj-workerhaving no network access on therecovery path, and printing the live token to stdout when blocked. Untouched.
That lives in
plugins/forgejo-cli/agents/fj-worker.mdand its sandboxconfig, not in
fj_write.py, and the PR body flagged it as out of scope.So an auto-close on merge would have been slightly wrong here regardless of the
syntax. Your call on the shape:
fj-workerhalf (I'd suggest this --the token-echo is worth its own tracking, and it is the more urgent of the two).
fj-workerhalf.Say which and I'll do it.
session: 57102610-75e1-40c1-97c4-154145a98467