The crew landing tools read only the github.com origin and gh: a forge-homed repo cannot be batched or landed by the tool #8

Open
opened 2026-11-22 04:42:38 +00:00 by terra · 4 comments
Member

Purpose (defect): the crew's landing tools work on a repository whose home is the forge, so a batch is built, checked and landed by the tool, not by hand.

The class

Crew tools that read or write a repository take its home to be the github.com origin of the workspace clone and GitHub's API through gh. Since DECIDED 2026-11-21 "move all our work off Github", the forge (git.macula.io) is where the work lives, and the shared gh account answers "HTTP 403: Your account was suspended". So each such tool either fails or, worse, sends traffic to GitHub while the crew is told to send none.

Read at macula-io/martha 3479a491:

  • src/land_passed_work_as_one_batch/land_passed_work_as_one_batch.ts:217, :533, :586 run git fetch origin; src/read_the_origin_a_clone_has/read_the_origin_a_clone_has.ts:77 takes the repo and default branch from origin.
  • src/find_the_work_a_verdict_passed/find_the_work_a_verdict_passed.ts:100 finds the PR with gh api repos/<repo>/commits/<head>/pulls.
  • The same ['fetch', ... 'origin'] is in open_and_finish_a_worktree.ts (crew_worktree_create / crew_worktree_finish), check_a_range_before_the_owner_says_yes.ts (crew_verify_range), the_commits_a_handoff_names.ts (the HANDOFF/VERDICT sha check) and run_an_owner_signed_command/signed_base.ts.

The instance

