Fixes issue 375 (an agent cannot put a commit on the forge through the forge's tools).
What
A new Go bundle in the gitea module, cmd/forge (manifest artifact forge), serving six tools:
gitea_commit (a): one commit on a branch of its own, created from base (default the default branch) when absent. Carries either files (each {path, content | content_base64 | delete: true}, sent as one call to the forge's multi-file contents endpoint, create/update/delete decided by what the ref holds, update and delete carrying the blob sha read just before) or patch (a unified diff, sent to the forge's diffpatch endpoint). Answers the commit and its parent, and reads the branch back: a branch not at the commit the forge named is a failure.
gitea_commits, gitea_compare, gitea_pull_reviews (with line comments and whether each review is at the current head), gitea_list_dir, gitea_search_code (r): summarised reads.
Why
An agent had no way to put a checked change on the forge (no commit/push tool; gitea_api refuses diffpatch; its one file write takes a whole file base64-encoded). The decision recorded on the issue 2026-10-11: a commit tool held to the rule gitea_api already enforces (ADR 0266), plus the read tools.
The rule kept
Refused on the repository's default branch and on any branch a protection rule names (glob rules matched as guard.ts matches them). Protection rules that cannot be read refuse the commit (fails closed). Nothing about merging changes: gitea_merge_pull_request still needs a review at the head and both required checks green. Issue editing stays out (the issue tracker owns issues).
Design limits chosen
At most 200 files per commit; the commit is made as the forge's admin account (as every tool's write is today; issue 469 may change the account).
The forge has no code-search API, so gitea_search_code reads the ref's archive once (at most 64 MiB), skips binary files, names files over 4 MiB, answers at most max (default 100, up to 1000) matches.
The bundle duplicates the npm-registry bundle's small HTTP client (both are package main); not moved into a shared package to keep this change to one bundle.
How it was tested
go test -race ./cmd/... in modules/gitea against a fake forge (httptest): create+update+delete in one commit on a new branch from its base; an existing branch committed on; default branch, a protected glob branch and unreadable rules refused before anything is sent; a patch sent to diffpatch; a branch read back at another commit failing; a missing base and a delete of a missing file refused; every malformed ask refused; ruleCovers against guard.ts's cases; each read summarised; tool names held to README, manifest and not served by the TypeScript bundle.
merge-check.sh with MESH_CHECK_MODULES=gitea and a controller from mesh-controller main as MESH_GATE: passed (resources without health 69, as kept).
The live forge (Gitea 1.27.3) answered a multi-file contents write on a scratch branch with commit.sha as the code reads it (probe branch deleted again). The diffpatch endpoint is not yet proven live: it is once this delivers, by a gitea_commit with patch on a branch of its own.
Acceptance: an agent calls gitea.gitea_commit with its change on fix/<n>-<slug>, the branch is on the forge at the commit the tool answered, and a pull request from it gets its checks — with no one pushing by hand.
Fixes issue 375 (an agent cannot put a commit on the forge through the forge's tools).
## What
A new Go bundle in the gitea module, `cmd/forge` (manifest artifact `forge`), serving six tools:
- `gitea_commit` (a): one commit on a branch of its own, created from `base` (default the default branch) when absent. Carries either `files` (each `{path, content | content_base64 | delete: true}`, sent as one call to the forge's multi-file contents endpoint, create/update/delete decided by what the ref holds, update and delete carrying the blob sha read just before) or `patch` (a unified diff, sent to the forge's diffpatch endpoint). Answers the commit and its parent, and reads the branch back: a branch not at the commit the forge named is a failure.
- `gitea_commits`, `gitea_compare`, `gitea_pull_reviews` (with line comments and whether each review is at the current head), `gitea_list_dir`, `gitea_search_code` (r): summarised reads.
## Why
An agent had no way to put a checked change on the forge (no commit/push tool; `gitea_api` refuses diffpatch; its one file write takes a whole file base64-encoded). The decision recorded on the issue 2026-10-11: a commit tool held to the rule `gitea_api` already enforces (ADR 0266), plus the read tools.
## The rule kept
Refused on the repository's default branch and on any branch a protection rule names (glob rules matched as `guard.ts` matches them). Protection rules that cannot be read refuse the commit (fails closed). Nothing about merging changes: `gitea_merge_pull_request` still needs a review at the head and both required checks green. Issue editing stays out (the issue tracker owns issues).
## Design limits chosen
- At most 200 files per commit; the commit is made as the forge's admin account (as every tool's write is today; issue 469 may change the account).
- The forge has no code-search API, so `gitea_search_code` reads the ref's archive once (at most 64 MiB), skips binary files, names files over 4 MiB, answers at most `max` (default 100, up to 1000) matches.
- The bundle duplicates the npm-registry bundle's small HTTP client (both are `package main`); not moved into a shared package to keep this change to one bundle.
## How it was tested
- `go test -race ./cmd/...` in modules/gitea against a fake forge (httptest): create+update+delete in one commit on a new branch from its base; an existing branch committed on; default branch, a protected glob branch and unreadable rules refused before anything is sent; a patch sent to diffpatch; a branch read back at another commit failing; a missing base and a delete of a missing file refused; every malformed ask refused; ruleCovers against guard.ts's cases; each read summarised; tool names held to README, manifest and not served by the TypeScript bundle.
- `merge-check.sh` with `MESH_CHECK_MODULES=gitea` and a controller from mesh-controller main as `MESH_GATE`: passed (resources without health 69, as kept).
- The live forge (Gitea 1.27.3) answered a multi-file contents write on a scratch branch with `commit.sha` as the code reads it (probe branch deleted again). The diffpatch endpoint is not yet proven live: it is once this delivers, by a `gitea_commit` with `patch` on a branch of its own.
Acceptance: an agent calls `gitea.gitea_commit` with its change on `fix/<n>-<slug>`, the branch is on the forge at the commit the tool answered, and a pull request from it gets its checks — with no one pushing by hand.
An agent could not get a finished change onto the forge without someone
pushing by hand, so the branch / pull request / approval rule could not be
followed. A Go bundle serves gitea_commit, held to gitea_api's rule (never the
default branch, never a protected one), and the summarised reads agents
otherwise made through gitea_api as raw JSON.
Deliverynovox/mesh-catalog@9eb2ea8d69f0 — delivered since 2026-10-12T10:20:02Z
Delivery plan — builds gitea → novox; no bus step
tier 0: gitea
novox: receives gitea
gitea provides npm-package-registry, git: its consumers are sent again after it
gitea keeps data (ADR 0233): what it holds is backed up before it moves
Machines
gitea on novox: passed — healthy 1 times over 29s
gitea on the rest running it: sent
Transitions
2026-10-12 10:07 (new) → proposed (announced): novox/mesh-catalog#233's head announced
2026-10-12 10:10 proposed → checked (checked): the verdict names this commit
2026-10-12 10:10 checked → ready (accepted): the gate passed or warned, and the repository's own check did not fail
2026-10-12 10:17 ready → published (merged): on the trunk its modules follow: merged there, and its walk opened — or nothing for a walk to move
2026-10-12 10:17 published → delivering (go): its walk started: let go by this owner in its group's order, by a person, or on the controller's own path — not a failed walk that carried a later commit for it, after which it waits for a walk of its own commit
2026-10-12 10:20 delivering → delivered (done): its walk is done, carrying its own commit: every machine of its deploy plan passed, or was left as its policy says
The commit's note under refs/notes/mesh-plan keeps every transition: git log --notes=mesh-plan.
<!-- mesh-delivery:view -->
**Delivery** `novox/mesh-catalog@9eb2ea8d69f0` — **delivered** since 2026-10-12T10:20:02Z
**Delivery plan** — builds gitea → novox; no bus step
- tier 0: gitea
- novox: receives gitea
- gitea provides npm-package-registry, git: its consumers are sent again after it
- gitea keeps data (ADR 0233): what it holds is backed up before it moves
**Machines**
- gitea on novox: passed — healthy 1 times over 29s
- gitea on the rest running it: sent
**Transitions**
- 2026-10-12 10:07 (new) → proposed (announced): novox/mesh-catalog#233's head announced
- 2026-10-12 10:10 proposed → checked (checked): the verdict names this commit
- 2026-10-12 10:10 checked → ready (accepted): the gate passed or warned, and the repository's own check did not fail
- 2026-10-12 10:17 ready → published (merged): on the trunk its modules follow: merged there, and its walk opened — or nothing for a walk to move
- 2026-10-12 10:17 published → delivering (go): its walk started: let go by this owner in its group's order, by a person, or on the controller's own path — not a failed walk that carried a later commit for it, after which it waits for a walk of its own commit
- 2026-10-12 10:20 delivering → delivered (done): its walk is done, carrying its own commit: every machine of its deploy plan passed, or was left as its policy says
The commit's note under `refs/notes/mesh-plan` keeps every transition: `git log --notes=mesh-plan`.
mesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: gitea)
mesh/repo-check: PASS — its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
Delivery plan — builds gitea → novox; no bus step
tier 0: gitea
novox: receives gitea
gitea provides npm-package-registry, git: its consumers are sent again after it
gitea keeps data (ADR 0233): what it holds is backed up before it moves
Run by the build seat on novox as build-1791799628984021756 (builds --log build-1791799628984021756).
--- the gate: gitea
gitea: ok, keeps data (valuable); WARNING: server stay(s) up and say(s) not how it is ready — judged by liveness alone, refused from 2026-11-18 (ADR 0240 rule 8)
long-running resources without health: 1
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 1 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T09:59:43Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T09:59:43Z
modules the change moves:
- gitea (changed)
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes; the change adds 1 resource(s) and removes 0 (+archive:gitea.bundle-forge)
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): gitea
--- its merge-check.sh (go toolchain)
ok git.novox.be/novox/mesh-catalog/checks/words 0.003s
words: 12 retired words and 70 daemons' lines, none in the 42862 strings of 687 files
ok git.novox.be/novox/mesh-catalog/checks/agenthome 0.013s
agent-home: no archive and no file written into under the agent's home
ok git.novox.be/novox/mesh-catalog/checks/paths 0.007s
paths: no module names another's state on its machine (3 known, listed to go)
long-running resources without health: 69, as kept
testing modules/gitea
ok gitea/cmd/forge 1.065s
ok gitea/cmd/npm-registry 1.812s
--- its merge-check-typescript.sh (typescript toolchain)
type-checking modules/gitea (TypeScript)
testing modules/gitea (TypeScript)
✔ a pull request opened after the margin is looked at, by its own update time (14.517757ms)
✔ every open pull request is read with what its base requires and what its head has (gitea_open_pulls) (71.174363ms)
✔ a pull request or issue number that is not one is refused before the forge is asked (1.701752ms)
✔ the newest status of each context is kept, with what it said, when and by whom (18.055141ms)
✔ a commit merges only when every required status is a success; a warning blocks (0.653641ms)
✔ no rule requires nothing; a rule that cannot be read says nothing, never yes (0.290921ms)
✔ a commit is contained in another when the compare finds nothing on it the other lacks (0.884031ms)
✔ a note line is appended once, as the forge's user, in its own repository (11.487493ms)
✔ a note that cannot be written is said, never read as written (0.563561ms)
✔ one view per pull request, found by its marker; only the mesh's statuses (0.902611ms)
✔ a build machine taking the check is said on the head: building on which machine, since the local time (13.703286ms)
✔ the verdict heard while a 'building' write is in flight lands last and stays (5.889237ms)
✔ the verdict written while a start's read of the forge is in flight stays the newest status (1.375252ms)
✔ the verdict heard while a 'building' write still waits its turn: the 'building' is never written (0.712201ms)
✔ a start heard after the verdict writes nothing (0.53105ms)
✔ a start from before the check now pending (a run before a recheck, the stream's history) writes nothing (0.708831ms)
✔ a head this process did not announce (it restarted) is said only while the forge holds its gate pending (0.502161ms)
✔ a repository as the mesh clones it is told from another (4.871066ms)
✔ gitea_api refuses the forge's administration, a branch's protection and the merge check's status, and sends nothing (5.654126ms)
✔ gitea_api refuses a file written to the default branch or one a rule guards, and writes one on a branch of its own (68.022059ms)
✔ gitea_api still writes what an author writes (11.223723ms)
✔ gitea_branch_protection_set only strengthens (26.671621ms)
✔ gitea_merge_pull_request merges only a head whose required statuses all succeeded, and only that head (38.623394ms)
✔ gitea_merge_pull_request merges only the head it is named, and refuses one that is not the head (16.451389ms)
✔ gitea_merge_pull_request is loud when the forge merged a head other than the one it was handed (12.190614ms)
✔ gitea_merge_pull_request says the merge happened when reading back what landed fails (22.450476ms)
✔ gitea_merge_pull_request reads back a fast-forward, and says it cannot read back a squash or a rebase (48.596457ms)
✔ gitea_delete_repo deletes only the tools' own user's repository, unguarded, untouched for 30 days, named in full (22.932607ms)
✔ gitea_api sends the path it judged, and refuses moving a pull request's base (4.602575ms)
✔ gitea_merge_pull_request merges only into a branch whose protection requires the checks (6.458448ms)
✔ a rule named for a branch is not made weaker than the glob rule that guards it now (15.088337ms)
✔ a repository owner or name is never another path (0.287741ms)
✔ the judges, without a forge (0.35161ms)
✔ gitea_api never acts as another user: sudo, in any case, and any query key it does not send are refused (3.744945ms)
✔ gitea_api never approves a pull request nor requests changes: those are the operator's (2.310553ms)
✔ no tool's caller text becomes another path or another user: `..` and `?sudo=` are refused before the forge (4.859355ms)
✔ every page of a pull request's files is read, though the forge caps a page at fifty (29.825984ms)
✔ a pass asks only the repositories that moved since the last look, every one before the first (0.42357ms)
✔ the directories above a merge's files that hold a module at the commit are said, the root never (16.85943ms)
✔ a lookup the forge refuses is thrown, not read as no module (7.162208ms)
✔ a renamed file is said under its old name too, as gone (novox/hq ADR 0267) (7.568719ms)
✔ the statuses asked for replace the rule's, and an empty list requires none (7.210509ms)
✔ a new rule refuses direct pushes unless asked; an administrator's override only when said (0.28831ms)
✔ each open pull request's new head is announced once, and nothing closed or merged (16.135609ms)
✔ a verdict is the head commit's status; an error is the forge's error, never a success (0.802901ms)
✔ each layer is its own status: the gate with the modules it judged, the repository's own check beside it (0.706591ms)
✔ no verdict sets warning on a required check; only a person's decision fails (0.987211ms)
✔ a commit status is set on the commit, under the merge check's context (39.851937ms)
✔ a change plan is the gate's result: said on the status and, when it builds something, as a comment (0.47893ms)
✔ a head announced is pending in the build queue, since the local time it was announced (0.215441ms)
✔ first start: mints with the admin account, keeps the token at 0600, asks for the tools' scopes only (50.303289ms)
✔ second start: reuses the kept token, mints nothing (20.868085ms)
✔ the forge rejects the kept token (its data was restored): minted afresh, once, and the call goes through (47.281745ms)
✔ a token kept with write:admin by an earlier build is minted again without it at the next start, and the forge drops the old one (24.822259ms)
✔ a kept token lacking a scope the tools need: the forge refuses the call for the scope, the token is re-minted with the whole list, and the call goes through (16.598269ms)
✔ the kept file is gone but the forge still holds a token by that name: replaced, not refused (17.28136ms)
✔ concurrent first calls share one mint (10.602653ms)
✔ the admin account is refused: said plainly, nothing kept, and the next call fails the same way rather than crashing (15.779168ms)
✔ one process shares one source per kept file — the watcher and the tools never renew against each other (1.214272ms)
✔ a second process finds the token the first renewed, and reuses it instead of minting over it (18.030331ms)
✔ a configured token wins, and is reported rather than minted over when the forge rejects it (2.624923ms)
✔ nothing to mint with and no token: the client says what is missing (0.256861ms)
[gitea] no tools — no Gitea token, and nothing to mint one with — set MESH_GITEA_TOKEN, or MESH_GITEA_ADMIN_USER, MESH_GITEA_ADMIN_PASSWORD_FILE, MESH_GITEA_STATE_DIR
[gitea] no token kept — minting one
[gitea] the forge already holds a token named "mesh-tools" — replacing it
[gitea] minted a token for "mesh-admin" (write:repository, write:issue, read:user), kept at /tmp/gitea-yLesc0/state/token
✔ the tools register once there is a way to a token, and the first call mints it (9.18433ms)
[gitea] no token kept — minting one
[gitea] the forge already holds a token named "mesh-tools" — replacing it
[gitea] minted a token for "mesh-admin" (write:repository, write:issue, read:user), kept at /tmp/gitea-DomTIl/state/token
✔ a pull request can be closed, read and cleaned up through the tools (17.34063ms)
ℹ tests 64
ℹ suites 0
ℹ pass 64
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 481.31485
**Merge check** at `9eb2ea8d`
- `mesh/merge-gate`: **PASS** — every machine composes with the change as it did without (4 of 4 compose) (modules: gitea)
- `mesh/repo-check`: **PASS** — its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)
**Delivery plan** — builds gitea → novox; no bus step
- tier 0: gitea
- novox: receives gitea
- gitea provides npm-package-registry, git: its consumers are sent again after it
- gitea keeps data (ADR 0233): what it holds is backed up before it moves
Run by the build seat on novox as `build-1791799628984021756` (`builds --log build-1791799628984021756`).
```
--- the gate: gitea
gitea: ok, keeps data (valuable); WARNING: server stay(s) up and say(s) not how it is ready — judged by liveness alone, refused from 2026-11-18 (ADR 0240 rule 8)
long-running resources without health: 1
files asking for a setting without saying whether it is trusted: 0
1 manifest(s) checked. Judged against the seats this binary carries; a claim on one of the mesh's own seats is judged fully at registration, and a seat declared by a module not given here reads as unknown. Identities judged on a 6-character machine name, against the bounds of the providers given here
judging 1 module(s) changed against 4 machine(s), as the snapshot of 2026-10-12T09:59:43Z says they run
composing every machine as the mesh is
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
composing every machine with the change
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
the bus's user list leaves out 5 user(s) the mesh has minted no credential for: controller, node.f35, node.idt, node.ygcyr, node.yvbpsm. Each is a user that cannot connect until one is issued
merge gate: PASS — every machine composes with the change as it did without (4 of 4 compose)
judged by controller development build against the facts of 2026-10-12T09:59:43Z
modules the change moves:
- gitea (changed)
machines:
- a machine (f35): composes
- holds mesh-dns-resolver (idt): composes
- holds git, holds mesh-artifact-store, holds mesh-broker, holds mesh-catalog, holds mesh-delivery, holds mesh-dns-resolver, holds mesh-store, holds mesh-vault, holds npm-package-registry, the control node, the hub (ygcyr): composes; the change adds 1 resource(s) and removes 0 (+archive:gitea.bundle-forge)
- a machine (yvbpsm): composes
a merge would rebuild 1 module(s) in 1 tier(s): gitea
--- its merge-check.sh (go toolchain)
ok git.novox.be/novox/mesh-catalog/checks/words 0.003s
words: 12 retired words and 70 daemons' lines, none in the 42862 strings of 687 files
ok git.novox.be/novox/mesh-catalog/checks/agenthome 0.013s
agent-home: no archive and no file written into under the agent's home
ok git.novox.be/novox/mesh-catalog/checks/paths 0.007s
paths: no module names another's state on its machine (3 known, listed to go)
long-running resources without health: 69, as kept
testing modules/gitea
ok gitea/cmd/forge 1.065s
ok gitea/cmd/npm-registry 1.812s
--- its merge-check-typescript.sh (typescript toolchain)
type-checking modules/gitea (TypeScript)
testing modules/gitea (TypeScript)
✔ a pull request opened after the margin is looked at, by its own update time (14.517757ms)
✔ every open pull request is read with what its base requires and what its head has (gitea_open_pulls) (71.174363ms)
✔ a pull request or issue number that is not one is refused before the forge is asked (1.701752ms)
✔ the newest status of each context is kept, with what it said, when and by whom (18.055141ms)
✔ a commit merges only when every required status is a success; a warning blocks (0.653641ms)
✔ no rule requires nothing; a rule that cannot be read says nothing, never yes (0.290921ms)
✔ a commit is contained in another when the compare finds nothing on it the other lacks (0.884031ms)
✔ a note line is appended once, as the forge's user, in its own repository (11.487493ms)
✔ a note that cannot be written is said, never read as written (0.563561ms)
✔ one view per pull request, found by its marker; only the mesh's statuses (0.902611ms)
✔ a build machine taking the check is said on the head: building on which machine, since the local time (13.703286ms)
✔ the verdict heard while a 'building' write is in flight lands last and stays (5.889237ms)
✔ the verdict written while a start's read of the forge is in flight stays the newest status (1.375252ms)
✔ the verdict heard while a 'building' write still waits its turn: the 'building' is never written (0.712201ms)
✔ a start heard after the verdict writes nothing (0.53105ms)
✔ a start from before the check now pending (a run before a recheck, the stream's history) writes nothing (0.708831ms)
✔ a head this process did not announce (it restarted) is said only while the forge holds its gate pending (0.502161ms)
✔ a repository as the mesh clones it is told from another (4.871066ms)
✔ gitea_api refuses the forge's administration, a branch's protection and the merge check's status, and sends nothing (5.654126ms)
✔ gitea_api refuses a file written to the default branch or one a rule guards, and writes one on a branch of its own (68.022059ms)
✔ gitea_api still writes what an author writes (11.223723ms)
✔ gitea_branch_protection_set only strengthens (26.671621ms)
✔ gitea_merge_pull_request merges only a head whose required statuses all succeeded, and only that head (38.623394ms)
✔ gitea_merge_pull_request merges only the head it is named, and refuses one that is not the head (16.451389ms)
✔ gitea_merge_pull_request is loud when the forge merged a head other than the one it was handed (12.190614ms)
✔ gitea_merge_pull_request says the merge happened when reading back what landed fails (22.450476ms)
✔ gitea_merge_pull_request reads back a fast-forward, and says it cannot read back a squash or a rebase (48.596457ms)
✔ gitea_delete_repo deletes only the tools' own user's repository, unguarded, untouched for 30 days, named in full (22.932607ms)
✔ gitea_api sends the path it judged, and refuses moving a pull request's base (4.602575ms)
✔ gitea_merge_pull_request merges only into a branch whose protection requires the checks (6.458448ms)
✔ a rule named for a branch is not made weaker than the glob rule that guards it now (15.088337ms)
✔ a repository owner or name is never another path (0.287741ms)
✔ the judges, without a forge (0.35161ms)
✔ gitea_api never acts as another user: sudo, in any case, and any query key it does not send are refused (3.744945ms)
✔ gitea_api never approves a pull request nor requests changes: those are the operator's (2.310553ms)
✔ no tool's caller text becomes another path or another user: `..` and `?sudo=` are refused before the forge (4.859355ms)
✔ every page of a pull request's files is read, though the forge caps a page at fifty (29.825984ms)
✔ a pass asks only the repositories that moved since the last look, every one before the first (0.42357ms)
✔ the directories above a merge's files that hold a module at the commit are said, the root never (16.85943ms)
✔ a lookup the forge refuses is thrown, not read as no module (7.162208ms)
✔ a renamed file is said under its old name too, as gone (novox/hq ADR 0267) (7.568719ms)
✔ the statuses asked for replace the rule's, and an empty list requires none (7.210509ms)
✔ a new rule refuses direct pushes unless asked; an administrator's override only when said (0.28831ms)
✔ each open pull request's new head is announced once, and nothing closed or merged (16.135609ms)
✔ a verdict is the head commit's status; an error is the forge's error, never a success (0.802901ms)
✔ each layer is its own status: the gate with the modules it judged, the repository's own check beside it (0.706591ms)
✔ no verdict sets warning on a required check; only a person's decision fails (0.987211ms)
✔ a commit status is set on the commit, under the merge check's context (39.851937ms)
✔ a change plan is the gate's result: said on the status and, when it builds something, as a comment (0.47893ms)
✔ a head announced is pending in the build queue, since the local time it was announced (0.215441ms)
✔ first start: mints with the admin account, keeps the token at 0600, asks for the tools' scopes only (50.303289ms)
✔ second start: reuses the kept token, mints nothing (20.868085ms)
✔ the forge rejects the kept token (its data was restored): minted afresh, once, and the call goes through (47.281745ms)
✔ a token kept with write:admin by an earlier build is minted again without it at the next start, and the forge drops the old one (24.822259ms)
✔ a kept token lacking a scope the tools need: the forge refuses the call for the scope, the token is re-minted with the whole list, and the call goes through (16.598269ms)
✔ the kept file is gone but the forge still holds a token by that name: replaced, not refused (17.28136ms)
✔ concurrent first calls share one mint (10.602653ms)
✔ the admin account is refused: said plainly, nothing kept, and the next call fails the same way rather than crashing (15.779168ms)
✔ one process shares one source per kept file — the watcher and the tools never renew against each other (1.214272ms)
✔ a second process finds the token the first renewed, and reuses it instead of minting over it (18.030331ms)
✔ a configured token wins, and is reported rather than minted over when the forge rejects it (2.624923ms)
✔ nothing to mint with and no token: the client says what is missing (0.256861ms)
[gitea] no tools — no Gitea token, and nothing to mint one with — set MESH_GITEA_TOKEN, or MESH_GITEA_ADMIN_USER, MESH_GITEA_ADMIN_PASSWORD_FILE, MESH_GITEA_STATE_DIR
[gitea] no token kept — minting one
[gitea] the forge already holds a token named "mesh-tools" — replacing it
[gitea] minted a token for "mesh-admin" (write:repository, write:issue, read:user), kept at /tmp/gitea-yLesc0/state/token
✔ the tools register once there is a way to a token, and the first call mints it (9.18433ms)
[gitea] no token kept — minting one
[gitea] the forge already holds a token named "mesh-tools" — replacing it
[gitea] minted a token for "mesh-admin" (write:repository, write:issue, read:user), kept at /tmp/gitea-DomTIl/state/token
✔ a pull request can be closed, read and cleaned up through the tools (17.34063ms)
ℹ tests 64
ℹ suites 0
ℹ pass 64
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 481.31485
```
Independent review for issue 375 (an agent cannot put a commit on the forge), against the decision noted on the issue 2026-10-11 and ADR 0266. Nothing blocking; the follow-ups below are for issues of their own.
Checked
Where a commit may go. commit() (cmd/forge/commit.go ~155-172) reads the repository, refuses when the forge does not name a default branch, reads /branch_protections and refuses on any error (fails closed, test TestRulesThatCannotBeReadRefuseTheCommit), then targetRefused (commit.go ~133-150) refuses the default branch and any branch a rule covers, before anything is written. ruleCovers (forge.go ~205-232) is guard.ts:168-181 line for line (** -> .*, * -> [^/]*, ? -> [^/], the rest quoted), and TestRuleCoversIsTheGuardsRule holds them together. The bundle calls only fixed endpoints: no merge, no protection, no status, no settings route exists in it. Branch, file path, ref and directory go through segments (forge.go ~170-182: empty, ., .., ?#%\ and control characters refused, each segment path-escaped, same rule as guard.ts pathSegments); owner and repo through repoPath (same shape as checkName); query values are url-escaped. A branch such as refs/heads/main is not the default branch by name and would at worst create refs/heads/refs/heads/main: not a way onto main.
Concurrent edits. An update or delete carries the blob sha read just before (commit.go ~238-256), so the forge refuses a file changed meanwhile. A new branch reads its files at the base's commit id, not its name.
Read-back. The branch is read back after the write; an error, a missing branch or a branch at another commit is returned as an error, never as success (commit.go ~272-281, TestACommitTheBranchDoesNotShowIsAFailure).
Bounds and secrets. 200 files per commit; JSON answers capped at 32 MiB and a cut body refused (forge.go do); the archive capped at 64 MiB, files over 4 MiB named under skipped, matches capped at max (1..1000), lines cut at 300 bytes; RE2 regexes only. The password is read per call, sent only as basic auth, never put in an error (TestAWrongPasswordFailsWithoutSayingIt); a forge error carries at most 300 bytes of the forge's own answer.
The copied HTTP client. Both bundles (cmd/npm-registry and cmd/forge) are in the one module, modules/gitea. The rule "code shared between modules belongs in mesh-sdk" is about sharing between modules, so this is duplication within a module, not a breach. Not blocking. Suggested follow-up: move it into a package of the module's own Go module (for example modules/gitea/internal/forgehttp) that both package main bundles import.
Manifest and README. The forge artifact (module.json ~261-276) matches the npm-registry artifact (kind bundle, language go, system arch, loads = its binary, the same URL, user and password file; no MESH_NPM_OWNER, which it does not use). The manifest lists no tools, as for npm-registry; TestToolsAreTheOnesTheReadmeNamesAndTheManifestBuilds holds the six names to the README, to the manifest's artifact and to no name the TypeScript bundle serves. The README section matches the code.
Tests and checks. go test -race -count=1 ./cmd/forge/ ./cmd/npm-registry/: both ok; go vet ./cmd/forge/: clean. On 9eb2ea8, mesh/merge-gate is success ("4 of 4 compose") and mesh/repo-check is success (go and typescript parts).
Not blocking, worth an issue each
A patch is not tied to the parent it was read at. The diffpatch call (commit.go ~226-230) sends no sha, so on an existing branch the forge applies the patch onto whatever head the branch has by then. The forge's git apply refuses a hunk whose context changed, so nothing is overwritten, but parent in the answer can name a commit that is not the parent. As I read Gitea's API, the diffpatch body takes sha and compares it to the branch's head commit; sending sha: out.Parent would refuse the race. I did not verify this on Gitea 1.27; please check it when diffpatch is first proven live, which the PR body says it is not yet.
The same applies, more mildly, to files on an existing branch: the blobs are read at the branch's name (ref = a.Branch), not at existing.Commit.ID, so parent can be stale when the branch moves between the two reads. Reading at the commit id, or checking in the read-back that the new commit's parent is out.Parent, would make parent evidence.
The glob matcher shares guard.ts's gap: Gitea's protection globs also take [...] classes and {a,b} alternatives, which both matchers treat as literal text. A rule written that way would not be seen here. I think the forge itself still refuses a push to a rule that disallows pushes, even by the admin account, but I did not test that; the fix belongs in guard.ts and here together.
Search walks the whole decompressed archive without looking at the context: a 64 MiB archive of highly compressible files is decompressed in full even after the 50-second deadline. Checking ctx.Err() per tar entry would bound it.
No bound on a single file's content or a patch's size in gitea_commit beyond what the MCP message carries.
The bundle authenticates with the admin password, so it holds write:admin that the TypeScript bundle's token no longer has (ADR 0266). Its fixed endpoints and path checks keep that from being reachable today; issue 469 (a non-admin account for the tools) is where it goes away.
Reviewed by an agent on g14 for the operator; not a merge.
Verdict: approve at 9eb2ea8
Independent review for issue 375 (an agent cannot put a commit on the forge), against the decision noted on the issue 2026-10-11 and ADR 0266. Nothing blocking; the follow-ups below are for issues of their own.
Checked
1. Where a commit may go. `commit()` (cmd/forge/commit.go ~155-172) reads the repository, refuses when the forge does not name a default branch, reads `/branch_protections` and refuses on any error (fails closed, test TestRulesThatCannotBeReadRefuseTheCommit), then `targetRefused` (commit.go ~133-150) refuses the default branch and any branch a rule covers, before anything is written. `ruleCovers` (forge.go ~205-232) is guard.ts:168-181 line for line (`**` -> `.*`, `*` -> `[^/]*`, `?` -> `[^/]`, the rest quoted), and TestRuleCoversIsTheGuardsRule holds them together. The bundle calls only fixed endpoints: no merge, no protection, no status, no settings route exists in it. Branch, file path, ref and directory go through `segments` (forge.go ~170-182: empty, `.`, `..`, `?#%\` and control characters refused, each segment path-escaped, same rule as guard.ts pathSegments); owner and repo through `repoPath` (same shape as checkName); query values are url-escaped. A branch such as `refs/heads/main` is not the default branch by name and would at worst create `refs/heads/refs/heads/main`: not a way onto main.
2. Concurrent edits. An update or delete carries the blob sha read just before (commit.go ~238-256), so the forge refuses a file changed meanwhile. A new branch reads its files at the base's commit id, not its name.
3. Read-back. The branch is read back after the write; an error, a missing branch or a branch at another commit is returned as an error, never as success (commit.go ~272-281, TestACommitTheBranchDoesNotShowIsAFailure).
4. Bounds and secrets. 200 files per commit; JSON answers capped at 32 MiB and a cut body refused (forge.go `do`); the archive capped at 64 MiB, files over 4 MiB named under skipped, matches capped at `max` (1..1000), lines cut at 300 bytes; RE2 regexes only. The password is read per call, sent only as basic auth, never put in an error (TestAWrongPasswordFailsWithoutSayingIt); a forge error carries at most 300 bytes of the forge's own answer.
5. The copied HTTP client. Both bundles (cmd/npm-registry and cmd/forge) are in the one module, modules/gitea. The rule "code shared between modules belongs in mesh-sdk" is about sharing between modules, so this is duplication within a module, not a breach. Not blocking. Suggested follow-up: move it into a package of the module's own Go module (for example modules/gitea/internal/forgehttp) that both `package main` bundles import.
6. Manifest and README. The `forge` artifact (module.json ~261-276) matches the npm-registry artifact (kind bundle, language go, system arch, `loads` = its binary, the same URL, user and password file; no MESH_NPM_OWNER, which it does not use). The manifest lists no `tools`, as for npm-registry; TestToolsAreTheOnesTheReadmeNamesAndTheManifestBuilds holds the six names to the README, to the manifest's artifact and to no name the TypeScript bundle serves. The README section matches the code.
7. Tests and checks. `go test -race -count=1 ./cmd/forge/ ./cmd/npm-registry/`: both ok; `go vet ./cmd/forge/`: clean. On 9eb2ea8, mesh/merge-gate is success ("4 of 4 compose") and mesh/repo-check is success (go and typescript parts).
Not blocking, worth an issue each
- A patch is not tied to the parent it was read at. The diffpatch call (commit.go ~226-230) sends no `sha`, so on an existing branch the forge applies the patch onto whatever head the branch has by then. The forge's `git apply` refuses a hunk whose context changed, so nothing is overwritten, but `parent` in the answer can name a commit that is not the parent. As I read Gitea's API, the diffpatch body takes `sha` and compares it to the branch's head commit; sending `sha: out.Parent` would refuse the race. I did not verify this on Gitea 1.27; please check it when diffpatch is first proven live, which the PR body says it is not yet.
- The same applies, more mildly, to `files` on an existing branch: the blobs are read at the branch's name (`ref = a.Branch`), not at `existing.Commit.ID`, so `parent` can be stale when the branch moves between the two reads. Reading at the commit id, or checking in the read-back that the new commit's parent is `out.Parent`, would make `parent` evidence.
- The glob matcher shares guard.ts's gap: Gitea's protection globs also take `[...]` classes and `{a,b}` alternatives, which both matchers treat as literal text. A rule written that way would not be seen here. I think the forge itself still refuses a push to a rule that disallows pushes, even by the admin account, but I did not test that; the fix belongs in guard.ts and here together.
- Search walks the whole decompressed archive without looking at the context: a 64 MiB archive of highly compressible files is decompressed in full even after the 50-second deadline. Checking `ctx.Err()` per tar entry would bound it.
- No bound on a single file's content or a patch's size in gitea_commit beyond what the MCP message carries.
- The bundle authenticates with the admin password, so it holds `write:admin` that the TypeScript bundle's token no longer has (ADR 0266). Its fixed endpoints and path checks keep that from being reachable today; issue 469 (a non-admin account for the tools) is where it goes away.
Reviewed by an agent on g14 for the operator; not a merge.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Fixes issue 375 (an agent cannot put a commit on the forge through the forge's tools).
What
A new Go bundle in the gitea module,
cmd/forge(manifest artifactforge), serving six tools:gitea_commit(a): one commit on a branch of its own, created frombase(default the default branch) when absent. Carries eitherfiles(each{path, content | content_base64 | delete: true}, sent as one call to the forge's multi-file contents endpoint, create/update/delete decided by what the ref holds, update and delete carrying the blob sha read just before) orpatch(a unified diff, sent to the forge's diffpatch endpoint). Answers the commit and its parent, and reads the branch back: a branch not at the commit the forge named is a failure.gitea_commits,gitea_compare,gitea_pull_reviews(with line comments and whether each review is at the current head),gitea_list_dir,gitea_search_code(r): summarised reads.Why
An agent had no way to put a checked change on the forge (no commit/push tool;
gitea_apirefuses diffpatch; its one file write takes a whole file base64-encoded). The decision recorded on the issue 2026-10-11: a commit tool held to the rulegitea_apialready enforces (ADR 0266), plus the read tools.The rule kept
Refused on the repository's default branch and on any branch a protection rule names (glob rules matched as
guard.tsmatches them). Protection rules that cannot be read refuse the commit (fails closed). Nothing about merging changes:gitea_merge_pull_requeststill needs a review at the head and both required checks green. Issue editing stays out (the issue tracker owns issues).Design limits chosen
gitea_search_codereads the ref's archive once (at most 64 MiB), skips binary files, names files over 4 MiB, answers at mostmax(default 100, up to 1000) matches.package main); not moved into a shared package to keep this change to one bundle.How it was tested
go test -race ./cmd/...in modules/gitea against a fake forge (httptest): create+update+delete in one commit on a new branch from its base; an existing branch committed on; default branch, a protected glob branch and unreadable rules refused before anything is sent; a patch sent to diffpatch; a branch read back at another commit failing; a missing base and a delete of a missing file refused; every malformed ask refused; ruleCovers against guard.ts's cases; each read summarised; tool names held to README, manifest and not served by the TypeScript bundle.merge-check.shwithMESH_CHECK_MODULES=giteaand a controller from mesh-controller main asMESH_GATE: passed (resources without health 69, as kept).commit.shaas the code reads it (probe branch deleted again). The diffpatch endpoint is not yet proven live: it is once this delivers, by agitea_commitwithpatchon a branch of its own.Acceptance: an agent calls
gitea.gitea_commitwith its change onfix/<n>-<slug>, the branch is on the forge at the commit the tool answered, and a pull request from it gets its checks — with no one pushing by hand.Delivery
novox/mesh-catalog@9eb2ea8d69f0— delivered since 2026-10-12T10:20:02ZDelivery plan — builds gitea → novox; no bus step
Machines
Transitions
The commit's note under
refs/notes/mesh-plankeeps every transition:git log --notes=mesh-plan.Merge check at
9eb2ea8dmesh/merge-gate: PASS — every machine composes with the change as it did without (4 of 4 compose) (modules: gitea)mesh/repo-check: PASS — its merge-check.sh passed, each part in its toolchain: merge-check.sh (go), merge-check-typescript.sh (typescript)Delivery plan — builds gitea → novox; no bus step
Run by the build seat on novox as
build-1791799628984021756(builds --log build-1791799628984021756).Verdict: approve at
9eb2ea8Independent review for issue 375 (an agent cannot put a commit on the forge), against the decision noted on the issue 2026-10-11 and ADR 0266. Nothing blocking; the follow-ups below are for issues of their own.
Checked
commit()(cmd/forge/commit.go ~155-172) reads the repository, refuses when the forge does not name a default branch, reads/branch_protectionsand refuses on any error (fails closed, test TestRulesThatCannotBeReadRefuseTheCommit), thentargetRefused(commit.go ~133-150) refuses the default branch and any branch a rule covers, before anything is written.ruleCovers(forge.go ~205-232) is guard.ts:168-181 line for line (**->.*,*->[^/]*,?->[^/], the rest quoted), and TestRuleCoversIsTheGuardsRule holds them together. The bundle calls only fixed endpoints: no merge, no protection, no status, no settings route exists in it. Branch, file path, ref and directory go throughsegments(forge.go ~170-182: empty,.,..,?#%\and control characters refused, each segment path-escaped, same rule as guard.ts pathSegments); owner and repo throughrepoPath(same shape as checkName); query values are url-escaped. A branch such asrefs/heads/mainis not the default branch by name and would at worst createrefs/heads/refs/heads/main: not a way onto main.do); the archive capped at 64 MiB, files over 4 MiB named under skipped, matches capped atmax(1..1000), lines cut at 300 bytes; RE2 regexes only. The password is read per call, sent only as basic auth, never put in an error (TestAWrongPasswordFailsWithoutSayingIt); a forge error carries at most 300 bytes of the forge's own answer.package mainbundles import.forgeartifact (module.json ~261-276) matches the npm-registry artifact (kind bundle, language go, system arch,loads= its binary, the same URL, user and password file; no MESH_NPM_OWNER, which it does not use). The manifest lists notools, as for npm-registry; TestToolsAreTheOnesTheReadmeNamesAndTheManifestBuilds holds the six names to the README, to the manifest's artifact and to no name the TypeScript bundle serves. The README section matches the code.go test -race -count=1 ./cmd/forge/ ./cmd/npm-registry/: both ok;go vet ./cmd/forge/: clean. On9eb2ea8, mesh/merge-gate is success ("4 of 4 compose") and mesh/repo-check is success (go and typescript parts).Not blocking, worth an issue each
sha, so on an existing branch the forge applies the patch onto whatever head the branch has by then. The forge'sgit applyrefuses a hunk whose context changed, so nothing is overwritten, butparentin the answer can name a commit that is not the parent. As I read Gitea's API, the diffpatch body takesshaand compares it to the branch's head commit; sendingsha: out.Parentwould refuse the race. I did not verify this on Gitea 1.27; please check it when diffpatch is first proven live, which the PR body says it is not yet.fileson an existing branch: the blobs are read at the branch's name (ref = a.Branch), not atexisting.Commit.ID, soparentcan be stale when the branch moves between the two reads. Reading at the commit id, or checking in the read-back that the new commit's parent isout.Parent, would makeparentevidence.[...]classes and{a,b}alternatives, which both matchers treat as literal text. A rule written that way would not be seen here. I think the forge itself still refuses a push to a rule that disallows pushes, even by the admin account, but I did not test that; the fix belongs in guard.ts and here together.ctx.Err()per tar entry would bound it.write:adminthat the TypeScript bundle's token no longer has (ADR 0266). Its fixed endpoints and path checks keep that from being reachable today; issue 469 (a non-admin account for the tools) is where it goes away.Reviewed by an agent on g14 for the operator; not a merge.