Repository navigation
Description
Problem
#204 moves fork creation and renaming out of the App into the Prepare forks job, under a machine account's classic token (fork_pool_token). When a target repository has been renamed, fork_pool.start() finds its fork under the old name and renames it with PATCH /repos/{fork}. GitHub allows that to an account with admin on the repository alone.
The rollout in #204 asks for an account that belongs to the fork organisations "with permission to create repositories there". That makes the account admin of the forks it creates, but not of the forks already in the pools, which the App created. Renaming one of those fails with a 403, and that target's publish then fails as a missing fork, with a reason that points at the forks job but not at the account's rights.
Required behaviour
- Before the
PATCH,start()reads the found fork (GET /repos/{found}; the reply carries the token'spermissions). Whenpermissions.adminis nottrue, it fails that target with"<pool account> cannot rename <found>: it needs admin on the fork, or owner of <fork_org>", and makes no write. The other targets go ahead, as for any failure there. - A fork the job has just created is the account's own, so the check passes; a test proves the created-then-renamed path still works.
docs/DESIGN.md§10.6 (added by Feat(publish): Prepare forks in a separate job #204) and the README's rollout say the account needs admin on every repository in the fork organisations (owner, or a base permission of admin), and why: renames.
Acceptance criteria
- Tests in
tests/test_fork_pool.py: a listed fork the token lacks admin on fails with the reason and noPATCH; with admin it is renamed as today; a fork created in the same run is renamed; a target whose fork is already present makes no permission read. -
uv run python -B -m unittest discover -s testspasses. -
prek run --files <changed files>and the aislop gate report no findings.
Depends on
#204, which adds scripts/fork_pool.py.
Out of scope
- Whether the App's installation covers the forks the account creates (its own issue).
- The token's scopes, which
check_tokenalready holds topublic_repo.
Activity
lf-releng-code-monkey-bot commentedon Nov 22, 2026
🐒 An AI agent has proposed a change for this issue: pull request #222 (head c09e6db). The Copilot review of it is clean. Still pending after 8 minutes and not waited for, so its result is unknown: pre-commit.ci - pr. An antagonistic review was requested from the review bot.