2026-11-22, macula-apps/martha-board: Mars asked for crew_land_batch on forge PR 2 (P4 of #2, 5ed27607) + PR 3 (#7 part b, dfa59b27) on main 7e9eb42b. The workspace clone's origin is github.com, so the tool would have fetched from GitHub and asked GitHub for the PRs. Terra built the same batch by hand on the forge clone (terra/batch-p4-7b at 8c46083b, forge PR 10). The VERDICT/HANDOFF sha check also refused shas until the branch was fetched by hand from the clone's forge remote into the github.com clone.

Done when

  • The landing tools (and the others named above) take the repository's home from one place the crew sets, and with the forge set they fetch from the forge and find PRs through the Forgejo API (/repos/{o}/{r}/pulls, matching head.sha), with no gh call and no github.com fetch.
  • A check fails by name when any of these tools, run against a clone whose home is a Forgejo URL with gh absent from PATH, calls gh or fetches from github.com. (This is a new check: it needs Raf's yes before it is built, per DECIDED 2026-11-19 "No new checks without your yes (Recommended)".) CUT by the Supervisor (B11), relayed by Mars 2026-11-23: "the new "fails by name" check is CUT (B11; the landing-path tests cover the harm)". Raf can overrule.
Purpose (defect): the crew's landing tools work on a repository whose home is the forge, so a batch is built, checked and landed by the tool, not by hand. ## The class Crew tools that read or write a repository take its home to be the github.com `origin` of the workspace clone and GitHub's API through `gh`. Since DECIDED 2026-11-21 "move all our work off Github", the forge (git.macula.io) is where the work lives, and the shared gh account answers "HTTP 403: Your account was suspended". So each such tool either fails or, worse, sends traffic to GitHub while the crew is told to send none. Read at macula-io/martha 3479a491: - `src/land_passed_work_as_one_batch/land_passed_work_as_one_batch.ts:217`, `:533`, `:586` run `git fetch origin`; `src/read_the_origin_a_clone_has/read_the_origin_a_clone_has.ts:77` takes the repo and default branch from `origin`. - `src/find_the_work_a_verdict_passed/find_the_work_a_verdict_passed.ts:100` finds the PR with `gh api repos/<repo>/commits/<head>/pulls`. - The same `['fetch', ... 'origin']` is in `open_and_finish_a_worktree.ts` (crew_worktree_create / crew_worktree_finish), `check_a_range_before_the_owner_says_yes.ts` (crew_verify_range), `the_commits_a_handoff_names.ts` (the HANDOFF/VERDICT sha check) and `run_an_owner_signed_command/signed_base.ts`. ## The instance 2026-11-22, macula-apps/martha-board: Mars asked for crew_land_batch on forge PR 2 (P4 of #2, 5ed27607) + PR 3 (#7 part b, dfa59b27) on main 7e9eb42b. The workspace clone's `origin` is github.com, so the tool would have fetched from GitHub and asked GitHub for the PRs. Terra built the same batch by hand on the forge clone (terra/batch-p4-7b at 8c46083b, forge PR 10). The VERDICT/HANDOFF sha check also refused shas until the branch was fetched by hand from the clone's `forge` remote into the github.com clone. ## Done when - The landing tools (and the others named above) take the repository's home from one place the crew sets, and with the forge set they fetch from the forge and find PRs through the Forgejo API (`/repos/{o}/{r}/pulls`, matching `head.sha`), with no `gh` call and no github.com fetch. - ~~A check fails by name when any of these tools, run against a clone whose home is a Forgejo URL with `gh` absent from PATH, calls `gh` or fetches from github.com. (This is a new check: it needs Raf's yes before it is built, per DECIDED 2026-11-19 "No new checks without your yes (Recommended)".)~~ CUT by the Supervisor (B11), relayed by Mars 2026-11-23: "the new "fails by name" check is CUT (B11; the landing-path tests cover the harm)". Raf can overrule.
Author
Member

Same class on the crew-code side: macula-io/macula-sponsors#4 (crew_worktree_create always fetches origin and takes no base) and macula-io/macula-sponsors#5 (the SendMessage sha check fetches github.com and is tied to the package repo). This issue covers martha's src/ copies; those cover the crew mod. Build them as one fix, not twice. Until it lands, batches are built by hand: every commit listed (sha + subject), the base read from forge main by ls-remote, and the run ids, read by eye by the Supervisor.

Same class on the crew-code side: macula-io/macula-sponsors#4 (crew_worktree_create always fetches origin and takes no base) and macula-io/macula-sponsors#5 (the SendMessage sha check fetches github.com and is tied to the package repo). This issue covers martha's src/ copies; those cover the crew mod. Build them as one fix, not twice. Until it lands, batches are built by hand: every commit listed (sha + subject), the base read from forge main by ls-remote, and the run ids, read by eye by the Supervisor.
Member

Design r=1: landing and batching on the #46 host seam (Venus)

Purpose (defect), restated: a batch on a forge-homed repository is built, checked and landed by the tool, with no gh call and no github.com fetch. DECIDED 2026-11-22 "Martha should be able to work with any git hoster": every host call goes through the one adapter that the declared host kind picks. This design adds no second way to choose a host.

Seam: PR 50 (pallas/46-forge-ci-seam at a75c4c35, stacked on PR 40), not yet landed. The build stacks on PR 50 and merges it in once if its head moves. Read at forge main d8e33b07.

1. What is host-specific today, and what is not

Call File Host-specific? Change
git fetch/push/ls-remote origin land_passed_work_as_one_batch.ts:217,526,533,545,573,586, check_a_range…:183, open_and_finish_a_worktree, the_commits_a_handoff_names, signed_base No. They go to the clone's own origin. Since the workdir moved to git.macula.io (crew.json workdir, former_workdirs: ["github.com"]), each clone's origin is the forge. The issue's instance ran in the old github.com tree. None in code. The landing names the host it reads (§3), so a clone whose origin is still github.com is visible, never silent.
Open PR at the passed head: gh api repos/<r>/commits/<head>/pulls find_the_work_a_verdict_passed.ts:98-102 Yes New seam method openPullRequestsAt (§2)
CI runs + jobs on the tip: gh api …/actions/runs?head_sha= and …/runs/<id>/jobs check_a_range_before_the_owner_says_yes.ts:311,331 Yes Seam runsOnTip + new jobsNamed (§2)
"GitHub marks its pull request merged" after the fast-forward land_passed_work_as_one_batch.ts header Yes: Forgejo does it only when the repo sets autodetect_manual_merge, which is off by default. martha-board PRs 2/3/10 and martha PRs 4/34/40/51 read merged=false. §4: a repo setting, not code

2. Two methods added to TheCiOfAHost (one interface, every adapter)

/** The open pull requests whose head is exactly this sha in this repository; their numbers, ascending. */
openPullRequestsAt(repo: string, head: string): Promise<Read<readonly number[]>>
/** Every job of a run with where it stands; a job not yet ended is listed as not ended, never left out. */
jobsNamed(repo: string, run: ARun): Promise<Read<readonly AJob[]>>   // AJob = { name, ended, conclusion }
  • github: openPullRequestsAt is today's repos/<r>/commits/<head>/pulls, filtered to state=open && head.sha===head. jobsNamed is today's runs/<id>/jobs. Both go through the GitHub adapter's own budget, as #46's reads do. A GitHub landing reads exactly what it reads today.
  • forgejo: openPullRequestsAt is repos/<r>/pulls?state=open&limit=50&page=n, matching head.sha exactly, with pages bounded as FORGEJO_TASK_PAGES bounds tasks. A page past the bound is a why, never "none". I probed it live: 19 open on martha, head.sha present, x-total-count sent. commits/<sha>/pull does not fit: it finds only merged PRs, and an open PR's head answers 404 (probed on PR 50's head). jobsNamed is the tasks join jobsOf already does, returned as rows instead of a count. jobsOf becomes the count of jobsNamed when every row has ended, so it keeps one reader.
  • A kind with no adapter: no adapter for <kind>, as #46 has it. That closes #31's class for the landing, because a host that cannot be parsed is no origin host, never GitHub.

3. Where the landing picks its adapter

theCiOfAHostFor(asked, repo) reads <clones>/<repo>. The landing works in the clone path it is handed (batch.path, range.path). I split the seam's entry so the same choice runs on a given path:

export async function theCiOfAHostAt(asked: TheCiAsked, clone: string, repo: string): Promise<Read<ChosenCi>>
// theCiOfAHostFor(asked, repo) = theCiOfAHostAt(asked, join(asked.clones, repo), repo)

Same fail-closed words, same origin parser. verify_range, land_batch and fast_forward_after_the_owners_yes receive the same TheCiAsked the send gets (a_crews_tools.ts:919-934), built once and passed to both. Each answer's menu line names host=<host> kind=<kind>, so the owner sees which host was read.

Failure behaviour does not change (martha#601): a host the seam cannot choose, or an adapter why, is one notice line, and the passed head still lands. That is today's "gh could not answer". The one new refusal: a clone whose origin repository is not the package's repository is refused by name, as #46 refuses it.

4. The PR's merged mark on Forgejo

A --no-ff push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has autodetect_manual_merge: true (a PATCH /repos/{o}/{r} setting; it needs repo admin). Two options:

  • (a, recommended) A forge admin sets autodetect_manual_merge on each crew repo. This is a forge setting and needs no code. It sits in the chain menu as one line per repo, under DECIDED 2026-11-22 "add the rules" (the crew administers the forge).
  • (b) The adapter closes the PR by API after the fast-forward. That is a write with a member token: more code, a second outward act per package, and a token that needs write scope.

The landing does not depend on either: it lands the passed head whatever the PR says. Option (a) only keeps the forge's PR list true.

5. Tests (red first), no new check

  • find_the_work…: a Forgejo origin, with a stand-in curl answering a pulls page copied from the live answer (per the stand-in rule), yields the PR number. Also: two open PRs give the "more than one" notice; a page past the bound gives a notice; gh absent from PATH and never called.
  • check_a_range…: a Forgejo origin; runs + tasks copied from live answers; a job not ended is named; no gh call.
  • seam: theCiOfAHostAt on a path; jobsNamed on both adapters; jobsOf = count of jobsNamed.
  • A GitHub origin reads byte-for-byte as today (existing landing tests stay green unchanged).

The Done-when's second bullet, a check that fails by name when any of these tools calls gh or fetches github.com on a forge clone, is a new check, so it needs Raf's yes (DECIDED 2026-11-19 "No new checks without your yes (Recommended)"). The tests above are ordinary suite cases, not that check. I ask for it as its own menu line and do not build it without the yes.

6. Not in this package

  • keep_the_owners_todo_list.ts:300-301 (pr_merged/tag_exists via gh): it is not among #8's named tools, and it is on #16's list.
  • crew_worktree_finish's open-PR check reading GitHub is macula-sponsors#29 (crew mod). It can use openPullRequestsAt once this lands; a note goes on #29, and nothing is built here.
  • #32 (forge page cap assumed to be 50): openPullRequestsAt reads x-total-count and refuses a short read. It does not settle #32's other readers.

Refs #46, #8, #31, #32, macula-io/macula-sponsors#29.

## Design r=1: landing and batching on the #46 host seam (Venus) Purpose (defect), restated: a batch on a forge-homed repository is built, checked and landed by the tool, with no `gh` call and no github.com fetch. DECIDED 2026-11-22 "Martha should be able to work with any git hoster": every host call goes through the one adapter that the declared host kind picks. This design adds no second way to choose a host. Seam: PR 50 (`pallas/46-forge-ci-seam` at `a75c4c35`, stacked on PR 40), not yet landed. The build stacks on PR 50 and merges it in once if its head moves. Read at forge main `d8e33b07`. ### 1. What is host-specific today, and what is not | Call | File | Host-specific? | Change | |---|---|---|---| | `git fetch/push/ls-remote origin` | `land_passed_work_as_one_batch.ts:217,526,533,545,573,586`, `check_a_range…:183`, `open_and_finish_a_worktree`, `the_commits_a_handoff_names`, `signed_base` | **No.** They go to the clone's own `origin`. Since the workdir moved to `git.macula.io` (crew.json `workdir`, `former_workdirs: ["github.com"]`), each clone's origin is the forge. The issue's instance ran in the old github.com tree. | None in code. The landing names the host it reads (§3), so a clone whose origin is still github.com is visible, never silent. | | Open PR at the passed head: `gh api repos/<r>/commits/<head>/pulls` | `find_the_work_a_verdict_passed.ts:98-102` | **Yes** | New seam method `openPullRequestsAt` (§2) | | CI runs + jobs on the tip: `gh api …/actions/runs?head_sha=` and `…/runs/<id>/jobs` | `check_a_range_before_the_owner_says_yes.ts:311,331` | **Yes** | Seam `runsOnTip` + new `jobsNamed` (§2) | | "GitHub marks its pull request merged" after the fast-forward | `land_passed_work_as_one_batch.ts` header | **Yes**: Forgejo does it only when the repo sets `autodetect_manual_merge`, which is off by default. martha-board PRs 2/3/10 and martha PRs 4/34/40/51 read `merged=false`. | §4: a repo setting, not code | ### 2. Two methods added to `TheCiOfAHost` (one interface, every adapter) ```ts /** The open pull requests whose head is exactly this sha in this repository; their numbers, ascending. */ openPullRequestsAt(repo: string, head: string): Promise<Read<readonly number[]>> /** Every job of a run with where it stands; a job not yet ended is listed as not ended, never left out. */ jobsNamed(repo: string, run: ARun): Promise<Read<readonly AJob[]>> // AJob = { name, ended, conclusion } ``` - **github**: `openPullRequestsAt` is today's `repos/<r>/commits/<head>/pulls`, filtered to `state=open && head.sha===head`. `jobsNamed` is today's `runs/<id>/jobs`. Both go through the GitHub adapter's own budget, as #46's reads do. A GitHub landing reads exactly what it reads today. - **forgejo**: `openPullRequestsAt` is `repos/<r>/pulls?state=open&limit=50&page=n`, matching `head.sha` exactly, with pages bounded as `FORGEJO_TASK_PAGES` bounds tasks. A page past the bound is a `why`, never "none". I probed it live: 19 open on martha, `head.sha` present, `x-total-count` sent. `commits/<sha>/pull` does not fit: it finds only *merged* PRs, and an open PR's head answers 404 (probed on PR 50's head). `jobsNamed` is the tasks join `jobsOf` already does, returned as rows instead of a count. `jobsOf` becomes the count of `jobsNamed` when every row has ended, so it keeps one reader. - A kind with no adapter: `no adapter for <kind>`, as #46 has it. That closes #31's class for the landing, because a host that cannot be parsed is `no origin host`, never GitHub. ### 3. Where the landing picks its adapter `theCiOfAHostFor(asked, repo)` reads `<clones>/<repo>`. The landing works in the clone path it is handed (`batch.path`, `range.path`). I split the seam's entry so the same choice runs on a given path: ```ts export async function theCiOfAHostAt(asked: TheCiAsked, clone: string, repo: string): Promise<Read<ChosenCi>> // theCiOfAHostFor(asked, repo) = theCiOfAHostAt(asked, join(asked.clones, repo), repo) ``` Same fail-closed words, same origin parser. `verify_range`, `land_batch` and `fast_forward_after_the_owners_yes` receive the same `TheCiAsked` the send gets (`a_crews_tools.ts:919-934`), built once and passed to both. Each answer's menu line names `host=<host> kind=<kind>`, so the owner sees which host was read. **Failure behaviour does not change (martha#601):** a host the seam cannot choose, or an adapter `why`, is one notice line, and the passed head still lands. That is today's "gh could not answer". The one new refusal: a clone whose origin repository is not the package's repository is refused by name, as #46 refuses it. ### 4. The PR's merged mark on Forgejo A `--no-ff` push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has `autodetect_manual_merge: true` (a `PATCH /repos/{o}/{r}` setting; it needs repo admin). Two options: - **(a, recommended)** A forge admin sets `autodetect_manual_merge` on each crew repo. This is a forge setting and needs no code. It sits in the chain menu as one line per repo, under DECIDED 2026-11-22 "add the rules" (the crew administers the forge). - (b) The adapter closes the PR by API after the fast-forward. That is a write with a member token: more code, a second outward act per package, and a token that needs write scope. The landing does not depend on either: it lands the passed head whatever the PR says. Option (a) only keeps the forge's PR list true. ### 5. Tests (red first), no new check - `find_the_work…`: a Forgejo origin, with a stand-in curl answering a pulls page *copied from the live answer* (per the stand-in rule), yields the PR number. Also: two open PRs give the "more than one" notice; a page past the bound gives a notice; `gh` absent from PATH and never called. - `check_a_range…`: a Forgejo origin; runs + tasks copied from live answers; a job not ended is named; no `gh` call. - seam: `theCiOfAHostAt` on a path; `jobsNamed` on both adapters; `jobsOf` = count of `jobsNamed`. - A GitHub origin reads byte-for-byte as today (existing landing tests stay green unchanged). The Done-when's second bullet, *a check that fails by name when any of these tools calls gh or fetches github.com on a forge clone*, is a **new check**, so it needs Raf's yes (DECIDED 2026-11-19 "No new checks without your yes (Recommended)"). The tests above are ordinary suite cases, not that check. I ask for it as its own menu line and do not build it without the yes. ### 6. Not in this package - `keep_the_owners_todo_list.ts:300-301` (`pr_merged`/`tag_exists` via `gh`): it is not among #8's named tools, and it is on #16's list. - `crew_worktree_finish`'s open-PR check reading GitHub is macula-sponsors#29 (crew mod). It can use `openPullRequestsAt` once this lands; a note goes on #29, and nothing is built here. - #32 (forge page cap assumed to be 50): `openPullRequestsAt` reads `x-total-count` and refuses a short read. It does not settle #32's other readers. Refs #46, #8, #31, #32, macula-io/macula-sponsors#29.
Member

Done-when cut: the second line (a new check failing by name when a tool calls gh or fetches github.com on a forge clone) is CUT. The Supervisor ruled it (B11), relayed by Mars: "the new "fails by name" check is CUT (B11; the landing-path tests cover the harm)". Raf can overrule. The issue body strikes the line. The design (comment 707) keeps its §5 landing-path tests (stand-in curl output copied from live answers, gh absent and never called), and those are the cover. Saturnus reviews the design, with a fable subagent for the token part. The seam is PR 50.

Done-when cut: the second line (a new check failing by name when a tool calls `gh` or fetches github.com on a forge clone) is CUT. The Supervisor ruled it (B11), relayed by Mars: "the new "fails by name" check is CUT (B11; the landing-path tests cover the harm)". Raf can overrule. The issue body strikes the line. The design (comment 707) keeps its §5 landing-path tests (stand-in curl output copied from live answers, `gh` absent and never called), and those are the cover. Saturnus reviews the design, with a fable subagent for the token part. The seam is PR 50.
Member

Design r=2: landing and batching on the #46 host seam (Venus)

r=2 answers Saturnus's r=1 FAIL (R1-R3 required, the open choice, notes N1-N7). The lines that changed are marked [r2]. The diff against r=1 is at the end.

Purpose (defect), restated: a batch on a forge-homed repository is built, checked and landed by the tool, with no gh call and no github.com fetch. DECIDED 2026-11-22 "Martha should be able to work with any git hoster": every host call goes through the one adapter that the declared host kind picks. This design adds no second way to choose a host.

[r2] R3 Seam: pallas/46-forge-ci-seam at 5a936f42 or later. That commit expands ~/ in the token file against the launch's home and passes curl -q, so curl reads no ~/.curlrc. At r=1 time it was still unpushed in Pallas's worktree, and the forge's PR 50 head read a75c4c35. The build stacks on 5a936f42 and merges the seam branch in once if its head moves. Read at forge main d8e33b07.

DECIDED cut: the Done-when's "fails by name" check is CUT (the Supervisor's B11, relayed by Mars; Raf can overrule). §5's landing-path tests are the cover.

1. What is host-specific today, and what is not

Call File Host-specific? Change
git fetch/push/ls-remote origin land_passed_work_as_one_batch.ts:217,526,533,545,573,586, check_a_range…:183, open_and_finish_a_worktree, the_commits_a_handoff_names, signed_base No. They go to the clone's own origin. Since the workdir moved to git.macula.io (crew.json workdir, former_workdirs: ["github.com"]), each clone's origin is the forge. The issue's instance ran in the old github.com tree. None in the git calls. [r2] N3 The landing reads the push URL as well (§3).
Open PR at the passed head: gh api repos/<r>/commits/<head>/pulls find_the_work_a_verdict_passed.ts:98-102 Yes New seam method openPullRequestsAt (§2)
CI runs + jobs on the tip: gh api …/actions/runs?head_sha= and …/runs/<id>/jobs check_a_range_before_the_owner_says_yes.ts:311,331 Yes Seam runsOnTip + new jobsNamed (§2)
"GitHub marks its pull request merged" after the fast-forward land_passed_work_as_one_batch.ts header Yes: Forgejo does it only when the repo sets autodetect_manual_merge, which is off by default §4: a repo setting, not code

2. Two methods added to TheCiOfAHost (one interface, every adapter)

/** [r2 N7] The open pull requests at each of these exact heads, read once per batch: head → numbers, ascending. */
openPullRequestsAt(repo: string, heads: readonly string[]): Promise<Read<ReadonlyMap<string, readonly number[]>>>
/** Every job of a run with where it stands; a job not yet ended is listed as not ended, never left out. */
jobsNamed(repo: string, run: ARun): Promise<Read<readonly AJob[]>>   // AJob = { name, ended, conclusion }
  • github: openPullRequestsAt makes today's repos/<r>/commits/<head>/pulls call once per head, filtered to state=open && head.sha===head. jobsNamed is today's runs/<id>/jobs. [r2 N4] These are the same API paths and the same filters as today. They now go through the GitHub adapter's budget, as #46's reads do, so a GitHub landing asks GitHub the same questions; the calls are not byte-for-byte the same process, because the budget wraps them.
  • forgejo: openPullRequestsAt reads the open list once per batch ([r2 N7], not once per package): repos/<r>/pulls?state=open&limit=50&page=n. It matches each entry's head.sha exactly against the batch's full heads. commits/<sha>/pull does not fit: it finds only merged PRs, and an open PR's head answers 404 (probed on PR 50's head).
    • [r2] R1, a complete read or a why. The transport returns the x-total-count header beside body and status. It adds %header{x-total-count} to the -w it already writes, which needs curl ≥ 7.84; the transport already requires 8.3. I probed this live: the line reads 19 on page 1 at limit 50 and on page 3 at limit 7. The new answer shape is { status, body, total }, where total is '' when the header is absent.
    • Pages are read until the entries read equal total, bounded by FORGEJO_TASK_PAGES. A page's length is never the stop, so a server cap under 50 still reads every page.
    • The answer is "these numbers" or "none" only when all of these hold: every page said 200; total was present, a non-negative integer and the same on every page; every entry parsed (number, state, head.sha); and the count read equals total.
    • Anything else is a why in fixed words: no total count, the total count moved while it was read, an entry this cannot read, the open list lies past the pages read, or the transport's own why.
  • jobsNamed (forgejo) is the tasks join jobsOf already does, returned as rows instead of a count. jobsOf becomes the count of jobsNamed when every row has ended, so it keeps one reader.
  • A kind with no adapter: no adapter for <kind>, as #46 has it. That closes #31's class for the landing, because a host that cannot be parsed is no origin host, never GitHub.

