Repository navigation
docs: let agents carry work end to end, with human stop and high-risk gates #571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
8931744
docs: let agents carry work end to end, with human stop and high-risk…
Dong1017 ff1132c
docs: bound agent decisions, define stop scope and align approval format
Dong1017 e5ec0a9
docs: keep the non-waivable list to the key gates and add decider rules
Dong1017 ab6d09c
docs: tie Issue governance to assignee and status labels
Dong1017 eeca714
docs: rename the stop label to bot:stop, adopt bot:reviewed and make …
Dong1017 c73dca3
docs: keep the external-labels exception until the label migration
Dong1017 62b4d5f
docs: have maintainers merge high-risk PRs and settle when bot:stop a…
Dong1017 d258ef0
docs: keep comment stop requests in effect until lifted or moved to b…
Dong1017 f1e546c
docs: count maintainer-account approvals on high-risk PRs and track t…
Dong1017 b711b80
docs: list the audit fields for high-risk merges and record recovery …
Dong1017 f0fd360
docs: make the audit and recovery lines agent-written fixed fields an…
Dong1017 df56e5a
docs: record the maintainer approver in the merge-audit line
Dong1017 420094c
docs: check stop comments in review-pr and say who lifts a stop
Dong1017 e692781
docs: require an Admin-role approval on high-risk PRs
Dong1017 0f81d79
docs: take the high-risk approval from a named approver list
Dong1017 9577a11
docs: pin the effective approver list and align who lifts a stop
Dong1017 b448fba
docs: keep lifting a stop human-only and say what list= records at bo…
Dong1017 71777a0
docs: let a cursor[bot] approval count as one vote on non-high-risk PRs
Dong1017 bdef0f1
docs: add Bounty-hunter to the high-risk approver list
Dong1017 da07c31
docs: give each issue one parent and its own completion condition
Dong1017 dffc773
docs: keep cursor[bot] reviews advisory and out of the two approvals
Dong1017 6dc2bca
docs: add linyueqian to the high-risk approver list
Dong1017 cbfef1d
Revert "docs: give each issue one parent and its own completion condi…
Dong1017 98ae71a
docs: fall back to the assignee as owner only when exactly one is set
Dong1017 a4f6733
docs: recheck GitHub's merge state for an advisory Request changes
Dong1017 46964d3
Merge origin/main into docs/bot-collaboration-rules
Dong1017 ebf9e77
docs: check a stop on every ancestor Issue before acting
Dong1017 a812a88
docs: limit the stop check to the governing chain and its real ancestors
Dong1017 cb6bbd8
docs: count formal Approve reviews and use the guide's stop check in …
Dong1017 fb425e6
Merge main (incl. #607) into docs/bot-collaboration-rules
Dong1017 93f0b1d
docs: fix the comment order — identity line first, then the conclusion
Dong1017 136a497
Merge main (incl. #601) into docs/bot-collaboration-rules
Dong1017 dbaad9e
docs: add collaboration skills and slim the agent entry page (#572)
Dong1017 6a8f735
docs: guard collaboration merges against state changes
Dong1017 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| name: claim-work | ||
| description: Claim an InferRSI Issue or fix before starting it, state when the next artifact will appear, and release the claim if nothing appears. Use before starting a fix, opening a PR or taking over a delegated slice. | ||
| --- | ||
|
|
||
| # Claim work on an InferRSI Issue | ||
|
|
||
| Follow the [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority) | ||
| rules and working rules 1, 7 and 8 in | ||
| [agent collaboration](../../../docs/agent-collaboration.md#working-rules). | ||
|
|
||
| ## Check before claiming | ||
|
|
||
| 1. Confirm the governing Issue and its accepted scope before changing code. If | ||
| the guide's [stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds a stop on | ||
| this work's stop chain, or cannot rule one out, do not claim it. | ||
| 2. Confirm the Issue has an accountable owner (recorded on the Issue, or else | ||
| its only assignee when exactly one is set) and carries `status:accepted`: | ||
|
|
||
| ```bash | ||
| gh issue view <issue> --repo InferMatrixLab/InferRSI --json assignees,labels | ||
| ``` | ||
|
|
||
| With several assignees and no recorded owner, there is no accountable | ||
| owner yet. With no accountable owner, propose on the Issue and ask a maintainer to assign it; | ||
| at `status:proposed` or `status:deferred`, discuss only. Do not claim | ||
| either. | ||
| 3. Confirm you are the deciding agent (the formal agent working for the | ||
| accountable owner's account) or that the deciding agent delegated this slice to you | ||
| on the Issue. Otherwise propose on the Issue instead of claiming. | ||
| 4. Search open Issues and PRs for the same work, for example: | ||
|
|
||
| ```bash | ||
| gh search issues --repo InferMatrixLab/InferRSI --state open "<keywords>" | ||
| gh search prs --repo InferMatrixLab/InferRSI --state open "<keywords>" | ||
| ``` | ||
|
|
||
| 5. Read the governing Issue's recent comments. If someone holds a live claim, | ||
| coordinate on that thread instead of starting a parallel fix. | ||
|
|
||
| ## Claim on the Issue | ||
|
|
||
| Post one comment on the governing Issue, not on a PR or in a private channel: | ||
|
|
||
| ```text | ||
| <agent name>, acting for @<human>: claiming <the slice>. | ||
| Next artifact: <draft PR / branch / findings> by <date and time, with time zone>. | ||
| ``` | ||
|
|
||
| Keep the claim to the slice you will deliver. A claim records intent; it does | ||
| not grant authority beyond the Issue's direction. Each Issue has one deciding | ||
| agent, the one acting for its accountable owner; other agents propose there. | ||
| Within the Issue's direction, the deciding agent settles scope and records the | ||
| reason on the Issue; only a change of direction goes back to the owner. | ||
|
|
||
| ## Deliver or release | ||
|
|
||
| - Show the named artifact on the Issue by the stated time. Post again only for | ||
| a new head, new evidence or a new question; no status-only updates. | ||
| - A claim that states no time allows 24 hours. | ||
| - If nothing appears by then, the claim lapses. Post one comment releasing it, | ||
| with any partial findings in `<details>`, and leave the work to others. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| --- | ||
| name: merge-pr | ||
| description: Decide whether an InferRSI pull request may merge now and, if so, squash-merge it. Use before merging and whenever reporting a PR as merge-ready; this is the one merge-ready check, not private criteria. | ||
| --- | ||
|
|
||
| # Merge an InferRSI pull request | ||
|
|
||
| Follow [PR review and merge](../../../docs/agent-collaboration.md#pr-review-and-merge) | ||
| and the [squash merge rules](../../../docs/agent-collaboration.md#records). | ||
| Report a PR as merge-ready only when every check below holds on its current | ||
| head; otherwise report the first failing check. | ||
|
|
||
| ## Read the current state | ||
|
|
||
| ```bash | ||
| gh pr view <pr> --repo InferMatrixLab/InferRSI \ | ||
| --json state,isDraft,autoMergeRequest,headRefOid,baseRefName,baseRefOid,body,labels,reviews,reviewDecision,mergeStateStatus,statusCheckRollup,files | ||
| ``` | ||
|
|
||
| Also read the governing Issue's labels, accountable owner and recorded | ||
| authorization. Note `headRefOid`, `baseRefName` and `baseRefOid` for the checks | ||
| below. | ||
|
|
||
| ## Check every condition | ||
|
|
||
| 1. **Open and ready:** the PR is open and not a draft. | ||
| 2. **Authorized to integrate:** the governing Issue has an accountable owner | ||
| (recorded on the Issue, or else its only assignee when exactly one is set) and carries `status:accepted`, and you are its deciding agent, were delegated | ||
| integration on the Issue, or you act for a maintainer account. | ||
| 3. **No stop and auto-merge off.** If `autoMergeRequest` is set, the authorized | ||
| integrator, or a maintainer if the integrator cannot act, cancels it with | ||
| `gh pr merge <pr> --repo InferMatrixLab/InferRSI --disable-auto` and | ||
| re-reads the PR to confirm `autoMergeRequest` is `null`, even when a stop | ||
| is active. On an Issue-level stop, apply this to every affected PR. If the | ||
| cancellation cannot be confirmed, hold the work and report that the PR may | ||
| still merge automatically. If the PR already merged, report it to the Issue | ||
| owner for authorized recovery. | ||
| Run the guide's [stop check](../../../docs/agent-collaboration.md#identity-and-authority) | ||
| on the whole stop chain. A stop comment holds even after the label exists. | ||
| If the check finds a stop or cannot rule one out, do not merge. Record on | ||
| the PR any Issue you could not check. | ||
| 4. **Base and dependencies:** the PR's base is its intended target: `main`, | ||
| or for a stacked PR its lower PR's branch until that PR merges, after which | ||
| the base is changed back to `main` and the checks run again. Every PR it | ||
| depends on has merged; until then, do not merge or queue it. | ||
| 5. **Two approvals on the current head:** at least two formal **Approve** | ||
| reviews, each from a different eligible account (repository write access | ||
| or higher), none stale. The review body's wording does not count; | ||
| comments and **Comment** reviews contribute no approval. | ||
| Each account counts once, whether its human votes directly or its one | ||
| formal reviewer agent does. | ||
| 6. **Independence:** the author, material contributors and the accountable | ||
| parent supplied none of them, including through another agent under their | ||
| account. At least one comes from a different agent or a human. The | ||
| author's own approval never counts, nor does one from an account without | ||
| write access. | ||
| 7. **No open blocker:** every binding **Request changes** review (from an | ||
| account with write access or higher) is re-reviewed to **Approve** or | ||
| dismissed with a recorded reason, by those the | ||
| [guide](../../../docs/agent-collaboration.md) allows to dismiss it. An | ||
| advisory review, such as one from `cursor[bot]`, does not count as a vote | ||
| but has a substantive answer on the PR and a recorded disposition (fixed in | ||
| a named commit, or declined with the reason). If GitHub's merge state still | ||
| shows the PR blocked by it on the current head, someone the guide allows to | ||
| dismiss reviews dismisses it, and the PR records who did and why, before | ||
| you merge. An unresolved code or safety | ||
| blocker still stops the merge, whoever raised it. | ||
| 8. **Required checks green** on the head. Windows/macOS `host-compatibility` | ||
| results are advisory and never block. | ||
| 9. **High-risk:** if the diff changes CI workflows or required checks, | ||
| releases (release workflow, version, tags, publishing), secrets and | ||
| credentials, or permissions (workflow `permissions`, repository access, | ||
| rulesets, the high-risk approver list), or you cannot tell, at least one of | ||
| the approvals in check 5 must come from an account on the applicable list. | ||
| That account's agent may give it. Record the current protected `main` tip as | ||
| `<mainSha>` using | ||
| `gh api repos/InferMatrixLab/InferRSI/git/ref/heads/main --jq .object.sha`. | ||
| The PR's `baseRefOid` can lag behind the live ref. For the one-time bootstrap | ||
| PR, confirm the list is absent at `<mainSha>` and use the original approvers in the | ||
| [bootstrap decision](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219). | ||
| For every later high-risk PR, including changes to the list, read the list | ||
| at `<mainSha>` | ||
| (`gh api "repos/InferMatrixLab/InferRSI/contents/.github/high-risk-approvers.json?ref=<mainSha>" --jq .content | base64 -d`). | ||
| In both cases, confirm an approving login is in the applicable list and | ||
| that the permission check prints `admin` or `write` for that account | ||
| (`gh api repos/InferMatrixLab/InferRSI/collaborators/<login>/permission --jq .permission`). | ||
| Hold the merge if either check cannot be verified. | ||
| On later high-risk PRs, verify a merge path that rejects a change to the | ||
| checked base, or verify exclusive serialization covering every high-risk | ||
| merge and every way to update the list. If neither is available, hold the | ||
| merge. | ||
| 10. **Recovery for external effects:** if the merge itself causes an external | ||
| effect that a revert cannot undo (publishing a release asset or package, | ||
| changing access or credentials), the PR body has a | ||
| `recovery: owner=@<account>; containment=<steps>` line naming the recovery | ||
| owner and the containment steps. If it is missing, do not merge and ask the | ||
| author to add it. This adds no approval requirement. | ||
|
|
||
| For a serialized high-risk merge, acquire the exclusive slot before the final | ||
| checks and keep it until GitHub confirms or definitively rejects the merge. If | ||
| the result is unknown, confirm the PR's state before releasing the slot. | ||
|
|
||
| Right before merging, read the PR and the governing Issue again. Repeat check 3 | ||
| on the whole stop chain and confirm `autoMergeRequest` is `null`. Confirm | ||
| `headRefOid`, `baseRefName`, `baseRefOid`, `status:accepted` and your authorization. | ||
| Recheck the current head's approvals, any open binding **Request changes**, | ||
| any advisory request without a recorded disposition, GitHub's merge state and | ||
| any unresolved code or safety blocker. Recheck any required `recovery:` line. | ||
| For a high-risk PR, confirm the live protected `main` tip still equals | ||
| `<mainSha>` and repeat the listed approval and permission checks. For the | ||
| one-time bootstrap, reconfirm the absence of the file and the approval from | ||
| the recorded bootstrap list. If anything changed or no longer holds, start over. | ||
|
|
||
| ## Merge | ||
|
|
||
| Prepare the squash message: subject plus a short summary, no Issue references, | ||
| DCO sign-off and material `Agent-assisted-by` attribution kept. Squash-merge | ||
| only the head you checked. Use the direct command below for ordinary PRs, the | ||
| one-time bootstrap, or while holding the verified serialization slot. With a | ||
| base-enforcing path, require both the checked head and `<mainSha>` at merge time. | ||
|
|
||
| ```bash | ||
| gh pr merge <pr> --repo InferMatrixLab/InferRSI --squash \ | ||
| --match-head-commit <headRefOid> --subject "<subject>" --body "<summary>" | ||
| ``` | ||
|
|
||
| The CLI flag and the REST merge endpoint's `sha` parameter bind only the PR | ||
| head. If the checked revision has changed, start over from the checks above. | ||
| Keep native auto-merge off and use a synchronous merge. The repository ruleset | ||
| and merge controls apply. Add queueing instructions once the queue is enabled. | ||
| Record the merge on the PR yourself, right after merging, with an identity | ||
| line; for a high-risk PR the same comment then has one line | ||
| `merge-audit: head=<sha> approvals=@<account> <review URL>, @<account> <review URL> approver=@<login> list=<sha> merge=<sha> by=@<account>`, | ||
| where `approver=` names the approving account you found on the list and | ||
| verified in check 9, and `list=` is the `<mainSha>` you read the list from | ||
| (`list=bootstrap-570` only for the one-time bootstrap merge in the | ||
| [high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority)). | ||
| If `main` turns red afterwards, use the | ||
| [red-main skill](../red-main/SKILL.md). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| name: open-pr | ||
| description: Open an InferRSI pull request from current main with local checks run, DCO and agent attribution on commits, and a complete PR body including the knowledge authorship declaration. Use when turning a claimed slice into a PR or updating its head. | ||
| --- | ||
|
|
||
| # Open an InferRSI pull request | ||
|
|
||
| Follow [contributing](../../../docs/contributing.md#development), the | ||
| [records rules](../../../docs/agent-collaboration.md#records) and the | ||
| [knowledge authorship declaration](../../../docs/knowledge-model-policy.md#one-pr-body-declaration). | ||
| Claim the work first with the [claim-work skill](../claim-work/SKILL.md). | ||
|
|
||
| ## Branch and commit | ||
|
|
||
| 1. Fetch and branch from current `main` in a separate worktree: | ||
|
|
||
| ```bash | ||
| git fetch origin main | ||
| git worktree add -b <branch> ../<dir> origin/main | ||
| ``` | ||
|
|
||
| 2. Keep the PR one coherent delivery slice with a minimal diff. | ||
| 3. Commit with `git commit -s` under your real identity. Add | ||
| `Agent-assisted-by: <tool> / <model-id> [effort=<level>] (<role>)` for each | ||
| material agent contributor. Keep Issue references out of commit subjects, | ||
| bodies and trailers. | ||
|
|
||
| ## Run the local checks | ||
|
|
||
| Run them on the content you will push and record the actual results: | ||
|
|
||
| ```bash | ||
| ruff check src tests tools | ||
| pytest | ||
| ``` | ||
|
|
||
| If the skill library changed, also run | ||
| `python tools/build_skill_index.py --source-revision <source-commit> --check`. | ||
| Check every new or changed artifact against the | ||
| [privacy and security rules](../../../docs/privacy-security.md). | ||
|
|
||
| ## Write the PR body | ||
|
|
||
| Start from the [PR template](../../../.github/PULL_REQUEST_TEMPLATE.md): | ||
|
|
||
| - The first line of the governing section is `Refs #<issue>`. Never write a | ||
| closing keyword before an Issue reference, even in a negated sentence. | ||
| - Fill the `knowledge-model-policy` block with the current full head SHA and | ||
| every material AI author's actual tool, model and effort. Changes to | ||
| [protected paths](../../../docs/knowledge-model-policy.md#rollout-and-scope) | ||
| fail the required check without it; after every push, update `head_sha`. | ||
| #518 stalled because its declaration check stayed red on the final head. | ||
| - Report checks actually run, and failed, skipped or not-run ones, separately. | ||
| Report PR readiness and Issue completion separately. | ||
| - If a revert cannot undo the change's external effect (credentials, | ||
| published assets, access), add one line | ||
| `recovery: owner=@<account>; containment=<steps>`. | ||
| - Do not prefill an independent approval or claim an authorized merge. | ||
|
|
||
| Open the PR with `gh pr create --base main` and show it on the Issue as the | ||
| claimed artifact. Review goes to an independent reviewer using the | ||
| [review-pr skill](../review-pr/SKILL.md). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| name: red-main | ||
| description: Restore a red InferRSI main by finding the merge that broke it, reverting that merge first and fixing forward in a new PR. Use when a required check fails on main after a merge. | ||
| --- | ||
|
|
||
| # Restore a red main | ||
|
|
||
| Follow the revert-first rule at the end of | ||
| [PR review and merge](../../../docs/agent-collaboration.md#pr-review-and-merge): | ||
| revert the merge that broke `main` before fixing forward. | ||
|
|
||
| ## Find the breaking merge | ||
|
|
||
| 1. List recent `main` runs and find the last green and first red run of the | ||
| failing workflow: | ||
|
|
||
| ```bash | ||
| gh run list --repo InferMatrixLab/InferRSI --branch main --workflow <workflow> --limit 20 | ||
| ``` | ||
|
|
||
| 2. List the merges between those two commits with | ||
| `git log --first-parent <last-green>..<first-red>`. Read the failing job | ||
| log and match the failure to the change that caused it. Two PRs that each | ||
| passed can fail together; the breaking merge is the one after which `main` | ||
| first failed. | ||
| 3. Search open Issues and PRs for an existing revert or fix, and claim the | ||
| revert with the [claim-work skill](../claim-work/SKILL.md). | ||
|
|
||
| ## Revert first | ||
|
|
||
| Branch from current `main` and revert the breaking merge: | ||
|
|
||
| ```bash | ||
| git revert --signoff --no-edit <merge-sha> | ||
| ``` | ||
|
|
||
| Open the revert PR with the [open-pr skill](../open-pr/SKILL.md), naming the | ||
| breaking merge and the failing run. It merges through the | ||
| [merge-pr skill](../merge-pr/SKILL.md) like any other PR. Post one comment on | ||
| the original PR linking the revert. | ||
|
|
||
| ## Fix forward | ||
|
|
||
| After `main` is green again, the original change returns in a new PR that | ||
| contains the fix, reviewed and merged under the same rules. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| [ | ||
| "david6666666", | ||
| "zengchuang-hw", | ||
| "amy-why-3459", | ||
| "Dong1017", | ||
| "hsliuustc0106", | ||
| "Bounty-hunter", | ||
| "linyueqian" | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The checks above bind the high-risk approver list to
baseRefOid, but this command only pins the PR head. If a list update lands onmainbetween the recheck and the merge, the same head could merge with an approver the new list removed. Can we define how integrations are serialized against list updates, or make the skill fail closed until the merge path can enforce the checked base?