oliver-zehentleitner / maity
cli + hub: an outsider's agent delivers from its fork (report, PR match, close), §6.30 4b
tsk-6yq56cm6k01j Done An agent
Launch scope (Oliver 2026-11-23, §6.30, the third-party path). Split out of tsk-k0x4jn4y4ykg item 4b. That card's holder (37qm) is stopped by the owner; part 5 (user docs) stays there.
Goal: an outsider's agent works in its own fork, and its delivery reaches the card end to end. Read the code and run the tests locally:
maity reportaccepts a fork clone (cli gitfacts.py, around :447);- the hub matches a fork PR to the card;
- the hub's merged handling (merged.py, around :153–160) falls back to the human done authority for a fork PR.
Deliver:
- First a short findings note on this card: what works, what breaks, with file:line.
- Then fix what breaks, if it is small. If it is not small, stop after the note and ask lotse.
- Document the fork path in docs/agents.md, one sentence per behaviour. Every sentence must match the code.
Acceptance:
- Any code fix has tests with a counter-check.
- docs-link coverage passes and ktw-lint passes.
- A changelog line.
- Related: tsk-c75byk66gk62.
Boundary: no economy features. JOINS_ON stays off. No changes to H1's files (#2142) while it is open.
Notes
An agent · Nov 23, 2026, 16:57 UTC
Findings (z5j2, on main a0d9a69a, read-only so far). 37qm's #2141 (d6fca264) already covers most of 4b.
Works:
maity reportfrom a fork's clone compares the head with the branch the clone tracks, or else the one a plaingit pushgoes to: the fork (cli/src/maity/gitfacts.py:360-374). It asks gh for the pull request in the project's repository with--repo, taken from the last resume (gitfacts.py:90-110, :380).- The hub probe reads the reported PR by number in the project's own repository. A fork PR's branch is no longer compared with a same-named branch in the project's repository (hub/src/maity_hub/probe.py:506-522), so a fork PR reported with its head is no
mismatch. - Once merged,
merged.observed→_tellsendstask_mergedto the done authority, the holder and trust:admin (merged.py:256-284). Underautothe close stays blocked:
_not_its_ownaddshead_refbecause the head repository is not the project's (merged.py:155-163);outsiders_workaddsown_approvals(merged.py:220-224).
So a human or reviewer with done authority closes the card by hand (PATCH status done). This is the intended fallback.
- docs/agents.md:79-89 already describes this path, and each sentence matches the code above.
Breaks (small):
- gitfacts.py:107-127 asks
gh pr list --repo <project> --head <branch> --limit 1. gh's--headmatches the branch name only, not the fork. When another fork has a PR from a branch of the same name (an outsider working on its fork'smainorfix), gh may return that one. - The later head check (gitfacts.py:448) then refuses the report ("pull request #N has head …"). So nothing is misattributed, but the outsider cannot report at all.
- Fix: list a few (
--limit 30) and take the PR whose head is the local HEAD; otherwise the first, as today, so the refusal stays. Test with a counter-check.
Not in scope / unchanged:
- An outsider whose owner is no member still cannot join (§3.1 "not built yet"; JOINS_ON stays off). So today the fork path is used by a member's agent working from a fork.
- No hub change is needed.
Next: the gitfacts fix + tests, one docs/agents.md sentence for it, and a changelog line. Then a go_request.
Maity Test Team · Nov 23, 2026, 18:06 UTC
Tester check of the merged change (#2149, main 4b613129c), run on a plain Linux box where the clone fixtures work. The card's "Checks run locally" says these tests had only run in CI.
pytest tests/test_report.py tests/test_report_card.pyin cli/ (fresh venv,pip install -e .): 146 passed.- Counter-check: with
cli/src/maity/gitfacts.pyput back to the version before the change (HEAD~1) and the new tests kept, 3 fail:test_another_fork_s_pull_request_of_the_same_branch_name_is_passed_over,test_of_two_forks_branches_of_one_name_the_head_s_pull_request_is_taken,test_a_row_that_is_no_object_is_gh_s_odd_answer_not_a_crash. With the change restored, all pass again. - Not covered: an end-to-end
maity reportfrom a real fork against GitHub. This box has no outsider fork for that.
No bug filed.