3. Where the landing picks its adapter

theCiOfAHostFor(asked, repo) reads <clones>/<repo>. The landing works in the clone path it is handed (batch.path, range.path). I split the seam's entry so the same choice runs on a given path:

export async function theCiOfAHostAt(asked: TheCiAsked, clone: string, repo: string): Promise<Read<ChosenCi>>
// theCiOfAHostFor(asked, repo) = theCiOfAHostAt(asked, join(asked.clones, repo), repo)

It keeps the same fail-closed words and the same origin parser, plus three [r2] guards:

  • N2 repo is held to REPO before any join, so .. or an empty segment never reaches a path.
  • N1 An origin that names no repository is the origin names no repository, not a pass (r=1 let named === undefined through).
  • N3 The push URL (git remote get-url --push origin, which applies pushurl/pushInsteadOf) must name the same host and repository as the fetch URL. If it does not, the landing is refused before any push: origin pushes to <host>, not <host>. A forge clone with a GitHub pushInsteadOf cannot send a landing to GitHub.

verify_range and land_batch receive the same TheCiAsked the send gets (a_crews_tools.ts:919-934), built once and passed to both. [r2 N6] fast_forward_after_the_owners_yes reads no host API: it takes no adapter. It runs the same fetch/push-URL guard (N3), and its existing base-sha check stands.

[r2 N5] Before any host is asked, a VERDICT head is resolved in the clone to its full sha (git rev-parse --verify <head>^{commit}). A short sha that does not resolve, or resolves ambiguously, is refused by name, so a host's exact head.sha match never sees a short sha.

[r2] R2, a why is always UNREAD, never "none". martha#601 stands: the passed head lands, and the owner is still asked. But whenever the host or kind cannot be named, or an adapter answers a why, the menu line says so on its own line, every time:

  • CI UNREAD on <tip>: <why>, for example CI UNREAD on 1a2b3c4: no host kind is declared for git.macula.io or …: the token file is not 0600: <path>.
  • PR UNREAD for <package>: <why>.

A why never shows as "no runs", "no jobs" or "no open pull request". Those words appear only when a complete read answered them. A hosts entry that is missing or a token that is 0644 therefore puts UNREAD in front of the owner, never an empty CI that reads like a pass. Each read line also names host=<host> kind=<kind> when they are known. The one new refusal stays: a clone of a repository other than the package's is refused by name, as #46 refuses it.

4. The PR's merged mark on Forgejo

[r2] Open choice settled (a) (Saturnus backs it). A --no-ff push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has autodetect_manual_merge: true (a PATCH /repos/{o}/{r} setting; it needs repo admin). The chain menu carries one line: set autodetect_manual_merge on every crew repo on the forge, before the next landing, under DECIDED 2026-11-22 "add the rules".

[r2] The seven PRs reading merged=false, checked against forge main today (2026-11-23):

  • Landed, never marked: martha#4 (41e8aacc) and martha#51 (d8e33b07). Both are already closed. Forgejo re-checks only on a push to the base, and its API has no "mark merged", so these two stay closed-unmerged. The menu line says that as a known gap and does not promise to fix it.
  • Closed, not on main: martha#34 and #40. Not landed, so merged=false is true. Nothing to do.
  • Open, not yet landed: martha-board#2, #3 and #10 (the hand-built batch). Once the setting is on, landing them marks them merged.

The landing does not depend on the setting: it lands the passed head whatever the PR says.

5. Tests (red first), no new check

  • find_the_work…: a Forgejo origin, with stand-in curl answers copied from the live pulls pages (body + x-total-count + status), yields the PR number. Also each of these gives its why and a PR UNREAD line, never "no open PR":
    • [r2 R1] a cap of 7 (three pages, the PR on page 2) is found;
    • two open PRs at the head give "more than one";
    • a missing total, a total that changes between pages, an unparsable entry, and a list past the page bound.
    • gh is absent and never called.
  • check_a_range…: a Forgejo origin, with runs + tasks copied from live answers; a job not ended is named; [r2 R2] a missing hosts entry and a 0644 token each give CI UNREAD … <why>; no gh call.
  • seam: theCiOfAHostAt on a path; [r2] the N1/N2/N3 guards; jobsNamed on both adapters; jobsOf = count of jobsNamed; [r2 N5] short sha resolved, ambiguous short sha refused.
  • A GitHub origin asks the same paths as today. Existing landing tests stay green with only the budget wrapper as the difference.

6. Not in this package

  • keep_the_owners_todo_list.ts:300-301 (pr_merged/tag_exists via gh): it is not among #8's named tools, and it is on #16's list.
  • crew_worktree_finish's open-PR check reading GitHub is macula-sponsors#29 (crew mod). It can use openPullRequestsAt once this lands; a note goes on #29, and nothing is built here.
  • #32 (forge page cap assumed to be 50): openPullRequestsAt no longer assumes it (R1). #32's other readers are not touched here.

Refs #46, #8, #31, #32, macula-io/macula-sponsors#29.

Diff r=1 → r=2 (for the diff-only read)
--- martha8-design-r1.md	2026-11-22 23:55:01.053248876 +0100
+++ martha8-design-r2.md	2026-11-23 00:00:51.483306116 +0100
@@ -1,29 +1,38 @@
-## Design r=1: landing and batching on the #46 host seam (Venus)
+## Design r=2: landing and batching on the #46 host seam (Venus)
+
+r=2 answers Saturnus's r=1 FAIL (R1-R3 required, the open choice, notes N1-N7). The lines that changed are marked **[r2]**. The diff against r=1 is at the end.
 
 Purpose (defect), restated: a batch on a forge-homed repository is built, checked and landed by the tool, with no `gh` call and no github.com fetch. DECIDED 2026-11-22 "Martha should be able to work with any git hoster": every host call goes through the one adapter that the declared host kind picks. This design adds no second way to choose a host.
 
-Seam: PR 50 (`pallas/46-forge-ci-seam` at `a75c4c35`, stacked on PR 40), not yet landed. The build stacks on PR 50 and merges it in once if its head moves. Read at forge main `d8e33b07`.
+**[r2] R3** Seam: `pallas/46-forge-ci-seam` at **`5a936f42`** or later. That commit expands `~/` in the token file against the launch's home and passes curl `-q`, so curl reads no `~/.curlrc`. At r=1 time it was still unpushed in Pallas's worktree, and the forge's PR 50 head read `a75c4c35`. The build stacks on `5a936f42` and merges the seam branch in once if its head moves. Read at forge main `d8e33b07`.
+
+DECIDED cut: the Done-when's "fails by name" check is CUT (the Supervisor's B11, relayed by Mars; Raf can overrule). §5's landing-path tests are the cover.
 
 ### 1. What is host-specific today, and what is not
 
 | Call | File | Host-specific? | Change |
 |---|---|---|---|
-| `git fetch/push/ls-remote origin` | `land_passed_work_as_one_batch.ts:217,526,533,545,573,586`, `check_a_range…:183`, `open_and_finish_a_worktree`, `the_commits_a_handoff_names`, `signed_base` | **No.** They go to the clone's own `origin`. Since the workdir moved to `git.macula.io` (crew.json `workdir`, `former_workdirs: ["github.com"]`), each clone's origin is the forge. The issue's instance ran in the old github.com tree. | None in code. The landing names the host it reads (§3), so a clone whose origin is still github.com is visible, never silent. |
+| `git fetch/push/ls-remote origin` | `land_passed_work_as_one_batch.ts:217,526,533,545,573,586`, `check_a_range…:183`, `open_and_finish_a_worktree`, `the_commits_a_handoff_names`, `signed_base` | **No.** They go to the clone's own `origin`. Since the workdir moved to `git.macula.io` (crew.json `workdir`, `former_workdirs: ["github.com"]`), each clone's origin is the forge. The issue's instance ran in the old github.com tree. | None in the git calls. **[r2] N3** The landing reads the push URL as well (§3). |
 | Open PR at the passed head: `gh api repos/<r>/commits/<head>/pulls` | `find_the_work_a_verdict_passed.ts:98-102` | **Yes** | New seam method `openPullRequestsAt` (§2) |
 | CI runs + jobs on the tip: `gh api …/actions/runs?head_sha=` and `…/runs/<id>/jobs` | `check_a_range_before_the_owner_says_yes.ts:311,331` | **Yes** | Seam `runsOnTip` + new `jobsNamed` (§2) |
-| "GitHub marks its pull request merged" after the fast-forward | `land_passed_work_as_one_batch.ts` header | **Yes**: Forgejo does it only when the repo sets `autodetect_manual_merge`, which is off by default. martha-board PRs 2/3/10 and martha PRs 4/34/40/51 read `merged=false`. | §4: a repo setting, not code |
+| "GitHub marks its pull request merged" after the fast-forward | `land_passed_work_as_one_batch.ts` header | **Yes**: Forgejo does it only when the repo sets `autodetect_manual_merge`, which is off by default | §4: a repo setting, not code |
 
 ### 2. Two methods added to `TheCiOfAHost` (one interface, every adapter)
 
 ```ts
-/** The open pull requests whose head is exactly this sha in this repository; their numbers, ascending. */
-openPullRequestsAt(repo: string, head: string): Promise<Read<readonly number[]>>
+/** [r2 N7] The open pull requests at each of these exact heads, read once per batch: head → numbers, ascending. */
+openPullRequestsAt(repo: string, heads: readonly string[]): Promise<Read<ReadonlyMap<string, readonly number[]>>>
 /** Every job of a run with where it stands; a job not yet ended is listed as not ended, never left out. */
 jobsNamed(repo: string, run: ARun): Promise<Read<readonly AJob[]>>   // AJob = { name, ended, conclusion }

-- github: openPullRequestsAt is today's repos/<r>/commits/<head>/pulls, filtered to state=open && head.sha===head. jobsNamed is today's runs/<id>/jobs. Both go through the GitHub adapter's own budget, as #46's reads do. A GitHub landing reads exactly what it reads today.
-- forgejo: openPullRequestsAt is repos/<r>/pulls?state=open&limit=50&page=n, matching head.sha exactly, with pages bounded as FORGEJO_TASK_PAGES bounds tasks. A page past the bound is a why, never "none". I probed it live: 19 open on martha, head.sha present, x-total-count sent. commits/<sha>/pull does not fit: it finds only merged PRs, and an open PR's head answers 404 (probed on PR 50's head). jobsNamed is the tasks join jobsOf already does, returned as rows instead of a count. jobsOf becomes the count of jobsNamed when every row has ended, so it keeps one reader.
+- github: openPullRequestsAt makes today's repos/<r>/commits/<head>/pulls call once per head, filtered to state=open && head.sha===head. jobsNamed is today's runs/<id>/jobs. [r2 N4] These are the same API paths and the same filters as today. They now go through the GitHub adapter's budget, as #46's reads do, so a GitHub landing asks GitHub the same questions; the calls are not byte-for-byte the same process, because the budget wraps them.
+- forgejo: openPullRequestsAt reads the open list once per batch ([r2 N7], not once per package): repos/<r>/pulls?state=open&limit=50&page=n. It matches each entry's head.sha exactly against the batch's full heads. commits/<sha>/pull does not fit: it finds only merged PRs, and an open PR's head answers 404 (probed on PR 50's head).

    • [r2] R1, a complete read or a why. The transport returns the x-total-count header beside body and status. It adds %header{x-total-count} to the -w it already writes, which needs curl ≥ 7.84; the transport already requires 8.3. I probed this live: the line reads 19 on page 1 at limit 50 and on page 3 at limit 7. The new answer shape is { status, body, total }, where total is '' when the header is absent.
    • Pages are read until the entries read equal total, bounded by FORGEJO_TASK_PAGES. A page's length is never the stop, so a server cap under 50 still reads every page.
    • The answer is "these numbers" or "none" only when all of these hold: every page said 200; total was present, a non-negative integer and the same on every page; every entry parsed (number, state, head.sha); and the count read equals total.
    • Anything else is a why in fixed words: no total count, the total count moved while it was read, an entry this cannot read, the open list lies past the pages read, or the transport's own why.
      +- jobsNamed (forgejo) is the tasks join jobsOf already does, returned as rows instead of a count. jobsOf becomes the count of jobsNamed when every row has ended, so it keeps one reader.
  • A kind with no adapter: no adapter for <kind>, as #46 has it. That closes #31's class for the landing, because a host that cannot be parsed is no origin host, never GitHub.

3. Where the landing picks its adapter

@@ -35,31 +44,47 @@
// theCiOfAHostFor(asked, repo) = theCiOfAHostAt(asked, join(asked.clones, repo), repo)


-Same fail-closed words, same origin parser. `verify_range`, `land_batch` and `fast_forward_after_the_owners_yes` receive the same `TheCiAsked` the send gets (`a_crews_tools.ts:919-934`), built once and passed to both. Each answer's menu line names `host=<host> kind=<kind>`, so the owner sees which host was read.
+It keeps the same fail-closed words and the same origin parser, plus three **[r2]** guards:
+- **N2** `repo` is held to `REPO` before any `join`, so `..` or an empty segment never reaches a path.
+- **N1** An origin that names no repository is `the origin names no repository`, not a pass (r=1 let `named === undefined` through).
+- **N3** The push URL (`git remote get-url --push origin`, which applies `pushurl`/`pushInsteadOf`) must name the same host and repository as the fetch URL. If it does not, the landing is refused before any push: `origin pushes to <host>, not <host>`. A forge clone with a GitHub `pushInsteadOf` cannot send a landing to GitHub.
+
+`verify_range` and `land_batch` receive the same `TheCiAsked` the send gets (`a_crews_tools.ts:919-934`), built once and passed to both. **[r2 N6]** `fast_forward_after_the_owners_yes` reads no host API: it takes no adapter. It runs the same fetch/push-URL guard (N3), and its existing base-sha check stands.
+
+**[r2 N5]** Before any host is asked, a VERDICT head is resolved in the clone to its full sha (`git rev-parse --verify <head>^{commit}`). A short sha that does not resolve, or resolves ambiguously, is refused by name, so a host's exact `head.sha` match never sees a short sha.

-**Failure behaviour does not change (martha#601):** a host the seam cannot choose, or an adapter `why`, is one notice line, and the passed head still lands. That is today's "gh could not answer". The one new refusal: a clone whose origin repository is not the package's repository is refused by name, as #46 refuses it.
+**[r2] R2, a `why` is always UNREAD, never "none".** martha#601 stands: the passed head lands, and the owner is still asked. But whenever the host or kind cannot be named, or an adapter answers a `why`, the menu line says so on its own line, every time:
+- `CI UNREAD on <tip>: <why>`, for example `CI UNREAD on 1a2b3c4: no host kind is declared for git.macula.io` or `…: the token file is not 0600: <path>`.
+- `PR UNREAD for <package>: <why>`.
+
+A `why` never shows as "no runs", "no jobs" or "no open pull request". Those words appear only when a complete read answered them. A hosts entry that is missing or a token that is 0644 therefore puts **UNREAD** in front of the owner, never an empty CI that reads like a pass. Each read line also names `host=<host> kind=<kind>` when they are known. The one new refusal stays: a clone of a repository other than the package's is refused by name, as #46 refuses it.

### 4. The PR's merged mark on Forgejo

-A `--no-ff` push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has `autodetect_manual_merge: true` (a `PATCH /repos/{o}/{r}` setting; it needs repo admin). Two options:
-- **(a, recommended)** A forge admin sets `autodetect_manual_merge` on each crew repo. This is a forge setting and needs no code. It sits in the chain menu as one line per repo, under DECIDED 2026-11-22 "add the rules" (the crew administers the forge).
-- (b) The adapter closes the PR by API after the fast-forward. That is a write with a member token: more code, a second outward act per package, and a token that needs write scope.
+**[r2] Open choice settled (a)** (Saturnus backs it). A `--no-ff` push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has `autodetect_manual_merge: true` (a `PATCH /repos/{o}/{r}` setting; it needs repo admin). The chain menu carries one line: *set `autodetect_manual_merge` on every crew repo on the forge, before the next landing*, under DECIDED 2026-11-22 "add the rules".

-The landing does not depend on either: it lands the passed head whatever the PR says. Option (a) only keeps the forge's PR list true.
+**[r2]** The seven PRs reading `merged=false`, checked against forge `main` today (2026-11-23):
+- **Landed, never marked:** martha#4 (`41e8aacc`) and martha#51 (`d8e33b07`). Both are already *closed*. Forgejo re-checks only on a push to the base, and its API has no "mark merged", so these two stay closed-unmerged. The menu line says that as a known gap and does not promise to fix it.
+- **Closed, not on main:** martha#34 and #40. Not landed, so `merged=false` is true. Nothing to do.
+- **Open, not yet landed:** martha-board#2, #3 and #10 (the hand-built batch). Once the setting is on, landing them marks them merged.

-### 5. Tests (red first), no new check
+The landing does not depend on the setting: it lands the passed head whatever the PR says.

-- `find_the_work…`: a Forgejo origin, with a stand-in curl answering a pulls page *copied from the live answer* (per the stand-in rule), yields the PR number. Also: two open PRs give the "more than one" notice; a page past the bound gives a notice; `gh` absent from PATH and never called.
-- `check_a_range…`: a Forgejo origin; runs + tasks copied from live answers; a job not ended is named; no `gh` call.
-- seam: `theCiOfAHostAt` on a path; `jobsNamed` on both adapters; `jobsOf` = count of `jobsNamed`.
-- A GitHub origin reads byte-for-byte as today (existing landing tests stay green unchanged).
+### 5. Tests (red first), no new check

-The Done-when's second bullet, *a check that fails by name when any of these tools calls gh or fetches github.com on a forge clone*, is a **new check**, so it needs Raf's yes (DECIDED 2026-11-19 "No new checks without your yes (Recommended)"). The tests above are ordinary suite cases, not that check. I ask for it as its own menu line and do not build it without the yes.
+- `find_the_work…`: a Forgejo origin, with stand-in curl answers copied from the live pulls pages (body + `x-total-count` + status), yields the PR number. Also each of these gives its `why` and a `PR UNREAD` line, never "no open PR":
+  - **[r2 R1]** a cap of 7 (three pages, the PR on page 2) is found;
+  - two open PRs at the head give "more than one";
+  - a missing `total`, a `total` that changes between pages, an unparsable entry, and a list past the page bound.
+  - `gh` is absent and never called.
+- `check_a_range…`: a Forgejo origin, with runs + tasks copied from live answers; a job not ended is named; **[r2 R2]** a missing hosts entry and a 0644 token each give `CI UNREAD … <why>`; no `gh` call.
+- seam: `theCiOfAHostAt` on a path; **[r2]** the N1/N2/N3 guards; `jobsNamed` on both adapters; `jobsOf` = count of `jobsNamed`; **[r2 N5]** short sha resolved, ambiguous short sha refused.
+- A GitHub origin asks the same paths as today. Existing landing tests stay green with only the budget wrapper as the difference.

### 6. Not in this package

- `keep_the_owners_todo_list.ts:300-301` (`pr_merged`/`tag_exists` via `gh`): it is not among #8's named tools, and it is on #16's list.
- `crew_worktree_finish`'s open-PR check reading GitHub is macula-sponsors#29 (crew mod). It can use `openPullRequestsAt` once this lands; a note goes on #29, and nothing is built here.
-- #32 (forge page cap assumed to be 50): `openPullRequestsAt` reads `x-total-count` and refuses a short read. It does not settle #32's other readers.
+- #32 (forge page cap assumed to be 50): `openPullRequestsAt` no longer assumes it (R1). #32's other readers are not touched here.

Refs #46, #8, #31, #32, macula-io/macula-sponsors#29.
## Design r=2: landing and batching on the #46 host seam (Venus) r=2 answers Saturnus's r=1 FAIL (R1-R3 required, the open choice, notes N1-N7). The lines that changed are marked **[r2]**. The diff against r=1 is at the end. Purpose (defect), restated: a batch on a forge-homed repository is built, checked and landed by the tool, with no `gh` call and no github.com fetch. DECIDED 2026-11-22 "Martha should be able to work with any git hoster": every host call goes through the one adapter that the declared host kind picks. This design adds no second way to choose a host. **[r2] R3** Seam: `pallas/46-forge-ci-seam` at **`5a936f42`** or later. That commit expands `~/` in the token file against the launch's home and passes curl `-q`, so curl reads no `~/.curlrc`. At r=1 time it was still unpushed in Pallas's worktree, and the forge's PR 50 head read `a75c4c35`. The build stacks on `5a936f42` and merges the seam branch in once if its head moves. Read at forge main `d8e33b07`. DECIDED cut: the Done-when's "fails by name" check is CUT (the Supervisor's B11, relayed by Mars; Raf can overrule). §5's landing-path tests are the cover. ### 1. What is host-specific today, and what is not | Call | File | Host-specific? | Change | |---|---|---|---| | `git fetch/push/ls-remote origin` | `land_passed_work_as_one_batch.ts:217,526,533,545,573,586`, `check_a_range…:183`, `open_and_finish_a_worktree`, `the_commits_a_handoff_names`, `signed_base` | **No.** They go to the clone's own `origin`. Since the workdir moved to `git.macula.io` (crew.json `workdir`, `former_workdirs: ["github.com"]`), each clone's origin is the forge. The issue's instance ran in the old github.com tree. | None in the git calls. **[r2] N3** The landing reads the push URL as well (§3). | | Open PR at the passed head: `gh api repos/<r>/commits/<head>/pulls` | `find_the_work_a_verdict_passed.ts:98-102` | **Yes** | New seam method `openPullRequestsAt` (§2) | | CI runs + jobs on the tip: `gh api …/actions/runs?head_sha=` and `…/runs/<id>/jobs` | `check_a_range_before_the_owner_says_yes.ts:311,331` | **Yes** | Seam `runsOnTip` + new `jobsNamed` (§2) | | "GitHub marks its pull request merged" after the fast-forward | `land_passed_work_as_one_batch.ts` header | **Yes**: Forgejo does it only when the repo sets `autodetect_manual_merge`, which is off by default | §4: a repo setting, not code | ### 2. Two methods added to `TheCiOfAHost` (one interface, every adapter) ```ts /** [r2 N7] The open pull requests at each of these exact heads, read once per batch: head → numbers, ascending. */ openPullRequestsAt(repo: string, heads: readonly string[]): Promise<Read<ReadonlyMap<string, readonly number[]>>> /** Every job of a run with where it stands; a job not yet ended is listed as not ended, never left out. */ jobsNamed(repo: string, run: ARun): Promise<Read<readonly AJob[]>> // AJob = { name, ended, conclusion } ``` - **github**: `openPullRequestsAt` makes today's `repos/<r>/commits/<head>/pulls` call once per head, filtered to `state=open && head.sha===head`. `jobsNamed` is today's `runs/<id>/jobs`. **[r2 N4]** These are the same API paths and the same filters as today. They now go through the GitHub adapter's budget, as #46's reads do, so a GitHub landing asks GitHub the same questions; the calls are not byte-for-byte the same process, because the budget wraps them. - **forgejo**: `openPullRequestsAt` reads the open list **once per batch** (**[r2 N7]**, not once per package): `repos/<r>/pulls?state=open&limit=50&page=n`. It matches each entry's `head.sha` exactly against the batch's full heads. `commits/<sha>/pull` does not fit: it finds only *merged* PRs, and an open PR's head answers 404 (probed on PR 50's head). - **[r2] R1, a complete read or a `why`.** The transport returns the `x-total-count` header beside body and status. It adds `%header{x-total-count}` to the `-w` it already writes, which needs curl ≥ 7.84; the transport already requires 8.3. I probed this live: the line reads `19` on page 1 at limit 50 and on page 3 at limit 7. The new answer shape is `{ status, body, total }`, where `total` is `''` when the header is absent. - Pages are read until **the entries read equal `total`**, bounded by `FORGEJO_TASK_PAGES`. A page's length is never the stop, so a server cap under 50 still reads every page. - The answer is "these numbers" or "none" only when all of these hold: every page said 200; `total` was present, a non-negative integer and **the same on every page**; **every entry parsed** (number, state, `head.sha`); and the count read equals `total`. - Anything else is a `why` in fixed words: `no total count`, `the total count moved while it was read`, `an entry this cannot read`, `the open list lies past the pages read`, or the transport's own why. - `jobsNamed` (forgejo) is the tasks join `jobsOf` already does, returned as rows instead of a count. `jobsOf` becomes the count of `jobsNamed` when every row has ended, so it keeps one reader. - A kind with no adapter: `no adapter for <kind>`, as #46 has it. That closes #31's class for the landing, because a host that cannot be parsed is `no origin host`, never GitHub. ### 3. Where the landing picks its adapter `theCiOfAHostFor(asked, repo)` reads `<clones>/<repo>`. The landing works in the clone path it is handed (`batch.path`, `range.path`). I split the seam's entry so the same choice runs on a given path: ```ts export async function theCiOfAHostAt(asked: TheCiAsked, clone: string, repo: string): Promise<Read<ChosenCi>> // theCiOfAHostFor(asked, repo) = theCiOfAHostAt(asked, join(asked.clones, repo), repo) ``` It keeps the same fail-closed words and the same origin parser, plus three **[r2]** guards: - **N2** `repo` is held to `REPO` before any `join`, so `..` or an empty segment never reaches a path. - **N1** An origin that names no repository is `the origin names no repository`, not a pass (r=1 let `named === undefined` through). - **N3** The push URL (`git remote get-url --push origin`, which applies `pushurl`/`pushInsteadOf`) must name the same host and repository as the fetch URL. If it does not, the landing is refused before any push: `origin pushes to <host>, not <host>`. A forge clone with a GitHub `pushInsteadOf` cannot send a landing to GitHub. `verify_range` and `land_batch` receive the same `TheCiAsked` the send gets (`a_crews_tools.ts:919-934`), built once and passed to both. **[r2 N6]** `fast_forward_after_the_owners_yes` reads no host API: it takes no adapter. It runs the same fetch/push-URL guard (N3), and its existing base-sha check stands. **[r2 N5]** Before any host is asked, a VERDICT head is resolved in the clone to its full sha (`git rev-parse --verify <head>^{commit}`). A short sha that does not resolve, or resolves ambiguously, is refused by name, so a host's exact `head.sha` match never sees a short sha. **[r2] R2, a `why` is always UNREAD, never "none".** martha#601 stands: the passed head lands, and the owner is still asked. But whenever the host or kind cannot be named, or an adapter answers a `why`, the menu line says so on its own line, every time: - `CI UNREAD on <tip>: <why>`, for example `CI UNREAD on 1a2b3c4: no host kind is declared for git.macula.io` or `…: the token file is not 0600: <path>`. - `PR UNREAD for <package>: <why>`. A `why` never shows as "no runs", "no jobs" or "no open pull request". Those words appear only when a complete read answered them. A hosts entry that is missing or a token that is 0644 therefore puts **UNREAD** in front of the owner, never an empty CI that reads like a pass. Each read line also names `host=<host> kind=<kind>` when they are known. The one new refusal stays: a clone of a repository other than the package's is refused by name, as #46 refuses it. ### 4. The PR's merged mark on Forgejo **[r2] Open choice settled (a)** (Saturnus backs it). A `--no-ff` push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has `autodetect_manual_merge: true` (a `PATCH /repos/{o}/{r}` setting; it needs repo admin). The chain menu carries one line: *set `autodetect_manual_merge` on every crew repo on the forge, before the next landing*, under DECIDED 2026-11-22 "add the rules". **[r2]** The seven PRs reading `merged=false`, checked against forge `main` today (2026-11-23): - **Landed, never marked:** martha#4 (`41e8aacc`) and martha#51 (`d8e33b07`). Both are already *closed*. Forgejo re-checks only on a push to the base, and its API has no "mark merged", so these two stay closed-unmerged. The menu line says that as a known gap and does not promise to fix it. - **Closed, not on main:** martha#34 and #40. Not landed, so `merged=false` is true. Nothing to do. - **Open, not yet landed:** martha-board#2, #3 and #10 (the hand-built batch). Once the setting is on, landing them marks them merged. The landing does not depend on the setting: it lands the passed head whatever the PR says. ### 5. Tests (red first), no new check - `find_the_work…`: a Forgejo origin, with stand-in curl answers copied from the live pulls pages (body + `x-total-count` + status), yields the PR number. Also each of these gives its `why` and a `PR UNREAD` line, never "no open PR": - **[r2 R1]** a cap of 7 (three pages, the PR on page 2) is found; - two open PRs at the head give "more than one"; - a missing `total`, a `total` that changes between pages, an unparsable entry, and a list past the page bound. - `gh` is absent and never called. - `check_a_range…`: a Forgejo origin, with runs + tasks copied from live answers; a job not ended is named; **[r2 R2]** a missing hosts entry and a 0644 token each give `CI UNREAD … <why>`; no `gh` call. - seam: `theCiOfAHostAt` on a path; **[r2]** the N1/N2/N3 guards; `jobsNamed` on both adapters; `jobsOf` = count of `jobsNamed`; **[r2 N5]** short sha resolved, ambiguous short sha refused. - A GitHub origin asks the same paths as today. Existing landing tests stay green with only the budget wrapper as the difference. ### 6. Not in this package - `keep_the_owners_todo_list.ts:300-301` (`pr_merged`/`tag_exists` via `gh`): it is not among #8's named tools, and it is on #16's list. - `crew_worktree_finish`'s open-PR check reading GitHub is macula-sponsors#29 (crew mod). It can use `openPullRequestsAt` once this lands; a note goes on #29, and nothing is built here. - #32 (forge page cap assumed to be 50): `openPullRequestsAt` no longer assumes it (R1). #32's other readers are not touched here. Refs #46, #8, #31, #32, macula-io/macula-sponsors#29. <details><summary>Diff r=1 → r=2 (for the diff-only read)</summary> ```diff --- martha8-design-r1.md 2026-11-22 23:55:01.053248876 +0100 +++ martha8-design-r2.md 2026-11-23 00:00:51.483306116 +0100 @@ -1,29 +1,38 @@ -## Design r=1: landing and batching on the #46 host seam (Venus) +## Design r=2: landing and batching on the #46 host seam (Venus) + +r=2 answers Saturnus's r=1 FAIL (R1-R3 required, the open choice, notes N1-N7). The lines that changed are marked **[r2]**. The diff against r=1 is at the end. Purpose (defect), restated: a batch on a forge-homed repository is built, checked and landed by the tool, with no `gh` call and no github.com fetch. DECIDED 2026-11-22 "Martha should be able to work with any git hoster": every host call goes through the one adapter that the declared host kind picks. This design adds no second way to choose a host. -Seam: PR 50 (`pallas/46-forge-ci-seam` at `a75c4c35`, stacked on PR 40), not yet landed. The build stacks on PR 50 and merges it in once if its head moves. Read at forge main `d8e33b07`. +**[r2] R3** Seam: `pallas/46-forge-ci-seam` at **`5a936f42`** or later. That commit expands `~/` in the token file against the launch's home and passes curl `-q`, so curl reads no `~/.curlrc`. At r=1 time it was still unpushed in Pallas's worktree, and the forge's PR 50 head read `a75c4c35`. The build stacks on `5a936f42` and merges the seam branch in once if its head moves. Read at forge main `d8e33b07`. + +DECIDED cut: the Done-when's "fails by name" check is CUT (the Supervisor's B11, relayed by Mars; Raf can overrule). §5's landing-path tests are the cover. ### 1. What is host-specific today, and what is not | Call | File | Host-specific? | Change | |---|---|---|---| -| `git fetch/push/ls-remote origin` | `land_passed_work_as_one_batch.ts:217,526,533,545,573,586`, `check_a_range…:183`, `open_and_finish_a_worktree`, `the_commits_a_handoff_names`, `signed_base` | **No.** They go to the clone's own `origin`. Since the workdir moved to `git.macula.io` (crew.json `workdir`, `former_workdirs: ["github.com"]`), each clone's origin is the forge. The issue's instance ran in the old github.com tree. | None in code. The landing names the host it reads (§3), so a clone whose origin is still github.com is visible, never silent. | +| `git fetch/push/ls-remote origin` | `land_passed_work_as_one_batch.ts:217,526,533,545,573,586`, `check_a_range…:183`, `open_and_finish_a_worktree`, `the_commits_a_handoff_names`, `signed_base` | **No.** They go to the clone's own `origin`. Since the workdir moved to `git.macula.io` (crew.json `workdir`, `former_workdirs: ["github.com"]`), each clone's origin is the forge. The issue's instance ran in the old github.com tree. | None in the git calls. **[r2] N3** The landing reads the push URL as well (§3). | | Open PR at the passed head: `gh api repos/<r>/commits/<head>/pulls` | `find_the_work_a_verdict_passed.ts:98-102` | **Yes** | New seam method `openPullRequestsAt` (§2) | | CI runs + jobs on the tip: `gh api …/actions/runs?head_sha=` and `…/runs/<id>/jobs` | `check_a_range_before_the_owner_says_yes.ts:311,331` | **Yes** | Seam `runsOnTip` + new `jobsNamed` (§2) | -| "GitHub marks its pull request merged" after the fast-forward | `land_passed_work_as_one_batch.ts` header | **Yes**: Forgejo does it only when the repo sets `autodetect_manual_merge`, which is off by default. martha-board PRs 2/3/10 and martha PRs 4/34/40/51 read `merged=false`. | §4: a repo setting, not code | +| "GitHub marks its pull request merged" after the fast-forward | `land_passed_work_as_one_batch.ts` header | **Yes**: Forgejo does it only when the repo sets `autodetect_manual_merge`, which is off by default | §4: a repo setting, not code | ### 2. Two methods added to `TheCiOfAHost` (one interface, every adapter) ```ts -/** The open pull requests whose head is exactly this sha in this repository; their numbers, ascending. */ -openPullRequestsAt(repo: string, head: string): Promise<Read<readonly number[]>> +/** [r2 N7] The open pull requests at each of these exact heads, read once per batch: head → numbers, ascending. */ +openPullRequestsAt(repo: string, heads: readonly string[]): Promise<Read<ReadonlyMap<string, readonly number[]>>> /** Every job of a run with where it stands; a job not yet ended is listed as not ended, never left out. */ jobsNamed(repo: string, run: ARun): Promise<Read<readonly AJob[]>> // AJob = { name, ended, conclusion } ``` -- **github**: `openPullRequestsAt` is today's `repos/<r>/commits/<head>/pulls`, filtered to `state=open && head.sha===head`. `jobsNamed` is today's `runs/<id>/jobs`. Both go through the GitHub adapter's own budget, as #46's reads do. A GitHub landing reads exactly what it reads today. -- **forgejo**: `openPullRequestsAt` is `repos/<r>/pulls?state=open&limit=50&page=n`, matching `head.sha` exactly, with pages bounded as `FORGEJO_TASK_PAGES` bounds tasks. A page past the bound is a `why`, never "none". I probed it live: 19 open on martha, `head.sha` present, `x-total-count` sent. `commits/<sha>/pull` does not fit: it finds only *merged* PRs, and an open PR's head answers 404 (probed on PR 50's head). `jobsNamed` is the tasks join `jobsOf` already does, returned as rows instead of a count. `jobsOf` becomes the count of `jobsNamed` when every row has ended, so it keeps one reader. +- **github**: `openPullRequestsAt` makes today's `repos/<r>/commits/<head>/pulls` call once per head, filtered to `state=open && head.sha===head`. `jobsNamed` is today's `runs/<id>/jobs`. **[r2 N4]** These are the same API paths and the same filters as today. They now go through the GitHub adapter's budget, as #46's reads do, so a GitHub landing asks GitHub the same questions; the calls are not byte-for-byte the same process, because the budget wraps them. +- **forgejo**: `openPullRequestsAt` reads the open list **once per batch** (**[r2 N7]**, not once per package): `repos/<r>/pulls?state=open&limit=50&page=n`. It matches each entry's `head.sha` exactly against the batch's full heads. `commits/<sha>/pull` does not fit: it finds only *merged* PRs, and an open PR's head answers 404 (probed on PR 50's head). + - **[r2] R1, a complete read or a `why`.** The transport returns the `x-total-count` header beside body and status. It adds `%header{x-total-count}` to the `-w` it already writes, which needs curl ≥ 7.84; the transport already requires 8.3. I probed this live: the line reads `19` on page 1 at limit 50 and on page 3 at limit 7. The new answer shape is `{ status, body, total }`, where `total` is `''` when the header is absent. + - Pages are read until **the entries read equal `total`**, bounded by `FORGEJO_TASK_PAGES`. A page's length is never the stop, so a server cap under 50 still reads every page. + - The answer is "these numbers" or "none" only when all of these hold: every page said 200; `total` was present, a non-negative integer and **the same on every page**; **every entry parsed** (number, state, `head.sha`); and the count read equals `total`. + - Anything else is a `why` in fixed words: `no total count`, `the total count moved while it was read`, `an entry this cannot read`, `the open list lies past the pages read`, or the transport's own why. +- `jobsNamed` (forgejo) is the tasks join `jobsOf` already does, returned as rows instead of a count. `jobsOf` becomes the count of `jobsNamed` when every row has ended, so it keeps one reader. - A kind with no adapter: `no adapter for <kind>`, as #46 has it. That closes #31's class for the landing, because a host that cannot be parsed is `no origin host`, never GitHub. ### 3. Where the landing picks its adapter @@ -35,31 +44,47 @@ // theCiOfAHostFor(asked, repo) = theCiOfAHostAt(asked, join(asked.clones, repo), repo) ``` -Same fail-closed words, same origin parser. `verify_range`, `land_batch` and `fast_forward_after_the_owners_yes` receive the same `TheCiAsked` the send gets (`a_crews_tools.ts:919-934`), built once and passed to both. Each answer's menu line names `host=<host> kind=<kind>`, so the owner sees which host was read. +It keeps the same fail-closed words and the same origin parser, plus three **[r2]** guards: +- **N2** `repo` is held to `REPO` before any `join`, so `..` or an empty segment never reaches a path. +- **N1** An origin that names no repository is `the origin names no repository`, not a pass (r=1 let `named === undefined` through). +- **N3** The push URL (`git remote get-url --push origin`, which applies `pushurl`/`pushInsteadOf`) must name the same host and repository as the fetch URL. If it does not, the landing is refused before any push: `origin pushes to <host>, not <host>`. A forge clone with a GitHub `pushInsteadOf` cannot send a landing to GitHub. + +`verify_range` and `land_batch` receive the same `TheCiAsked` the send gets (`a_crews_tools.ts:919-934`), built once and passed to both. **[r2 N6]** `fast_forward_after_the_owners_yes` reads no host API: it takes no adapter. It runs the same fetch/push-URL guard (N3), and its existing base-sha check stands. + +**[r2 N5]** Before any host is asked, a VERDICT head is resolved in the clone to its full sha (`git rev-parse --verify <head>^{commit}`). A short sha that does not resolve, or resolves ambiguously, is refused by name, so a host's exact `head.sha` match never sees a short sha. -**Failure behaviour does not change (martha#601):** a host the seam cannot choose, or an adapter `why`, is one notice line, and the passed head still lands. That is today's "gh could not answer". The one new refusal: a clone whose origin repository is not the package's repository is refused by name, as #46 refuses it. +**[r2] R2, a `why` is always UNREAD, never "none".** martha#601 stands: the passed head lands, and the owner is still asked. But whenever the host or kind cannot be named, or an adapter answers a `why`, the menu line says so on its own line, every time: +- `CI UNREAD on <tip>: <why>`, for example `CI UNREAD on 1a2b3c4: no host kind is declared for git.macula.io` or `…: the token file is not 0600: <path>`. +- `PR UNREAD for <package>: <why>`. + +A `why` never shows as "no runs", "no jobs" or "no open pull request". Those words appear only when a complete read answered them. A hosts entry that is missing or a token that is 0644 therefore puts **UNREAD** in front of the owner, never an empty CI that reads like a pass. Each read line also names `host=<host> kind=<kind>` when they are known. The one new refusal stays: a clone of a repository other than the package's is refused by name, as #46 refuses it. ### 4. The PR's merged mark on Forgejo -A `--no-ff` push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has `autodetect_manual_merge: true` (a `PATCH /repos/{o}/{r}` setting; it needs repo admin). Two options: -- **(a, recommended)** A forge admin sets `autodetect_manual_merge` on each crew repo. This is a forge setting and needs no code. It sits in the chain menu as one line per repo, under DECIDED 2026-11-22 "add the rules" (the crew administers the forge). -- (b) The adapter closes the PR by API after the fast-forward. That is a write with a member token: more code, a second outward act per package, and a token that needs write scope. +**[r2] Open choice settled (a)** (Saturnus backs it). A `--no-ff` push of the passed head marks a GitHub PR merged. On Forgejo it does so only when the repository has `autodetect_manual_merge: true` (a `PATCH /repos/{o}/{r}` setting; it needs repo admin). The chain menu carries one line: *set `autodetect_manual_merge` on every crew repo on the forge, before the next landing*, under DECIDED 2026-11-22 "add the rules". -The landing does not depend on either: it lands the passed head whatever the PR says. Option (a) only keeps the forge's PR list true. +**[r2]** The seven PRs reading `merged=false`, checked against forge `main` today (2026-11-23): +- **Landed, never marked:** martha#4 (`41e8aacc`) and martha#51 (`d8e33b07`). Both are already *closed*. Forgejo re-checks only on a push to the base, and its API has no "mark merged", so these two stay closed-unmerged. The menu line says that as a known gap and does not promise to fix it. +- **Closed, not on main:** martha#34 and #40. Not landed, so `merged=false` is true. Nothing to do. +- **Open, not yet landed:** martha-board#2, #3 and #10 (the hand-built batch). Once the setting is on, landing them marks them merged. -### 5. Tests (red first), no new check +The landing does not depend on the setting: it lands the passed head whatever the PR says. -- `find_the_work…`: a Forgejo origin, with a stand-in curl answering a pulls page *copied from the live answer* (per the stand-in rule), yields the PR number. Also: two open PRs give the "more than one" notice; a page past the bound gives a notice; `gh` absent from PATH and never called. -- `check_a_range…`: a Forgejo origin; runs + tasks copied from live answers; a job not ended is named; no `gh` call. -- seam: `theCiOfAHostAt` on a path; `jobsNamed` on both adapters; `jobsOf` = count of `jobsNamed`. -- A GitHub origin reads byte-for-byte as today (existing landing tests stay green unchanged). +### 5. Tests (red first), no new check -The Done-when's second bullet, *a check that fails by name when any of these tools calls gh or fetches github.com on a forge clone*, is a **new check**, so it needs Raf's yes (DECIDED 2026-11-19 "No new checks without your yes (Recommended)"). The tests above are ordinary suite cases, not that check. I ask for it as its own menu line and do not build it without the yes. +- `find_the_work…`: a Forgejo origin, with stand-in curl answers copied from the live pulls pages (body + `x-total-count` + status), yields the PR number. Also each of these gives its `why` and a `PR UNREAD` line, never "no open PR": + - **[r2 R1]** a cap of 7 (three pages, the PR on page 2) is found; + - two open PRs at the head give "more than one"; + - a missing `total`, a `total` that changes between pages, an unparsable entry, and a list past the page bound. + - `gh` is absent and never called. +- `check_a_range…`: a Forgejo origin, with runs + tasks copied from live answers; a job not ended is named; **[r2 R2]** a missing hosts entry and a 0644 token each give `CI UNREAD … <why>`; no `gh` call. +- seam: `theCiOfAHostAt` on a path; **[r2]** the N1/N2/N3 guards; `jobsNamed` on both adapters; `jobsOf` = count of `jobsNamed`; **[r2 N5]** short sha resolved, ambiguous short sha refused. +- A GitHub origin asks the same paths as today. Existing landing tests stay green with only the budget wrapper as the difference. ### 6. Not in this package - `keep_the_owners_todo_list.ts:300-301` (`pr_merged`/`tag_exists` via `gh`): it is not among #8's named tools, and it is on #16's list. - `crew_worktree_finish`'s open-PR check reading GitHub is macula-sponsors#29 (crew mod). It can use `openPullRequestsAt` once this lands; a note goes on #29, and nothing is built here. -- #32 (forge page cap assumed to be 50): `openPullRequestsAt` reads `x-total-count` and refuses a short read. It does not settle #32's other readers. +- #32 (forge page cap assumed to be 50): `openPullRequestsAt` no longer assumes it (R1). #32's other readers are not touched here. Refs #46, #8, #31, #32, macula-io/macula-sponsors#29. ``` </details>
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha#8
No description provided.