From 893174488f78164a3752c70ad090bc4cb7a947f1 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sat, 21 Nov 2026 20:50:30 +0800 Subject: [PATCH 01/31] docs: let agents carry work end to end, with human stop and high-risk gates The guide assumed humans make delegation, scope, rule and waiver decisions. Agents now do most of the work, so let them make those decisions on the record, and keep humans to setting direction through Issues, approving high-risk changes and stopping work. Adds the agent safeguards this relies on: cross-agent approval, a merge queue as the last gate, revert-first on a red main, the agent:stop label, and the earlier claim, identity and comment rules. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/labels.json | 5 +++++ AGENTS.md | 1 + docs/agent-collaboration.md | 24 +++++++++++++++++++++--- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/labels.json b/.github/labels.json index 87a7552bc..446232f27 100644 --- a/.github/labels.json +++ b/.github/labels.json @@ -1,4 +1,9 @@ [ + { + "name": "agent:stop", + "group": "agent", + "description": "Human stop switch: agents make no changes, reviews or merges here until a human removes it" + }, { "name": "area:knowledge", "group": "area", diff --git a/AGENTS.md b/AGENTS.md index 39b196eda..c48c19f68 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,6 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). +5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review, never approve your own PR, claim work on the Issue before starting, keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index f6686320d..46a1bfc41 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,9 +11,13 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Material scope changes and exceptions return to the authorized owner. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Material scope changes and exceptions are decided by the accountable agent and recorded with their reason on the Issue; a human may override any such decision. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. +- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions, review and merge. Each such decision is recorded on the Issue or PR with its reason. +- Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `agent:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. +- High-risk changes need an **Approve** from a human maintainer as one of the two approvals: CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). +- Each account carries at most one agent team, or the agent uses its own account. Every agent comment and every formal review (including **Approve** and **Request changes**) starts with one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. ## Roles @@ -73,7 +77,7 @@ flowchart TB The integrator uses attributable, independent review records. Blocked integration or incomplete goals remain open, and material scope exceptions -return to the authorized owner. +are recorded by the accountable agent for any human to override. ### PR review and merge @@ -84,7 +88,10 @@ spelling `LGTM` qualifies. For DO NOT PASS, submit **Request changes** with the blockers and the expected corrections or evidence. An eligible approval comes from an independent reviewer using a GitHub account -with repository write access or higher. The PR author, material contributors, +with repository write access or higher; an agent's **Approve** is a formal +approval and counts toward the two. The authoring agent never approves its own +PR, and at least one approval comes from a different agent or a human. +The PR author, material contributors, and the accountable parent for the delivery slice cannot supply an independent approval, including through another agent acting under their account. Each eligible account counts once. @@ -113,6 +120,14 @@ is resolved. Record the reason and supporting evidence on the PR. The two valid approvals are still required after dismissal. [GitHub review dismissal](https://docs.github.com/en/pull-requests/how-tos/review-pull-requests/dismissing-a-pull-request-review) +Two PRs that each pass their checks can still break `main` together once both +are merged. A GitHub merge queue, with the required checks, is the last gate: +it runs the checks on the merged result without dismissing existing approvals, +so a PR branch need not be up to date with `main` before merging. Enabling it +is a repository setting for maintainers. If `main` still turns red after a +merge, an agent first reverts the merge that broke it, then fixes forward in a +new PR. + ### Agent–Agent: isolated work and conditional handoff ```mermaid @@ -140,6 +155,8 @@ sequenceDiagram 4. **Refresh:** reassess affected evidence after relevant head/base/content/environment/check changes. Refresh checks or explain continued applicability. Neither blanket reuse nor full hardware reruns is the default; changed hashes alone prove neither content change nor equivalence. 5. **Handoff:** only for an actual transfer or accepted decision change, record the delta, recipient and next action. Keep acceptance status/link, communication status and application status separate. "Applied" needs artifact/evidence; otherwise retain pending or unknown. No full conversation traces or new ledger. 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use non-closing `Refs #N` until closure is authorized. GitHub treats a closing keyword followed by an Issue reference as closing syntax even inside a negated sentence, so never write one in PR text; for an authorized closure, put `Closes #N` alone on its own line. The ready lane's `pr-references` job reports any other use. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. Before an authorized closure, publish a closure summary card ([closure summaries](#closure-summaries)). +7. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. +8. **Comments:** agent comments start with a one-line conclusion; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. ## Closure summaries @@ -234,6 +251,7 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | +| Stop switch | `agent:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR; removing lets them resume | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | An Issue carries at most one `status:*` label. When the owner rejects a proposal, or its From ff1132c9237bac009ffe726763e44fe6c84cac9e Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 10:38:06 +0800 Subject: [PATCH 02/31] docs: bound agent decisions, define stop scope and align approval format Keep scope and exception decisions within the recorded delegation and the Issue's direction, require the Issue owner's approval before expanding scope, and list the controls no agent may waive. A stop on an Issue now also covers its linked PRs, queued merges and delegated work; agents recheck it before each side effect and do not act when the state is unknown. An Approve keeps LGTM alone on its first non-empty line and puts the identity line next; the review skill now says the same. Agents may submit formal reviews without a separate human delegation. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 16 +++++++++++----- AGENTS.md | 2 +- docs/agent-collaboration.md | 20 ++++++++++---------- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 6a6cce683..28deaf618 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -6,7 +6,10 @@ description: Independently review a pull request targeting InferMatrixLab/InferR # Review an InferRSI pull request Use the [review eligibility and merge rules](../../../docs/agent-collaboration.md#pr-review-and-merge) -and the [contribution evidence rules](../../../docs/contributing.md). If you +and the [contribution evidence rules](../../../docs/contributing.md). Start +every comment and review with one line naming the acting agent and the human +it acts for, for example `, acting for @.`; an **Approve** +keeps `LGTM` on its first non-empty line and puts that line next. If you authored or materially contributed to the change or were its accountable parent, label your assessment as a self-check and hand the formal review to an independent reviewer. @@ -45,21 +48,24 @@ case-sensitive token `LGTM`. For example: ```text LGTM +, acting for @. PR review verdict — PASS Reviewed base and head . Verified . ``` -For DO NOT PASS, select **Request changes**. Start the body with -**PR review verdict — DO NOT PASS** and state what must change or be verified +For DO NOT PASS, select **Request changes**. After the identity line, start +with **PR review verdict — DO NOT PASS** and state what must change or be verified before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed formal review still requires **Approve** or **Request changes**. -Submit a formal review only from an eligible independent account with recorded -direct or standing delegation covering that PR and review action. Before +Agents may submit formal reviews without a separate human delegation; see +[identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). +Submit one only from an eligible independent account, never on your own PR, +and not while the PR or its governing Issue carries `agent:stop`. Before submitting, confirm that the PR is open and the reviewed target, base and head are still current. If the revision changed, reassess the affected diff and evidence before submitting. diff --git a/AGENTS.md b/AGENTS.md index c48c19f68..de946988e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review, never approve your own PR, claim work on the Issue before starting, keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, claim work on the Issue before starting, keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 46a1bfc41..6e0df9eb2 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,13 +11,13 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Material scope changes and exceptions are decided by the accountable agent and recorded with their reason on the Issue; a human may override any such decision. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within that delegation and the Issue's direction, the accountable agent decides material scope changes and exceptions and records them with their reason on the Issue; a human may override any such decision. Expanding scope beyond the Issue's direction needs the Issue owner's approval first. No agent may waive independent review, the human approval for high-risk changes, `agent:stop` or repository permission boundaries. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. -- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions, review and merge. Each such decision is recorded on the Issue or PR with its reason. -- Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `agent:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. +- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge. Each such decision is recorded on the Issue or PR with its reason. +- Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `agent:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs, their queued merges and any work delegated under it. Right before each push, review, merge or merge-queue entry, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. - High-risk changes need an **Approve** from a human maintainer as one of the two approvals: CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). -- Each account carries at most one agent team, or the agent uses its own account. Every agent comment and every formal review (including **Approve** and **Request changes**) starts with one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. +- Each account carries at most one agent team, or the agent uses its own account. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -83,8 +83,9 @@ are recorded by the accountable agent for any human to override. For a PR targeting `main`, each completed review gives an explicit **PASS** or **DO NOT PASS** verdict. For PASS, submit **Approve** with `LGTM` alone on the -first non-empty line of the same review body. Only the exact, case-sensitive -spelling `LGTM` qualifies. For DO NOT PASS, submit **Request changes** with +first non-empty line of the same review body, followed by the agent's identity +line. Only the exact, case-sensitive spelling `LGTM` qualifies. For DO NOT +PASS, submit **Request changes** with the blockers and the expected corrections or evidence. An eligible approval comes from an independent reviewer using a GitHub account @@ -95,9 +96,8 @@ The PR author, material contributors, and the accountable parent for the delivery slice cannot supply an independent approval, including through another agent acting under their account. Each eligible account counts once. -For an agent submitting a review, record the direct delegation or link the -maintainer's standing delegation in the governing Issue or PR. Identify the -acting reviewer, account, scope and permitted review actions. +An agent may submit a formal review without a separate human delegation; its +identity line names the acting reviewer and the human it acts for. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when @@ -251,7 +251,7 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `agent:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR; removing lets them resume | +| Stop switch | `agent:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | An Issue carries at most one `status:*` label. When the owner rejects a proposal, or its From e5ec0a984113653f51334f1535eb8e18192500e7 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 12:12:48 +0800 Subject: [PATCH 03/31] docs: keep the non-waivable list to the key gates and add decider rules Leave scope decisions within an Issue's direction to the agent, recorded with a reason, and send only a change of direction back to the owner, so agents wait on people less. The list of controls no agent may waive keeps four items: independent review with two approvals, a human Approve for high-risk changes, agent:stop and permission/ruleset controls. Add one deciding agent per Issue, Comment-only reviews by agents on high-risk PRs, and one formal reviewer agent per account. A claim without a stated time allows 24 hours. Separate agent accounts stay a proposal, starting with a Dong-bot pilot. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 8 ++++++-- AGENTS.md | 2 +- docs/agent-collaboration.md | 9 +++++---- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 28deaf618..75d33e6b4 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -60,11 +60,15 @@ with **PR review verdict — DO NOT PASS** and state what must change or be veri before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed -formal review still requires **Approve** or **Request changes**. +formal review still requires **Approve** or **Request changes**, except on a +high-risk PR (CI, releases, secrets, permissions): there an agent gives its +verdict as a **Comment** and never selects **Approve**. Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). -Submit one only from an eligible independent account, never on your own PR, +Submit one only from an eligible independent account, and only as that +account's formal reviewer agent; other agents under the account report in +comments. Never submit one on your own PR, and not while the PR or its governing Issue carries `agent:stop`. Before submitting, confirm that the PR is open and the reviewed target, base and head are still current. diff --git a/AGENTS.md b/AGENTS.md index de946988e..dc4f4fd45 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, claim work on the Issue before starting, keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR or a high-risk PR, claim work on the Issue before starting, keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 6e0df9eb2..27308d1f6 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,13 +11,14 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within that delegation and the Issue's direction, the accountable agent decides material scope changes and exceptions and records them with their reason on the Issue; a human may override any such decision. Expanding scope beyond the Issue's direction needs the Issue owner's approval first. No agent may waive independent review, the human approval for high-risk changes, `agent:stop` or repository permission boundaries. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's **Approve** for high-risk changes, `agent:stop`, and repository permission and ruleset controls. +- Each Issue has one deciding agent: the agent acting for the Issue's accountable owner. Other agents propose on the Issue and do not decide. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge. Each such decision is recorded on the Issue or PR with its reason. - Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `agent:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs, their queued merges and any work delegated under it. Right before each push, review, merge or merge-queue entry, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. -- High-risk changes need an **Approve** from a human maintainer as one of the two approvals: CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). -- Each account carries at most one agent team, or the agent uses its own account. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. +- High-risk changes need an **Approve** from a human maintainer as one of the two approvals: CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). Agents only comment on high-risk PRs (**Comment**); they never **Approve** them. +- Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Separate agent accounts are proposed, not yet a rule: the proposal on [#570](https://github.com/InferMatrixLab/InferRSI/issues/570) pilots one with Dong-bot first. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -155,7 +156,7 @@ sequenceDiagram 4. **Refresh:** reassess affected evidence after relevant head/base/content/environment/check changes. Refresh checks or explain continued applicability. Neither blanket reuse nor full hardware reruns is the default; changed hashes alone prove neither content change nor equivalence. 5. **Handoff:** only for an actual transfer or accepted decision change, record the delta, recipient and next action. Keep acceptance status/link, communication status and application status separate. "Applied" needs artifact/evidence; otherwise retain pending or unknown. No full conversation traces or new ledger. 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use non-closing `Refs #N` until closure is authorized. GitHub treats a closing keyword followed by an Issue reference as closing syntax even inside a negated sentence, so never write one in PR text; for an authorized closure, put `Closes #N` alone on its own line. The ready lane's `pr-references` job reports any other use. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. Before an authorized closure, publish a closure summary card ([closure summaries](#closure-summaries)). -7. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. +7. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. 8. **Comments:** agent comments start with a one-line conclusion; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. ## Closure summaries From ab6d09c500f17797c339f8938f96efd26c4bb1d0 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 14:01:36 +0800 Subject: [PATCH 04/31] docs: tie Issue governance to assignee and status labels Name the assignee as the accountable owner and the formal agent working for that account as the deciding agent; with several agents under one account only its formal agent decides. Unassigned Issues are not started. In the labels table, status:proposed means discussion only, and work starts at status:accepted, when the direction is settled. Discussion within the direction continues and the deciding agent settles it with a reason; a change of direction goes back to the Issue owner. agent:stop applies at any status. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- AGENTS.md | 2 +- docs/agent-collaboration.md | 14 ++++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index dc4f4fd45..ca0e33b26 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR or a high-risk PR, claim work on the Issue before starting, keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR or a high-risk PR, claim work only on an assigned Issue labeled `status:accepted` (the agent acting for the assignee decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 27308d1f6..1871596bc 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -12,7 +12,8 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. - Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's **Approve** for high-risk changes, `agent:stop`, and repository permission and ruleset controls. -- Each Issue has one deciding agent: the agent acting for the Issue's accountable owner. Other agents propose on the Issue and do not decide. +- The Issue's assignee is its accountable owner. Each Issue has one deciding agent: the formal agent working for the assignee's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. +- An Issue without an assignee is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it is assigned. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge. Each such decision is recorded on the Issue or PR with its reason. @@ -248,13 +249,18 @@ lists every repository label with its group and description, and every name has | --- | --- | --- | --- | | Type | exactly one `kind:*` per Issue, including `kind:bug`; Issues only (Issues created before the label change may keep two) | the creator; templates | at creation | | Area | one or more `area:*` | the creator | at creation | -| Status | `status:proposed` (waiting for a decision) | the acting agent | the status block names a concrete question and its decision owner, and no decision is recorded | -| Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment | +| Status | `status:proposed` (waiting for a decision) | the acting agent | the status block names a concrete question and its decision owner, and no decision is recorded; the Issue is discussed only and no work starts | +| Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `agent:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume | +| Stop switch | `agent:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume; it applies at any status and overrides the rows above | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | +Status labels carry the governance above. Work starts only on an assigned Issue at +`status:accepted`. After that, discussion within the direction goes on: the deciding agent +settles it and records the reason on the Issue. Changing the direction goes back to the Issue +owner, who may return the Issue to `status:proposed` while the new question is open. + An Issue carries at most one `status:*` label. When the owner rejects a proposal, or its author withdraws it, the acting agent removes `status:proposed` and the Issue is closed as *not planned*. [Open Issues labeled `status:proposed`](https://github.com/InferMatrixLab/InferRSI/issues?q=is%3Aopen%20label%3A%22status%3Aproposed%22) From eeca714dad6859874e5fc15a63b82224ef479e6f Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 15:07:18 +0800 Subject: [PATCH 05/31] docs: rename the stop label to bot:stop, adopt bot:reviewed and make the merge queue conditional Rename agent:stop to bot:stop so the stop switch fits the group:value rule. Manage bot:reviewed in labels.json as an informational agent review mark and drop the external-labels exception, its check and its tests: the app that owned bot-reviewed has not applied it since 2026-11-04. Make the merge queue paragraph conditional on the queue being enabled; until then the current ruleset and merge controls apply. The repository rename of bot-reviewed and the creation of bot:stop happen after this PR merges, so the nightly drift check does not report them early. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 2 +- .github/external-labels.json | 6 --- .github/labels.json | 9 +++- AGENTS.md | 2 +- docs/agent-collaboration.md | 38 +++++--------- tests/test_check_labels.py | 84 +++---------------------------- tools/check_labels.py | 37 ++------------ 7 files changed, 33 insertions(+), 145 deletions(-) delete mode 100644 .github/external-labels.json diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 75d33e6b4..fcb44d183 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -69,7 +69,7 @@ Agents may submit formal reviews without a separate human delegation; see Submit one only from an eligible independent account, and only as that account's formal reviewer agent; other agents under the account report in comments. Never submit one on your own PR, -and not while the PR or its governing Issue carries `agent:stop`. Before +and not while the PR or its governing Issue carries `bot:stop`. Before submitting, confirm that the PR is open and the reviewed target, base and head are still current. If the revision changed, reassess the affected diff and evidence before submitting. diff --git a/.github/external-labels.json b/.github/external-labels.json deleted file mode 100644 index d079a2813..000000000 --- a/.github/external-labels.json +++ /dev/null @@ -1,6 +0,0 @@ -[ - { - "name": "bot-reviewed", - "owner": "agent-ci-infra-bot[bot]" - } -] diff --git a/.github/labels.json b/.github/labels.json index 446232f27..d9bb37884 100644 --- a/.github/labels.json +++ b/.github/labels.json @@ -1,9 +1,14 @@ [ { - "name": "agent:stop", - "group": "agent", + "name": "bot:stop", + "group": "bot", "description": "Human stop switch: agents make no changes, reviews or merges here until a human removes it" }, + { + "name": "bot:reviewed", + "group": "bot", + "description": "An agent reviewed this; informational only, it grants no approval or authority" + }, { "name": "area:knowledge", "group": "area", diff --git a/AGENTS.md b/AGENTS.md index ca0e33b26..c0ef3288e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `agent:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR or a high-risk PR, claim work only on an assigned Issue labeled `status:accepted` (the agent acting for the assignee decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR or a high-risk PR, claim work only on an assigned Issue labeled `status:accepted` (the agent acting for the assignee decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 1871596bc..f8864938a 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,13 +11,13 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's **Approve** for high-risk changes, `agent:stop`, and repository permission and ruleset controls. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's **Approve** for high-risk changes, `bot:stop`, and repository permission and ruleset controls. - The Issue's assignee is its accountable owner. Each Issue has one deciding agent: the formal agent working for the assignee's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. - An Issue without an assignee is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it is assigned. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge. Each such decision is recorded on the Issue or PR with its reason. -- Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `agent:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs, their queued merges and any work delegated under it. Right before each push, review, merge or merge-queue entry, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. +- Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs, their queued merges and any work delegated under it. Right before each push, review, merge or merge-queue entry, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. - High-risk changes need an **Approve** from a human maintainer as one of the two approvals: CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). Agents only comment on high-risk PRs (**Comment**); they never **Approve** them. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Separate agent accounts are proposed, not yet a rule: the proposal on [#570](https://github.com/InferMatrixLab/InferRSI/issues/570) pilots one with Dong-bot first. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. @@ -123,12 +123,14 @@ valid approvals are still required after dismissal. [GitHub review dismissal](https://docs.github.com/en/pull-requests/how-tos/review-pull-requests/dismissing-a-pull-request-review) Two PRs that each pass their checks can still break `main` together once both -are merged. A GitHub merge queue, with the required checks, is the last gate: -it runs the checks on the merged result without dismissing existing approvals, -so a PR branch need not be up to date with `main` before merging. Enabling it -is a repository setting for maintainers. If `main` still turns red after a -merge, an agent first reverts the merge that broke it, then fixes forward in a -new PR. +are merged. Once a GitHub merge queue is enabled, it is the last gate: with the +required checks, it runs them on the merged result without dismissing existing +approvals, so a PR branch need not be up to date with `main` before merging. +Until then, the current ruleset and merge controls apply unchanged. Enabling +the queue is a repository setting for maintainers, and it cannot be enabled +while the required `knowledge-model-policy` check does not run on +`merge_group` events. If `main` still turns red after a merge, an agent first +reverts the merge that broke it, then fixes forward in a new PR. ### Agent–Agent: isolated work and conditional handoff @@ -253,7 +255,8 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `agent:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Agent review mark | `bot:reviewed` | the reviewing agent | an agent reviewed the Issue or PR; informational only, it is not an approval and carries no coordination meaning | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | Status labels carry the governance above. Work starts only on an assigned Issue at @@ -288,23 +291,6 @@ repository. The nightly `safety-net` job reports drift between the repository la `labels.json`, and any label that an Issue template or `tools/skill_eval_*_config.json` references but `labels.json` lacks. No workflow writes labels. -[`external-labels.json`](../.github/external-labels.json) names the labels that an outside -GitHub App owns and applies, with the app that owns each one. Those names are exempt from the -`group:value` rule and from the drift report, because this repository neither creates them nor -decides their wording: renaming or deleting one only makes the app recreate it. Label -maintenance leaves them alone, and they carry no coordination meaning here, so the rules above -do not apply to them. A name cannot be in both files. An Issue template or -`tools/skill_eval_*_config.json` still may not reference one, since this repository must not -depend on a label it does not own. - -Each `owner` is a required, informational attribution: the reviewer's record of which app -applies that label, so a later reader can tell why the name is exempt rather than missing. No -check verifies it, and none can — GitHub does not report which app created a label, and an -app's configuration is outside this repository. Treat an entry as evidence of a past decision, -not as a verified fact: before relying on one, confirm from the label's own event history that -the named app still applies it. Adding an entry is a scope decision, so it goes through review -like any other change to this file. - ## Evidence refresh — hypothetical example **Hypothetical illustration only; it records no actual PR, run or result in this diff --git a/tests/test_check_labels.py b/tests/test_check_labels.py index f5605b685..919aa17bf 100644 --- a/tests/test_check_labels.py +++ b/tests/test_check_labels.py @@ -7,8 +7,6 @@ ROOT = Path(__file__).resolve().parents[1] MANIFEST = json.loads((ROOT / ".github/labels.json").read_text(encoding="utf-8")) -EXTERNAL = json.loads((ROOT / ".github/external-labels.json").read_text(encoding="utf-8")) -EXTERNAL_NAMES = {entry["name"] for entry in EXTERNAL} LIVE = [{"name": entry["name"], "description": entry["description"]} for entry in MANIFEST] @@ -25,16 +23,12 @@ def test_repository_manifest_is_valid(): assert check.manifest_problems(MANIFEST) == [] -def test_repository_external_list_is_valid(): - assert check.external_problems(EXTERNAL, MANIFEST) == [] - - def test_templates_and_configs_reference_only_listed_labels(): references = check.referenced_labels(ROOT) assert references[".github/ISSUE_TEMPLATE/scoped-task.md"] == ["kind:task"] assert references[".github/ISSUE_TEMPLATE/campaign-acceptance.yml"] == ["kind:acceptance"] assert references["tools/skill_eval_auto_config.json"] == ["skill-eval:execute"] - assert check.drift(MANIFEST, LIVE, references, EXTERNAL_NAMES) == [] + assert check.drift(MANIFEST, LIVE, references) == [] @pytest.mark.parametrize("bad, message", [ @@ -56,28 +50,18 @@ def test_duplicate_names_are_reported(): @pytest.mark.parametrize("bad", ["kind:bug", None, [], 7, True]) -def test_nonobject_entries_are_reported_in_both_manifests(bad): +def test_nonobject_entries_are_reported(bad): assert check.manifest_problems([entry("kind:bug"), bad]) == [ "labels.json entry 2: expected an object" ] - assert check.external_problems([{"name": "bot-reviewed", "owner": "app"}, bad], []) == [ - "external-labels.json entry 2: expected an object" - ] -def test_invalid_entries_do_not_hide_duplicates_or_overlap(): +def test_invalid_entries_do_not_hide_duplicates(): manifest = [None, entry("kind:bug"), entry("kind:bug")] assert check.manifest_problems(manifest) == [ "labels.json entry 1: expected an object", "kind:bug: listed more than once", ] - external = [None, {"name": "kind:bug", "owner": "app"}, - {"name": "kind:bug", "owner": "app"}] - assert check.external_problems(external, manifest) == [ - "external-labels.json entry 1: expected an object", - "kind:bug: listed more than once", - "kind:bug: external labels cannot also be in labels.json", - ] @pytest.mark.parametrize("name", [["a", "b"], {"a": 1}, 7, None]) @@ -88,40 +72,11 @@ def test_unusable_managed_names_do_not_reach_duplicate_checks(name): assert all("name must have the form" in problem for problem in problems) -@pytest.mark.parametrize("bad, message", [ - ({"name": "bot-reviewed"}, "exactly name and owner"), - ({"name": "bot-reviewed", "owner": "a", "note": "b"}, "exactly name and owner"), - ({"name": "", "owner": "a"}, "nonempty string"), - ({"name": " ", "owner": "a"}, "nonempty string"), - ({"name": None, "owner": "a"}, "nonempty string"), - ({"name": "bot-reviewed", "owner": " "}, "owner must name the app"), -]) -def test_invalid_external_entries_are_reported(bad, message): - [problem] = check.external_problems([bad], []) - assert message in problem - - -@pytest.mark.parametrize("name", [["a", "b"], {"a": 1}, 7]) -def test_an_unhashable_or_nonstring_external_name_is_reported_not_raised(name): - # An unusable name must not reach the duplicate/overlap sets and crash the check. - [problem] = check.external_problems([{"name": name, "owner": "app"}], [entry("kind:bug")]) - assert "name must be a nonempty string" in problem - - -def test_external_duplicates_and_overlap_with_the_manifest_are_reported(): - external = [{"name": "bot-reviewed", "owner": "app"}, {"name": "bot-reviewed", "owner": "app"}, - {"name": "kind:bug", "owner": "app"}] - assert check.external_problems(external, [entry("kind:bug")]) == [ - "bot-reviewed: listed more than once", - "kind:bug: external labels cannot also be in labels.json", - ] - - def test_drift_reports_missing_extra_changed_and_unlisted_references(): manifest = [entry("kind:bug"), entry("status:proposed", description="Waiting")] repository = [{"name": "status:proposed", "description": None}, {"name": "bug", "description": "Something isn't working"}] - assert check.drift(manifest, repository, {"form.yml": ["kind:bug", "acceptance"]}, set()) == [ + assert check.drift(manifest, repository, {"form.yml": ["kind:bug", "acceptance"]}) == [ "kind:bug: in labels.json, missing from the repository", "bug: in the repository, missing from labels.json", "status:proposed: repository description differs from labels.json", @@ -129,25 +84,6 @@ def test_drift_reports_missing_extra_changed_and_unlisted_references(): ] -def test_drift_accepts_an_external_label_in_the_repository(): - manifest = [entry("kind:bug")] - repository = [{"name": "kind:bug", "description": "Meaning"}, - {"name": "bot-reviewed", "description": None}] - assert check.drift(manifest, repository, {}, {"bot-reviewed"}) == [] - # Absence is also accepted: an outside app owns whether the label exists. - assert check.drift(manifest, repository[:1], {}, {"bot-reviewed"}) == [] - - -def test_drift_still_rejects_a_template_reference_to_an_external_label(): - manifest = [entry("kind:bug")] - repository = [{"name": "kind:bug", "description": "Meaning"}, - {"name": "bot-reviewed", "description": None}] - assert check.drift(manifest, repository, {"form.yml": ["bot-reviewed"]}, - {"bot-reviewed"}) == [ - "bot-reviewed: referenced by form.yml, missing from labels.json", - ] - - def test_template_and_config_label_forms(tmp_path): templates = tmp_path / ".github/ISSUE_TEMPLATE" templates.mkdir(parents=True) @@ -176,8 +112,7 @@ def test_markdown_template_without_front_matter_fails(tmp_path): def test_main_passes_silently_when_repository_matches(tmp_path, capsys): - live = LIVE + [{"name": name, "description": None} for name in sorted(EXTERNAL_NAMES)] - assert check.main([write_lines(tmp_path / "labels.jsonl", live)]) == 0 + assert check.main([write_lines(tmp_path / "labels.jsonl", LIVE)]) == 0 assert capsys.readouterr().out == "" @@ -192,19 +127,16 @@ def test_main_reports_each_drift_line_and_fails(tmp_path, capsys): assert "labels.json" in out[2] and len(out) == 3 -@pytest.mark.parametrize("filename", ["labels.json", "external-labels.json"]) @pytest.mark.parametrize("bad", ["kind:bug", None]) def test_main_reports_nonobject_entries_and_fails_without_drift( - tmp_path, monkeypatch, capsys, filename, bad): + tmp_path, monkeypatch, capsys, bad): github = tmp_path / ".github" github.mkdir() - for name, entries in [("labels.json", MANIFEST), ("external-labels.json", EXTERNAL)]: - (github / name).write_text(json.dumps([bad] if name == filename else entries), - encoding="utf-8") + (github / "labels.json").write_text(json.dumps([bad]), encoding="utf-8") monkeypatch.setattr(check, "ROOT", tmp_path) # No ISSUE_TEMPLATE directory exists: drift/reference reads must not run after validation fails. assert check.main([write_lines(tmp_path / "labels.jsonl", LIVE)]) == 1 assert capsys.readouterr().out.splitlines() == [ - f"label drift: {filename} entry 1: expected an object", + "label drift: labels.json entry 1: expected an object", check.ADVICE, ] diff --git a/tools/check_labels.py b/tools/check_labels.py index c2dd10ec5..db9c50932 100644 --- a/tools/check_labels.py +++ b/tools/check_labels.py @@ -42,33 +42,6 @@ def manifest_problems(manifest: list[dict]) -> list[str]: return problems -def external_problems(external: list[dict], manifest: list[dict]) -> list[str]: - problems = [] - names = [] - for index, entry in enumerate(external, start=1): - if not isinstance(entry, dict): - problems.append(f"external-labels.json entry {index}: expected an object") - continue - name = entry.get("name") - if set(entry) != {"name", "owner"}: - problems.append(f"{name}: expected exactly name and owner") - continue - # Only a usable name joins the duplicate and overlap comparisons below. - if isinstance(name, str) and name.strip(): - names.append(name) - else: - problems.append(f"{name}: name must be a nonempty string") - if not isinstance(entry["owner"], str) or not entry["owner"].strip(): - problems.append(f"{name}: owner must name the app that applies it") - problems += [f"{name}: listed more than once" - for name in sorted({n for n in names if names.count(n) > 1})] - listed = {e["name"] for e in manifest - if isinstance(e, dict) and isinstance(e.get("name"), str)} - problems += [f"{name}: external labels cannot also be in labels.json" - for name in sorted(set(names) & listed)] - return problems - - def _names(value, source: str) -> list[str]: # GitHub accepts a list of names or one comma-separated string in templates. if value is None: @@ -103,14 +76,14 @@ def referenced_labels(root: Path) -> dict[str, list[str]]: def drift(manifest: list[dict], repository: list[dict], - references: dict[str, list[str]], external: set[str]) -> list[str]: + references: dict[str, list[str]]) -> list[str]: expected = {entry["name"]: entry["description"] for entry in manifest} # The labels API returns null for a label without a description. actual = {label["name"]: label["description"] or "" for label in repository} problems = [f"{name}: in labels.json, missing from the repository" for name in sorted(expected.keys() - actual.keys())] problems += [f"{name}: in the repository, missing from labels.json" - for name in sorted(actual.keys() - expected.keys() - external)] + for name in sorted(actual.keys() - expected.keys())] problems += [f"{name}: repository description differs from labels.json" for name in sorted(expected.keys() & actual.keys()) if expected[name] != actual[name]] @@ -126,13 +99,11 @@ def main(argv: list[str] | None = None) -> int: help="JSON lines holding each repository label's name and description") args = parser.parse_args(argv) manifest = json.loads((ROOT / ".github/labels.json").read_text(encoding="utf-8")) - external = json.loads((ROOT / ".github/external-labels.json").read_text(encoding="utf-8")) repository = [json.loads(line) for line in args.repository_labels.read_text(encoding="utf-8").splitlines() if line.strip()] - problems = manifest_problems(manifest) + external_problems(external, manifest) + problems = manifest_problems(manifest) if not problems: - problems = drift(manifest, repository, referenced_labels(ROOT), - {entry["name"] for entry in external}) + problems = drift(manifest, repository, referenced_labels(ROOT)) # Each printed line starts with "label drift" so a label name cannot form a workflow command. for problem in problems: print(f"label drift: {problem}") From c73dca358b087cd50733807e1eeeee8dd5207275 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 17:34:14 +0800 Subject: [PATCH 06/31] docs: keep the external-labels exception until the label migration Restore .github/external-labels.json, its check, its tests and its paragraph in the collaboration guide, partly reverting the previous commit, and drop bot:reviewed from labels.json and the labels table. Moving bot-reviewed to a managed bot:reviewed label is left to the label-reduction PR, so the exception stays until that migration lands. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/external-labels.json | 6 +++ .github/labels.json | 5 --- docs/agent-collaboration.md | 20 ++++++++- tests/test_check_labels.py | 84 ++++++++++++++++++++++++++++++++---- tools/check_labels.py | 37 ++++++++++++++-- 5 files changed, 134 insertions(+), 18 deletions(-) create mode 100644 .github/external-labels.json diff --git a/.github/external-labels.json b/.github/external-labels.json new file mode 100644 index 000000000..d079a2813 --- /dev/null +++ b/.github/external-labels.json @@ -0,0 +1,6 @@ +[ + { + "name": "bot-reviewed", + "owner": "agent-ci-infra-bot[bot]" + } +] diff --git a/.github/labels.json b/.github/labels.json index d9bb37884..cfa63698c 100644 --- a/.github/labels.json +++ b/.github/labels.json @@ -4,11 +4,6 @@ "group": "bot", "description": "Human stop switch: agents make no changes, reviews or merges here until a human removes it" }, - { - "name": "bot:reviewed", - "group": "bot", - "description": "An agent reviewed this; informational only, it grants no approval or authority" - }, { "name": "area:knowledge", "group": "area", diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index f8864938a..333be9117 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -256,7 +256,6 @@ lists every repository label with its group and description, and every name has | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | | Stop switch | `bot:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume; it applies at any status and overrides the rows above | -| Agent review mark | `bot:reviewed` | the reviewing agent | an agent reviewed the Issue or PR; informational only, it is not an approval and carries no coordination meaning | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | Status labels carry the governance above. Work starts only on an assigned Issue at @@ -291,6 +290,25 @@ repository. The nightly `safety-net` job reports drift between the repository la `labels.json`, and any label that an Issue template or `tools/skill_eval_*_config.json` references but `labels.json` lacks. No workflow writes labels. +[`external-labels.json`](../.github/external-labels.json) names the labels that an outside +GitHub App owns and applies, with the app that owns each one. Those names are exempt from the +`group:value` rule and from the drift report, because this repository neither creates them nor +decides their wording: renaming or deleting one only makes the app recreate it. Label +maintenance leaves them alone, and they carry no coordination meaning here, so the rules above +do not apply to them. A name cannot be in both files. An Issue template or +`tools/skill_eval_*_config.json` still may not reference one, since this repository must not +depend on a label it does not own. + +Each `owner` is a required, informational attribution: the reviewer's record of which app +applies that label, so a later reader can tell why the name is exempt rather than missing. No +check verifies it, and none can — GitHub does not report which app created a label, and an +app's configuration is outside this repository. Treat an entry as evidence of a past decision, +not as a verified fact: before relying on one, confirm from the label's own event history that +the named app still applies it. Adding an entry is a scope decision, so it goes through review +like any other change to this file. + +Moving `bot-reviewed` to a managed `bot:reviewed` label is left to the label-reduction PR agreed on [#570](https://github.com/InferMatrixLab/InferRSI/issues/570); until then the exception above stands. + ## Evidence refresh — hypothetical example **Hypothetical illustration only; it records no actual PR, run or result in this diff --git a/tests/test_check_labels.py b/tests/test_check_labels.py index 919aa17bf..f5605b685 100644 --- a/tests/test_check_labels.py +++ b/tests/test_check_labels.py @@ -7,6 +7,8 @@ ROOT = Path(__file__).resolve().parents[1] MANIFEST = json.loads((ROOT / ".github/labels.json").read_text(encoding="utf-8")) +EXTERNAL = json.loads((ROOT / ".github/external-labels.json").read_text(encoding="utf-8")) +EXTERNAL_NAMES = {entry["name"] for entry in EXTERNAL} LIVE = [{"name": entry["name"], "description": entry["description"]} for entry in MANIFEST] @@ -23,12 +25,16 @@ def test_repository_manifest_is_valid(): assert check.manifest_problems(MANIFEST) == [] +def test_repository_external_list_is_valid(): + assert check.external_problems(EXTERNAL, MANIFEST) == [] + + def test_templates_and_configs_reference_only_listed_labels(): references = check.referenced_labels(ROOT) assert references[".github/ISSUE_TEMPLATE/scoped-task.md"] == ["kind:task"] assert references[".github/ISSUE_TEMPLATE/campaign-acceptance.yml"] == ["kind:acceptance"] assert references["tools/skill_eval_auto_config.json"] == ["skill-eval:execute"] - assert check.drift(MANIFEST, LIVE, references) == [] + assert check.drift(MANIFEST, LIVE, references, EXTERNAL_NAMES) == [] @pytest.mark.parametrize("bad, message", [ @@ -50,18 +56,28 @@ def test_duplicate_names_are_reported(): @pytest.mark.parametrize("bad", ["kind:bug", None, [], 7, True]) -def test_nonobject_entries_are_reported(bad): +def test_nonobject_entries_are_reported_in_both_manifests(bad): assert check.manifest_problems([entry("kind:bug"), bad]) == [ "labels.json entry 2: expected an object" ] + assert check.external_problems([{"name": "bot-reviewed", "owner": "app"}, bad], []) == [ + "external-labels.json entry 2: expected an object" + ] -def test_invalid_entries_do_not_hide_duplicates(): +def test_invalid_entries_do_not_hide_duplicates_or_overlap(): manifest = [None, entry("kind:bug"), entry("kind:bug")] assert check.manifest_problems(manifest) == [ "labels.json entry 1: expected an object", "kind:bug: listed more than once", ] + external = [None, {"name": "kind:bug", "owner": "app"}, + {"name": "kind:bug", "owner": "app"}] + assert check.external_problems(external, manifest) == [ + "external-labels.json entry 1: expected an object", + "kind:bug: listed more than once", + "kind:bug: external labels cannot also be in labels.json", + ] @pytest.mark.parametrize("name", [["a", "b"], {"a": 1}, 7, None]) @@ -72,11 +88,40 @@ def test_unusable_managed_names_do_not_reach_duplicate_checks(name): assert all("name must have the form" in problem for problem in problems) +@pytest.mark.parametrize("bad, message", [ + ({"name": "bot-reviewed"}, "exactly name and owner"), + ({"name": "bot-reviewed", "owner": "a", "note": "b"}, "exactly name and owner"), + ({"name": "", "owner": "a"}, "nonempty string"), + ({"name": " ", "owner": "a"}, "nonempty string"), + ({"name": None, "owner": "a"}, "nonempty string"), + ({"name": "bot-reviewed", "owner": " "}, "owner must name the app"), +]) +def test_invalid_external_entries_are_reported(bad, message): + [problem] = check.external_problems([bad], []) + assert message in problem + + +@pytest.mark.parametrize("name", [["a", "b"], {"a": 1}, 7]) +def test_an_unhashable_or_nonstring_external_name_is_reported_not_raised(name): + # An unusable name must not reach the duplicate/overlap sets and crash the check. + [problem] = check.external_problems([{"name": name, "owner": "app"}], [entry("kind:bug")]) + assert "name must be a nonempty string" in problem + + +def test_external_duplicates_and_overlap_with_the_manifest_are_reported(): + external = [{"name": "bot-reviewed", "owner": "app"}, {"name": "bot-reviewed", "owner": "app"}, + {"name": "kind:bug", "owner": "app"}] + assert check.external_problems(external, [entry("kind:bug")]) == [ + "bot-reviewed: listed more than once", + "kind:bug: external labels cannot also be in labels.json", + ] + + def test_drift_reports_missing_extra_changed_and_unlisted_references(): manifest = [entry("kind:bug"), entry("status:proposed", description="Waiting")] repository = [{"name": "status:proposed", "description": None}, {"name": "bug", "description": "Something isn't working"}] - assert check.drift(manifest, repository, {"form.yml": ["kind:bug", "acceptance"]}) == [ + assert check.drift(manifest, repository, {"form.yml": ["kind:bug", "acceptance"]}, set()) == [ "kind:bug: in labels.json, missing from the repository", "bug: in the repository, missing from labels.json", "status:proposed: repository description differs from labels.json", @@ -84,6 +129,25 @@ def test_drift_reports_missing_extra_changed_and_unlisted_references(): ] +def test_drift_accepts_an_external_label_in_the_repository(): + manifest = [entry("kind:bug")] + repository = [{"name": "kind:bug", "description": "Meaning"}, + {"name": "bot-reviewed", "description": None}] + assert check.drift(manifest, repository, {}, {"bot-reviewed"}) == [] + # Absence is also accepted: an outside app owns whether the label exists. + assert check.drift(manifest, repository[:1], {}, {"bot-reviewed"}) == [] + + +def test_drift_still_rejects_a_template_reference_to_an_external_label(): + manifest = [entry("kind:bug")] + repository = [{"name": "kind:bug", "description": "Meaning"}, + {"name": "bot-reviewed", "description": None}] + assert check.drift(manifest, repository, {"form.yml": ["bot-reviewed"]}, + {"bot-reviewed"}) == [ + "bot-reviewed: referenced by form.yml, missing from labels.json", + ] + + def test_template_and_config_label_forms(tmp_path): templates = tmp_path / ".github/ISSUE_TEMPLATE" templates.mkdir(parents=True) @@ -112,7 +176,8 @@ def test_markdown_template_without_front_matter_fails(tmp_path): def test_main_passes_silently_when_repository_matches(tmp_path, capsys): - assert check.main([write_lines(tmp_path / "labels.jsonl", LIVE)]) == 0 + live = LIVE + [{"name": name, "description": None} for name in sorted(EXTERNAL_NAMES)] + assert check.main([write_lines(tmp_path / "labels.jsonl", live)]) == 0 assert capsys.readouterr().out == "" @@ -127,16 +192,19 @@ def test_main_reports_each_drift_line_and_fails(tmp_path, capsys): assert "labels.json" in out[2] and len(out) == 3 +@pytest.mark.parametrize("filename", ["labels.json", "external-labels.json"]) @pytest.mark.parametrize("bad", ["kind:bug", None]) def test_main_reports_nonobject_entries_and_fails_without_drift( - tmp_path, monkeypatch, capsys, bad): + tmp_path, monkeypatch, capsys, filename, bad): github = tmp_path / ".github" github.mkdir() - (github / "labels.json").write_text(json.dumps([bad]), encoding="utf-8") + for name, entries in [("labels.json", MANIFEST), ("external-labels.json", EXTERNAL)]: + (github / name).write_text(json.dumps([bad] if name == filename else entries), + encoding="utf-8") monkeypatch.setattr(check, "ROOT", tmp_path) # No ISSUE_TEMPLATE directory exists: drift/reference reads must not run after validation fails. assert check.main([write_lines(tmp_path / "labels.jsonl", LIVE)]) == 1 assert capsys.readouterr().out.splitlines() == [ - "label drift: labels.json entry 1: expected an object", + f"label drift: {filename} entry 1: expected an object", check.ADVICE, ] diff --git a/tools/check_labels.py b/tools/check_labels.py index db9c50932..c2dd10ec5 100644 --- a/tools/check_labels.py +++ b/tools/check_labels.py @@ -42,6 +42,33 @@ def manifest_problems(manifest: list[dict]) -> list[str]: return problems +def external_problems(external: list[dict], manifest: list[dict]) -> list[str]: + problems = [] + names = [] + for index, entry in enumerate(external, start=1): + if not isinstance(entry, dict): + problems.append(f"external-labels.json entry {index}: expected an object") + continue + name = entry.get("name") + if set(entry) != {"name", "owner"}: + problems.append(f"{name}: expected exactly name and owner") + continue + # Only a usable name joins the duplicate and overlap comparisons below. + if isinstance(name, str) and name.strip(): + names.append(name) + else: + problems.append(f"{name}: name must be a nonempty string") + if not isinstance(entry["owner"], str) or not entry["owner"].strip(): + problems.append(f"{name}: owner must name the app that applies it") + problems += [f"{name}: listed more than once" + for name in sorted({n for n in names if names.count(n) > 1})] + listed = {e["name"] for e in manifest + if isinstance(e, dict) and isinstance(e.get("name"), str)} + problems += [f"{name}: external labels cannot also be in labels.json" + for name in sorted(set(names) & listed)] + return problems + + def _names(value, source: str) -> list[str]: # GitHub accepts a list of names or one comma-separated string in templates. if value is None: @@ -76,14 +103,14 @@ def referenced_labels(root: Path) -> dict[str, list[str]]: def drift(manifest: list[dict], repository: list[dict], - references: dict[str, list[str]]) -> list[str]: + references: dict[str, list[str]], external: set[str]) -> list[str]: expected = {entry["name"]: entry["description"] for entry in manifest} # The labels API returns null for a label without a description. actual = {label["name"]: label["description"] or "" for label in repository} problems = [f"{name}: in labels.json, missing from the repository" for name in sorted(expected.keys() - actual.keys())] problems += [f"{name}: in the repository, missing from labels.json" - for name in sorted(actual.keys() - expected.keys())] + for name in sorted(actual.keys() - expected.keys() - external)] problems += [f"{name}: repository description differs from labels.json" for name in sorted(expected.keys() & actual.keys()) if expected[name] != actual[name]] @@ -99,11 +126,13 @@ def main(argv: list[str] | None = None) -> int: help="JSON lines holding each repository label's name and description") args = parser.parse_args(argv) manifest = json.loads((ROOT / ".github/labels.json").read_text(encoding="utf-8")) + external = json.loads((ROOT / ".github/external-labels.json").read_text(encoding="utf-8")) repository = [json.loads(line) for line in args.repository_labels.read_text(encoding="utf-8").splitlines() if line.strip()] - problems = manifest_problems(manifest) + problems = manifest_problems(manifest) + external_problems(external, manifest) if not problems: - problems = drift(manifest, repository, referenced_labels(ROOT)) + problems = drift(manifest, repository, referenced_labels(ROOT), + {entry["name"] for entry in external}) # Each printed line starts with "label drift" so a label name cannot form a workflow command. for problem in problems: print(f"label drift: {problem}") From 62b4d5f5fa9ed2bade8a444bb060f563aedb207b Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 17:35:51 +0800 Subject: [PATCH 07/31] docs: have maintainers merge high-risk PRs and settle when bot:stop applies High-risk PRs still need two approvals, one from a human maintainer, but agents no longer approve, merge or queue them: a human maintainer merges each one, because on shared accounts an approval cannot prove a human gave it. Counting approvals returns once agents have their own accounts. Say when bot:stop becomes usable and that an Issue owner's stop comment counts until then. Drop the promise that a stop also halts queued merges: there is no queue yet, and whoever enables one names who removes stopped entries and verifies it. During rollout the accountable owner is the one the Issue records, falling back to the assignee. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 3 ++- AGENTS.md | 2 +- docs/agent-collaboration.md | 17 +++++++++-------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index fcb44d183..a1878640e 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -62,7 +62,8 @@ before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed formal review still requires **Approve** or **Request changes**, except on a high-risk PR (CI, releases, secrets, permissions): there an agent gives its -verdict as a **Comment** and never selects **Approve**. +verdict as a **Comment**, never selects **Approve**, and leaves the merge to a +human maintainer. Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). diff --git a/AGENTS.md b/AGENTS.md index c0ef3288e..85fdda861 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, approve high-risk changes (CI, releases, secrets, permissions) and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR or a high-risk PR, claim work only on an assigned Issue labeled `status:accepted` (the agent acting for the assignee decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues, merge high-risk changes (CI, releases, secrets, permissions) themselves and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, and never approve, merge or queue a high-risk PR, claim work only on an assigned Issue labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 333be9117..9d8b8d072 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,14 +11,15 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's **Approve** for high-risk changes, `bot:stop`, and repository permission and ruleset controls. -- The Issue's assignee is its accountable owner. Each Issue has one deciding agent: the formal agent working for the assignee's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. -- An Issue without an assignee is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it is assigned. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's own merge of high-risk changes, `bot:stop`, and repository permission and ruleset controls. +- The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. +- An Issue with no accountable owner is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it has one. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. -- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge. Each such decision is recorded on the Issue or PR with its reason. -- Humans do three things: open Issues that set direction, approve high-risk changes, and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs, their queued merges and any work delegated under it. Right before each push, review, merge or merge-queue entry, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. -- High-risk changes need an **Approve** from a human maintainer as one of the two approvals: CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). Agents only comment on high-risk PRs (**Comment**); they never **Approve** them. +- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge everything except high-risk PRs. Each such decision is recorded on the Issue or PR with its reason. +- Humans do three things: open Issues that set direction, merge high-risk changes, and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. Right before each push, review or merge, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges; until the label exists, an Issue owner's comment on the Issue or PR asking agents to stop has the same effect. +- There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two approvals, at least one from a human maintainer. Agents only comment on high-risk PRs (**Comment**); they never **Approve**, merge or queue them. A human maintainer merges each high-risk PR personally: while agents share accounts with humans, an approval cannot prove it came from a human, so that merge is the proof. Once agents have their own accounts, this goes back to counting the approvals. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Separate agent accounts are proposed, not yet a rule: the proposal on [#570](https://github.com/InferMatrixLab/InferRSI/issues/570) pilots one with Dong-bot first. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -255,10 +256,10 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `bot:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, queued merges and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs and delegated work; removing lets them resume; it applies at any status and overrides the rows above | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | -Status labels carry the governance above. Work starts only on an assigned Issue at +Status labels carry the governance above. Work starts only on an Issue with an accountable owner at `status:accepted`. After that, discussion within the direction goes on: the deciding agent settles it and records the reason on the Issue. Changing the direction goes back to the Issue owner, who may return the Issue to `status:proposed` while the new question is open. From d258ef08d3aa8b96a12d808b4e1128b1f4e39418 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 18:04:56 +0800 Subject: [PATCH 08/31] docs: keep comment stop requests in effect until lifted or moved to bot:stop A human's stop comment on an Issue or PR no longer expires once the bot:stop label exists: it holds until a human lifts it there or bot:stop is added to the same object, and every pre-push, review and merge recheck looks for both. A final stop check before queueing becomes part of enabling a merge queue. AGENTS.md now names the recorded owner, with the assignee as fallback, instead of an assigned Issue. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- AGENTS.md | 2 +- docs/agent-collaboration.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 85fdda861..04aaa34f0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, merge high-risk changes (CI, releases, secrets, permissions) themselves and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, and never approve, merge or queue a high-risk PR, claim work only on an assigned Issue labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues, merge high-risk changes (CI, releases, secrets, permissions) themselves and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, and never approve, merge or queue a high-risk PR, claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 9d8b8d072..47f9ded0f 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -17,8 +17,8 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge everything except high-risk PRs. Each such decision is recorded on the Issue or PR with its reason. -- Humans do three things: open Issues that set direction, merge high-risk changes, and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. Right before each push, review or merge, an agent checks the label on the PR and its governing Issue; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges; until the label exists, an Issue owner's comment on the Issue or PR asking agents to stop has the same effect. -- There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path. +- Humans do three things: open Issues that set direction, merge high-risk changes, and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. - High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two approvals, at least one from a human maintainer. Agents only comment on high-risk PRs (**Comment**); they never **Approve**, merge or queue them. A human maintainer merges each high-risk PR personally: while agents share accounts with humans, an approval cannot prove it came from a human, so that merge is the proof. Once agents have their own accounts, this goes back to counting the approvals. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Separate agent accounts are proposed, not yet a rule: the proposal on [#570](https://github.com/InferMatrixLab/InferRSI/issues/570) pilots one with Dong-bot first. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. From f1e546c35f581bbfed09a28c3b8f081c0a3e422a Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 18:16:16 +0800 Subject: [PATCH 09/31] docs: count maintainer-account approvals on high-risk PRs and track them after the fact Apply the policy change recorded on #570: high-risk PRs still need two independent approvals with at least one from a maintainer account, whose agent may give it; the approval and the merge carry identity lines for later audit, and misuse is reverted, recorded and tightened after the fact. Withdraw the human-maintainer Approve and personal-merge rules and the separate-account pilot proposal. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 7 +++---- AGENTS.md | 2 +- docs/agent-collaboration.md | 10 +++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index a1878640e..600815435 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -60,10 +60,9 @@ with **PR review verdict — DO NOT PASS** and state what must change or be veri before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed -formal review still requires **Approve** or **Request changes**, except on a -high-risk PR (CI, releases, secrets, permissions): there an agent gives its -verdict as a **Comment**, never selects **Approve**, and leaves the merge to a -human maintainer. +formal review still requires **Approve** or **Request changes**, also on a +high-risk PR (CI, releases, secrets, permissions); there an **Approve** from a +maintainer account, including its agent, counts as the maintainer approval. Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). diff --git a/AGENTS.md b/AGENTS.md index 04aaa34f0..d525fce60 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues, merge high-risk changes (CI, releases, secrets, permissions) themselves and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, and never approve, merge or queue a high-risk PR, claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from a maintainer account (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 47f9ded0f..289b0c308 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,16 +11,16 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, a human maintainer's own merge of high-risk changes, `bot:stop`, and repository permission and ruleset controls. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one maintainer-account approval on high-risk changes, `bot:stop`, and repository permission and ruleset controls. - The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. - An Issue with no accountable owner is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it has one. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. -- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge everything except high-risk PRs. Each such decision is recorded on the Issue or PR with its reason. -- Humans do three things: open Issues that set direction, merge high-risk changes, and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. +- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two approvals, at least one from a human maintainer. Agents only comment on high-risk PRs (**Comment**); they never **Approve**, merge or queue them. A human maintainer merges each high-risk PR personally: while agents share accounts with humans, an approval cannot prove it came from a human, so that merge is the proof. Once agents have their own accounts, this goes back to counting the approvals. -- Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Separate agent accounts are proposed, not yet a rule: the proposal on [#570](https://github.com/InferMatrixLab/InferRSI/issues/570) pilots one with Dong-bot first. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. +- Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles From b711b80d874e594ebd1ce16895d0954dbb6f1b73 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 18:21:47 +0800 Subject: [PATCH 10/31] docs: list the audit fields for high-risk merges and record recovery for irreversible effects Per the #570 policy change, the high-risk merge comment lists the reviewed head, the approving accounts with review links, and the merge SHA and account; maintainer authority is the repository permission at merge time. Changes whose external effects a revert cannot undo state the recovery owner and containment steps on the PR beforehand. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 289b0c308..b77077d62 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -19,7 +19,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. That merge comment lists, in one line, the reviewed head, the two approving accounts with their review links, and the merge SHA and merging account; maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the PR states in one line, before the change takes effect, who owns recovery and the containment steps. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles From f0fd360c38c43a86d8ef7130ff68e843c9795a7a Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 18:24:37 +0800 Subject: [PATCH 11/31] docs: make the audit and recovery lines agent-written fixed fields and count outside authors' votes The merging agent writes a fixed merge-audit line at merge time, and the author or its agent writes a fixed recovery line in the PR body when a revert cannot undo an external effect; reviewer agents request it when missing, with no new approval gate. A maintainer account is one with write access when it acts; for an outside author both approvals come from maintainer accounts. No step waits on a human, so a bot pipeline can check these rules later. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index b77077d62..cdafe5732 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -19,7 +19,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. That merge comment lists, in one line, the reviewed head, the two approving accounts with their review links, and the merge SHA and merging account; maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the PR states in one line, before the change takes effect, who owns recovery and the containment steps. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ merge= by=@`. Maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -93,7 +93,12 @@ the blockers and the expected corrections or evidence. An eligible approval comes from an independent reviewer using a GitHub account with repository write access or higher; an agent's **Approve** is a formal -approval and counts toward the two. The authoring agent never approves its own +approval and counts toward the two. Such an account is a maintainer account, +judged by its repository permission when it acts; its human or its agent may +approve through it. When the author is not a maintainer, as for an outside +contributor, both approvals come from maintainer accounts; neither the author's own +approval nor one from an account without write access counts. High-risk PRs +follow the same rule. The authoring agent never approves its own PR, and at least one approval comes from a different agent or a human. The PR author, material contributors, and the accountable parent for the delivery slice cannot supply an independent From df56e5a74cef66ad8c6a27c1f579a8b87e60e26c Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 18:37:20 +0800 Subject: [PATCH 12/31] docs: record the maintainer approver in the merge-audit line The merge-audit line now names the approving account that held repository write permission at merge time, so an audit can tell which approval carried maintainer authority. Agent-assisted-by: DSH / deepseek-v4.1-flash (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index cdafe5732..f64e89df5 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -19,7 +19,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ merge= by=@`. Maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ maintainer=@ merge= by=@`. `maintainer=` names the approving account that held repository write permission at merge time; maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles From 420094cc4caf99fc1318ee1f7ed1ad544dd76e37 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 18:51:04 +0800 Subject: [PATCH 13/31] docs: check stop comments in review-pr and say who lifts a stop The review skill now checks unlifted human stop comments as well as the label and does not submit when it cannot tell, matching the guide, so this PR is consistent if it merges before the skills PR. The guide says only the human who posted a stop or a maintainer account may lift or migrate it, recorded by a comment on the same Issue or PR, and that a stop stays in effect when the evidence is unclear. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 5 ++++- docs/agent-collaboration.md | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 600815435..62b25dcab 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -69,7 +69,10 @@ Agents may submit formal reviews without a separate human delegation; see Submit one only from an eligible independent account, and only as that account's formal reviewer agent; other agents under the account report in comments. Never submit one on your own PR, -and not while the PR or its governing Issue carries `bot:stop`. Before +and not while the PR or its governing Issue carries `bot:stop` or has a +human's stop comment that has not been lifted there (see the +[stop rule](../../../docs/agent-collaboration.md#identity-and-authority)). +If you cannot tell whether a stop is present, do not submit. Before submitting, confirm that the PR is open and the reviewed target, base and head are still current. If the revision changed, reassess the affected diff and evidence before submitting. diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index f64e89df5..ceedec2d7 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -17,7 +17,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. -- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and it stays in effect until a human explicitly lifts it there or `bot:stop` is added to that same Issue or PR; creating the label does not end it. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only the human who posted the stop or a maintainer account may lift it or migrate it to `bot:stop`, and either is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. - High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ maintainer=@ merge= by=@`. `maintainer=` names the approving account that held repository write permission at merge time; maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. From e692781d9136eddfc145ec0c497bd276cb27d855 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 19:09:57 +0800 Subject: [PATCH 14/31] docs: require an Admin-role approval on high-risk PRs At least one of the two high-risk approvals now comes from an account whose repository role is Admin at merge time (its agent may give it); Maintain and Write accounts still count toward the two but not as that one. Write access no longer makes an account a maintainer. The merge-audit line records admin=@ as verified at merge time. Decision: InferMatrixLab/InferRSI#570 (issuecomment-7078247553). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 8 +++++--- AGENTS.md | 2 +- docs/agent-collaboration.md | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 62b25dcab..ae166541b 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -61,8 +61,10 @@ before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed formal review still requires **Approve** or **Request changes**, also on a -high-risk PR (CI, releases, secrets, permissions); there an **Approve** from a -maintainer account, including its agent, counts as the maintainer approval. +high-risk PR (CI, releases, secrets, permissions); there an **Approve** from an +account whose repository role is Admin, including its agent, counts as the +required Admin approval. Write and Maintain approvals count toward the two but +not as that one. Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). @@ -81,7 +83,7 @@ equivalent revision-bound operation. If that operation is unavailable, leave the review prepared. After submitting, verify the recorded state and commit and report the review URL. -Each eligible GitHub account with write access counts once. The +Each eligible GitHub account (Write, Maintain or Admin role) counts once. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when reviewable changes are pushed. The integrator also verifies the `LGTM` bodies, diff --git a/AGENTS.md b/AGENTS.md index d525fce60..2f61c2c0b 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from a maintainer account (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account with the Admin role (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index ceedec2d7..739141518 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,7 +11,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one maintainer-account approval on high-risk changes, `bot:stop`, and repository permission and ruleset controls. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one Admin-account approval on high-risk changes, `bot:stop`, and repository permission and ruleset controls. - The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. - An Issue with no accountable owner is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it has one. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. @@ -19,7 +19,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only the human who posted the stop or a maintainer account may lift it or migrate it to `bot:stop`, and either is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from a maintainer account; that account's agent may give it. This repository is run by bot maintainers: a maintainer account and the agent working for it count as that maintainer, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ maintainer=@ merge= by=@`. `maintainer=` names the approving account that held repository write permission at merge time; maintainer authority is the account's repository permission at merge time, and an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from an account whose repository role is Admin at merge time; that account's agent may give it. Accounts with the Maintain or Write role count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078247553)). This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ admin=@ merge= by=@`. `admin=` names the approving account whose repository role the merging agent verified as Admin at merge time, from the `role_name` GitHub reports for that account's collaborator permission; an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -92,13 +92,14 @@ PASS, submit **Request changes** with the blockers and the expected corrections or evidence. An eligible approval comes from an independent reviewer using a GitHub account -with repository write access or higher; an agent's **Approve** is a formal -approval and counts toward the two. Such an account is a maintainer account, -judged by its repository permission when it acts; its human or its agent may -approve through it. When the author is not a maintainer, as for an outside -contributor, both approvals come from maintainer accounts; neither the author's own -approval nor one from an account without write access counts. High-risk PRs -follow the same rule. The authoring agent never approves its own +with the repository role Write, Maintain or Admin, judged by its role when it +acts; an agent's **Approve** is a formal approval and counts toward the two. The +account's human or its agent may approve through it. When the author has no +write access, as for an outside contributor, neither the author's own approval +nor one from an account without write access counts. High-risk PRs follow the +same rule, and at least one of their two approvals comes from an account whose +role is Admin at merge time; Maintain and Write accounts count toward the two +but not as that one. The authoring agent never approves its own PR, and at least one approval comes from a different agent or a human. The PR author, material contributors, and the accountable parent for the delivery slice cannot supply an independent From 0f81d79a9e3a139247b6f0049a6a4ab3081f2b87 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 20:07:14 +0800 Subject: [PATCH 15/31] docs: take the high-risk approval from a named approver list At least one of the two high-risk approvals now comes from an account on .github/high-risk-approvers.json (david6666666, zengchuang-hw, amy-why-3459, Dong1017, hsliuustc0106) that still has write access at merge time; its agent may give it. Other accounts count toward the two but not as that one. Changing the list is itself a high-risk change. The merge-audit line records approver=@. This replaces the Admin-role rule. Decision: InferMatrixLab/InferRSI#570 (issuecomment-7078872219). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 8 ++++---- .github/high-risk-approvers.json | 7 +++++++ AGENTS.md | 2 +- docs/agent-collaboration.md | 13 +++++++------ 4 files changed, 19 insertions(+), 11 deletions(-) create mode 100644 .github/high-risk-approvers.json diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index ae166541b..3ae376465 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -62,9 +62,9 @@ before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed formal review still requires **Approve** or **Request changes**, also on a high-risk PR (CI, releases, secrets, permissions); there an **Approve** from an -account whose repository role is Admin, including its agent, counts as the -required Admin approval. Write and Maintain approvals count toward the two but -not as that one. +account on the [high-risk approver list](../../../.github/high-risk-approvers.json), +including its agent, counts as the required listed approval. Other approvals +count toward the two but not as that one. Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). @@ -83,7 +83,7 @@ equivalent revision-bound operation. If that operation is unavailable, leave the review prepared. After submitting, verify the recorded state and commit and report the review URL. -Each eligible GitHub account (Write, Maintain or Admin role) counts once. The +Each eligible GitHub account with write access counts once. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when reviewable changes are pushed. The integrator also verifies the `LGTM` bodies, diff --git a/.github/high-risk-approvers.json b/.github/high-risk-approvers.json new file mode 100644 index 000000000..2a16a640d --- /dev/null +++ b/.github/high-risk-approvers.json @@ -0,0 +1,7 @@ +[ + "david6666666", + "zengchuang-hw", + "amy-why-3459", + "Dong1017", + "hsliuustc0106" +] diff --git a/AGENTS.md b/AGENTS.md index 2f61c2c0b..50f09fc24 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account with the Admin role (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 739141518..95dbd1e65 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -11,7 +11,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. -- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one Admin-account approval on high-risk changes, `bot:stop`, and repository permission and ruleset controls. +- Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one approval from the high-risk approver list on high-risk changes, `bot:stop`, and repository permission and ruleset controls. - The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. - An Issue with no accountable owner is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it has one. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. @@ -19,7 +19,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only the human who posted the stop or a maintainer account may lift it or migrate it to `bot:stop`, and either is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets). They still need two independent approvals, at least one from an account whose repository role is Admin at merge time; that account's agent may give it. Accounts with the Maintain or Write role count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078247553)). This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ admin=@ merge= by=@`. `admin=` names the approving account whose repository role the merging agent verified as Admin at merge time, from the `role_name` GitHub reports for that account's collaborator permission; an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -92,14 +92,15 @@ PASS, submit **Request changes** with the blockers and the expected corrections or evidence. An eligible approval comes from an independent reviewer using a GitHub account -with the repository role Write, Maintain or Admin, judged by its role when it +with repository write access or higher, judged by its permission when it acts; an agent's **Approve** is a formal approval and counts toward the two. The account's human or its agent may approve through it. When the author has no write access, as for an outside contributor, neither the author's own approval nor one from an account without write access counts. High-risk PRs follow the -same rule, and at least one of their two approvals comes from an account whose -role is Admin at merge time; Maintain and Write accounts count toward the two -but not as that one. The authoring agent never approves its own +same rule, and at least one of their two approvals comes from an account on the +[high-risk approver list](../.github/high-risk-approvers.json) that still has +write access at merge time; other accounts count toward the two but not as +that one. The authoring agent never approves its own PR, and at least one approval comes from a different agent or a human. The PR author, material contributors, and the accountable parent for the delivery slice cannot supply an independent From 9577a11eb99d02b9d877bd6b227623bb89808a27 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 20:44:57 +0800 Subject: [PATCH 16/31] docs: pin the effective approver list and align who lifts a stop The PR that creates .github/high-risk-approvers.json is approved once against the five accounts recorded in #570 under the existing repository controls. After that only the copy in the protected main commit the merging agent verifies right before the merge counts, never the PR head or a stacked branch, so a list change is judged by the list in effect before it. If the list or the approver's write access cannot be read, the agent does not merge. The merge-audit line gains list=. review-pr points to the same rule. The stop rule, the labels table and the bot:stop description now say the same thing: a human adds the label (or a maintainer account's agent for a human, linking that request), and the human who stopped or a maintainer account, including its agent, lifts it. Review: InferMatrixLab/InferRSI#571 (12:16Z zengchuang-hw, 12:17Z Dong1017). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 4 +++- .github/labels.json | 2 +- docs/agent-collaboration.md | 11 ++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 3ae376465..1bbf6b49e 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -62,7 +62,9 @@ before re-review. Keep optional suggestions separate from the blockers. Use GitHub **Comment** (`COMMENTED`) for non-voting interim feedback. A completed formal review still requires **Approve** or **Request changes**, also on a high-risk PR (CI, releases, secrets, permissions); there an **Approve** from an -account on the [high-risk approver list](../../../.github/high-risk-approvers.json), +account on the [high-risk approver list](../../../.github/high-risk-approvers.json) +as it stands on protected `main` (not the PR head or a stacked branch; see the +[high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority)), including its agent, counts as the required listed approval. Other approvals count toward the two but not as that one. diff --git a/.github/labels.json b/.github/labels.json index cfa63698c..89d27d9d9 100644 --- a/.github/labels.json +++ b/.github/labels.json @@ -2,7 +2,7 @@ { "name": "bot:stop", "group": "bot", - "description": "Human stop switch: agents make no changes, reviews or merges here until a human removes it" + "description": "Human stop switch: agents make no changes, reviews or merges here until the stop is lifted" }, { "name": "area:knowledge", diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 95dbd1e65..32bbbc297 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -17,9 +17,9 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. -- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it; agents then make no further changes, reviews or merges there and resume only after a human removes the label. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only the human who posted the stop or a maintainer account may lift it or migrate it to `bot:stop`, and either is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only the human who stopped the work (by the label or a comment) or a maintainer account, including its agent, may lift a stop (remove the label or lift the comment) or migrate a stop comment to `bot:stop`, and each is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from; an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -98,8 +98,9 @@ account's human or its agent may approve through it. When the author has no write access, as for an outside contributor, neither the author's own approval nor one from an account without write access counts. High-risk PRs follow the same rule, and at least one of their two approvals comes from an account on the -[high-risk approver list](../.github/high-risk-approvers.json) that still has -write access at merge time; other accounts count toward the two but not as +[high-risk approver list](../.github/high-risk-approvers.json), as it stands +on the verified protected `main` commit (see the high-risk rule above), that +still has write access at merge time; other accounts count toward the two but not as that one. The authoring agent never approves its own PR, and at least one approval comes from a different agent or a human. The PR author, material contributors, @@ -263,7 +264,7 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `bot:stop` | only a human adds or removes it | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; the human who stopped or a maintainer account, including its agent, removes it ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs and delegated work; removing lets them resume; it applies at any status and overrides the rows above | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | Status labels carry the governance above. Work starts only on an Issue with an accountable owner at From b448fba067405e4124a85857a92c792c498ee5a3 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Sun, 22 Nov 2026 21:17:58 +0800 Subject: [PATCH 17/31] docs: keep lifting a stop human-only and say what list= records at bootstrap Only a human lifts a stop: the human who stopped the work or a maintainer acting in person, never an agent, including a maintainer account's agent, as decided on #570 and left unchanged by the later amendment. Adding the label for a human or migrating a recorded human stop comment keeps the stop in force and is not lifting it, so a maintainer account's agent may still do either. The labels table row and the bot:stop description say the same. For the one-time bootstrap merge, which has no list on main, merge-audit records list=bootstrap-570 and links the #570 record. Review: InferMatrixLab/InferRSI#571 (12:56Z zengchuang-hw). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/labels.json | 2 +- docs/agent-collaboration.md | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/labels.json b/.github/labels.json index 89d27d9d9..1a39cb42c 100644 --- a/.github/labels.json +++ b/.github/labels.json @@ -2,7 +2,7 @@ { "name": "bot:stop", "group": "bot", - "description": "Human stop switch: agents make no changes, reviews or merges here until the stop is lifted" + "description": "Human stop switch: agents make no changes, reviews or merges here until a human lifts it" }, { "name": "area:knowledge", diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 32bbbc297..1d22fa15c 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -17,9 +17,9 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. -- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only the human who stopped the work (by the label or a comment) or a maintainer account, including its agent, may lift a stop (remove the label or lift the comment) or migrate a stop comment to `bot:stop`, and each is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. -- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from; an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. +- High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from, or `list=bootstrap-570` for the one-time bootstrap merge, whose comment links the [#570 record](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219); an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. ## Roles @@ -264,7 +264,7 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; the human who stopped or a maintainer account, including its agent, removes it ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; only a human removes it (the human who stopped or a maintainer), never an agent ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs and delegated work; removing lets them resume; it applies at any status and overrides the rows above | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | Status labels carry the governance above. Work starts only on an Issue with an accountable owner at From 71777a0d1fd07bba5ba40e56fa5486babae1f7ca Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 09:32:35 +0800 Subject: [PATCH 18/31] docs: let a cursor[bot] approval count as one vote on non-high-risk PRs A bot reviewer went offline for budget limits, which left PRs waiting for a second approval from an account with write access. On a PR that is not high-risk, a cursor[bot] Approve on the current head now counts as one of the two approvals; the other still comes from an account with write access. A cursor[bot] Request changes is still a blocker. High-risk PRs keep both approvals from eligible accounts with write access and the listed approver. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 6 +++++- AGENTS.md | 2 +- docs/agent-collaboration.md | 8 +++++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 1bbf6b49e..ec59e5c27 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -85,7 +85,11 @@ equivalent revision-bound operation. If that operation is unavailable, leave the review prepared. After submitting, verify the recorded state and commit and report the review URL. -Each eligible GitHub account with write access counts once. The +Each eligible GitHub account with write access counts once. On a PR that is +not high-risk, a `cursor[bot]` **Approve** on the current head also counts as one +of the two, and the other comes from an account with write access; its +**Request changes** is still a blocker. High-risk PRs get no such exception; see +[eligible approvals](../../../docs/agent-collaboration.md#pr-review-and-merge). The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when reviewable changes are pushed. The integrator also verifies the `LGTM` bodies, diff --git a/AGENTS.md b/AGENTS.md index 50f09fc24..a1ed4d854 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, count a `cursor[bot]` Approve on the current head as at most one of the two approvals and only on a PR that is not high-risk, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 1d22fa15c..a9cde1a79 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -96,7 +96,13 @@ with repository write access or higher, judged by its permission when it acts; an agent's **Approve** is a formal approval and counts toward the two. The account's human or its agent may approve through it. When the author has no write access, as for an outside contributor, neither the author's own approval -nor one from an account without write access counts. High-risk PRs follow the +nor one from an account without write access counts. One exception: on a PR +that is not high-risk, an **Approve** from `cursor[bot]` on the current head +commit counts as one of the two approvals although it has no write access; the +other approval still comes from an eligible account with write access, its human +or its agent. A **Request changes** from `cursor[bot]` is still a blocker to +resolve like any other ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570)). +High-risk PRs get no such exception: they follow the same rule, and at least one of their two approvals comes from an account on the [high-risk approver list](../.github/high-risk-approvers.json), as it stands on the verified protected `main` commit (see the high-risk rule above), that From bdef0f15ded16d84a12dd6b20ef712d32b1482c6 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 09:56:48 +0800 Subject: [PATCH 19/31] docs: add Bounty-hunter to the high-risk approver list Record the addition requested for the high-risk approver list. Write access for the account is being arranged separately with a repository admin; the list only accepts an approver that still has write access at merge time. Agent-assisted-by: bothouse / jingyu (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/high-risk-approvers.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/high-risk-approvers.json b/.github/high-risk-approvers.json index 2a16a640d..3ad4c6777 100644 --- a/.github/high-risk-approvers.json +++ b/.github/high-risk-approvers.json @@ -3,5 +3,6 @@ "zengchuang-hw", "amy-why-3459", "Dong1017", - "hsliuustc0106" + "hsliuustc0106", + "Bounty-hunter" ] From da07c312d3d5fa2b5d19f8ce224e8cee7f825425 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:00:31 +0800 Subject: [PATCH 20/31] docs: give each issue one parent and its own completion condition Linked task issues listed each other as remaining work and stayed open until a shared acceptance, so none could close on its own. Add a working rule: at most one parent attached as a GitHub sub-issue, one-way acyclic dependencies, only the parent lists children and holds joint acceptance, and each child names the PR(s) or check that completes it. The scoped task template now asks for the parent and that completion condition. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/ISSUE_TEMPLATE/scoped-task.md | 3 ++- docs/agent-collaboration.md | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/scoped-task.md b/.github/ISSUE_TEMPLATE/scoped-task.md index 11cfdcb44..6f76745c1 100644 --- a/.github/ISSUE_TEMPLATE/scoped-task.md +++ b/.github/ISSUE_TEMPLATE/scoped-task.md @@ -23,11 +23,12 @@ Conventions: docs/agent-collaboration.md --> - **Problem / desired outcome:** -- **Completion criteria:** +- **Completion criteria (the PR(s) to merge or check to pass; not another Issue's closure):** ## Scope and constraints - **In scope / out of scope:** +- **Parent Issue (one; attach this Issue as its sub-issue):** - **Relevant dependencies, shared interfaces or limits (if any):** ## Ownership and authorization diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index a9cde1a79..4f47e8654 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -176,6 +176,7 @@ sequenceDiagram 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use non-closing `Refs #N` until closure is authorized. GitHub treats a closing keyword followed by an Issue reference as closing syntax even inside a negated sentence, so never write one in PR text; for an authorized closure, put `Closes #N` alone on its own line. The ready lane's `pr-references` job reports any other use. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. Before an authorized closure, publish a closure summary card ([closure summaries](#closure-summaries)). 7. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. 8. **Comments:** agent comments start with a one-line conclusion; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. +9. **Dependencies:** give each Issue at most one parent and attach it as a GitHub sub-issue of that parent. Dependencies point one way, from child to parent, and never form a cycle. Only the parent lists its children and holds any acceptance shared by several of them, such as a joint run on the integrated main. Each child states its own completion condition: the PR(s) whose merge, or the check whose result, completes it. A child never stays open until a sibling or the parent closes. Ordering between PRs belongs on those PRs or once in the parent, not in sibling Issues' closing conditions. ## Closure summaries From dffc77347702fa51d58c582a6f7efcdaa4d2bbd7 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 10:04:50 +0800 Subject: [PATCH 21/31] docs: keep cursor[bot] reviews advisory and out of the two approvals This reverts the cursor[bot] exception from 71777a0d1. The main ruleset counts only approvals from reviewers with write access, so a cursor[bot] Approve cannot be one of the two. Its reviews stay advisory; the ruleset does not block on its Request changes, but under these rules it is still answered before merge. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 6 +----- AGENTS.md | 2 +- docs/agent-collaboration.md | 11 ++++------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index ec59e5c27..1bbf6b49e 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -85,11 +85,7 @@ equivalent revision-bound operation. If that operation is unavailable, leave the review prepared. After submitting, verify the recorded state and commit and report the review URL. -Each eligible GitHub account with write access counts once. On a PR that is -not high-risk, a `cursor[bot]` **Approve** on the current head also counts as one -of the two, and the other comes from an account with write access; its -**Request changes** is still a blocker. High-risk PRs get no such exception; see -[eligible approvals](../../../docs/agent-collaboration.md#pr-review-and-merge). The +Each eligible GitHub account with write access counts once. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when reviewable changes are pushed. The integrator also verifies the `LGTM` bodies, diff --git a/AGENTS.md b/AGENTS.md index a1ed4d854..50f09fc24 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, count a `cursor[bot]` Approve on the current head as at most one of the two approvals and only on a PR that is not high-risk, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 4f47e8654..2a2e48fe7 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -96,13 +96,10 @@ with repository write access or higher, judged by its permission when it acts; an agent's **Approve** is a formal approval and counts toward the two. The account's human or its agent may approve through it. When the author has no write access, as for an outside contributor, neither the author's own approval -nor one from an account without write access counts. One exception: on a PR -that is not high-risk, an **Approve** from `cursor[bot]` on the current head -commit counts as one of the two approvals although it has no write access; the -other approval still comes from an eligible account with write access, its human -or its agent. A **Request changes** from `cursor[bot]` is still a blocker to -resolve like any other ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570)). -High-risk PRs get no such exception: they follow the +nor one from an account without write access counts. Reviews from +`cursor[bot]` are advisory and do not count toward the two. The ruleset does +not block on its **Request changes**, but under these rules it is still +answered before merge. High-risk PRs follow the same rule, and at least one of their two approvals comes from an account on the [high-risk approver list](../.github/high-risk-approvers.json), as it stands on the verified protected `main` commit (see the high-risk rule above), that From 6dc2bcaf8e722dd4ca23a363d9fd5c9e16651a9a Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:31:29 +0800 Subject: [PATCH 22/31] docs: add linyueqian to the high-risk approver list Record the addition requested for the high-risk approver list. The account has repository write access today; the list still only accepts an approver that has write access at merge time. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/high-risk-approvers.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/high-risk-approvers.json b/.github/high-risk-approvers.json index 3ad4c6777..12a5ca5f7 100644 --- a/.github/high-risk-approvers.json +++ b/.github/high-risk-approvers.json @@ -4,5 +4,6 @@ "amy-why-3459", "Dong1017", "hsliuustc0106", - "Bounty-hunter" + "Bounty-hunter", + "linyueqian" ] From cbfef1d140050e801834e12b4d092154d1c3a1b4 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 11:42:07 +0800 Subject: [PATCH 23/31] Revert "docs: give each issue one parent and its own completion condition" This reverts commit da07c312d3d5fa2b5d19f8ce224e8cee7f825425. The issue parent, dependency and completion rule was not settled in #570 and does not belong in this PR. It moves to its own PR from main, where the scoped task template also says a standalone task may leave the parent blank. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .github/ISSUE_TEMPLATE/scoped-task.md | 3 +-- docs/agent-collaboration.md | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/scoped-task.md b/.github/ISSUE_TEMPLATE/scoped-task.md index 6f76745c1..11cfdcb44 100644 --- a/.github/ISSUE_TEMPLATE/scoped-task.md +++ b/.github/ISSUE_TEMPLATE/scoped-task.md @@ -23,12 +23,11 @@ Conventions: docs/agent-collaboration.md --> - **Problem / desired outcome:** -- **Completion criteria (the PR(s) to merge or check to pass; not another Issue's closure):** +- **Completion criteria:** ## Scope and constraints - **In scope / out of scope:** -- **Parent Issue (one; attach this Issue as its sub-issue):** - **Relevant dependencies, shared interfaces or limits (if any):** ## Ownership and authorization diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 2a2e48fe7..864fef85c 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -173,7 +173,6 @@ sequenceDiagram 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use non-closing `Refs #N` until closure is authorized. GitHub treats a closing keyword followed by an Issue reference as closing syntax even inside a negated sentence, so never write one in PR text; for an authorized closure, put `Closes #N` alone on its own line. The ready lane's `pr-references` job reports any other use. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. Before an authorized closure, publish a closure summary card ([closure summaries](#closure-summaries)). 7. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. 8. **Comments:** agent comments start with a one-line conclusion; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. -9. **Dependencies:** give each Issue at most one parent and attach it as a GitHub sub-issue of that parent. Dependencies point one way, from child to parent, and never form a cycle. Only the parent lists its children and holds any acceptance shared by several of them, such as a joint run on the integrated main. Each child states its own completion condition: the PR(s) whose merge, or the check whose result, completes it. A child never stays open until a sibling or the parent closes. Ordering between PRs belongs on those PRs or once in the parent, not in sibling Issues' closing conditions. ## Closure summaries From 98ae71ae3b59f6674868b2b613895e620575891c Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 13:05:05 +0800 Subject: [PATCH 24/31] docs: fall back to the assignee as owner only when exactly one is set GitHub Issues can have several assignees, and the rollout fallback did not say which of them owns scope changes and exceptions. Use the assignee as accountable owner only when exactly one is set; with several (or none) and no recorded owner, the Issue has no accountable owner until one is recorded explicitly. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- AGENTS.md | 2 +- docs/agent-collaboration.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 50f09fc24..e6d5b087f 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its only assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 864fef85c..527479311 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -12,7 +12,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans and agents may propose Issues. Proposal origin, assignment and labels do not grant authority. - A GitHub account may represent a human and their authorized agent team. Assignment identifies accountability, not necessarily the executor. Record the acting person/agent and role when relevant; retain unknown identity rather than guessing. - Work follows accepted scope and explicit or standing delegation. Record or link that authority. Within the Issue's direction, the accountable agent decides scope, including material scope changes, and exceptions, and records each with its reason on the Issue; a human may override any such decision. Only a change of the Issue's direction goes back to the Issue owner. No agent may waive these controls: independent review with two approvals, at least one approval from the high-risk approver list on high-risk changes, `bot:stop`, and repository permission and ruleset controls. -- The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. +- The Issue's accountable owner is the one the Issue records explicitly; while this rule rolls out, an Issue without such a record falls back to its assignee only when exactly one assignee is set. With several assignees, or none, and no recorded owner, the Issue has no accountable owner until one is recorded explicitly. Each Issue has one deciding agent: the formal agent working for the accountable owner's account. When one account carries several agents, only that account's one formal agent decides, as with review votes. Other agents propose on the Issue and do not decide. - An Issue with no accountable owner is not started. Agents may propose on it and ask a maintainer to assign it; they do not claim or implement it until it has one. - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. From a4f6733816a56332fe696c6ec226d25199ed0486 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 15:39:15 +0800 Subject: [PATCH 25/31] docs: recheck GitHub's merge state for an advisory Request changes A cursor[bot] review is advisory under these rules, but GitHub can still report the PR as blocked by its Request changes (as on #441). Instead of saying the ruleset never blocks on it, recheck GitHub's merge state on the current head before merging; if the advisory review still blocks, clear it the way a blocking Request changes is cleared and record who dismissed it and the disposition of each point. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 527479311..468865b1c 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -97,9 +97,13 @@ acts; an agent's **Approve** is a formal approval and counts toward the two. The account's human or its agent may approve through it. When the author has no write access, as for an outside contributor, neither the author's own approval nor one from an account without write access counts. Reviews from -`cursor[bot]` are advisory and do not count toward the two. The ruleset does -not block on its **Request changes**, but under these rules it is still -answered before merge. High-risk PRs follow the +`cursor[bot]` are advisory under these rules and do not count toward the +two; its **Request changes** is still answered before merge. GitHub may +nonetheless report the PR as blocked by that review, so recheck GitHub's +merge state on the current head before merging. If the advisory review still +blocks, it is cleared as described below for a blocking **Request changes** +review, and the PR records who dismissed it and the disposition of each point +(fixed in a named commit, or declined with the reason). High-risk PRs follow the same rule, and at least one of their two approvals comes from an account on the [high-risk approver list](../.github/high-risk-approvers.json), as it stands on the verified protected `main` commit (see the high-risk rule above), that From ebf9e77d35af5bba11f44c36a88e46aa66bd2c08 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 17:09:28 +0800 Subject: [PATCH 26/31] docs: check a stop on every ancestor Issue before acting A stop on a parent Issue covers its sub-issues and their PRs, so the action-time check now walks each linked Issue's sub-issue parent chain. If any Issue in that chain cannot be read, the agent treats the work as stopped and records the unreadable Issue on the PR. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 83ae187c2..df465b2fa 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -17,7 +17,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. -- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops its linked PRs and any work delegated under it. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR and its governing Issue for the label and for any stop comment not yet lifted this way; if it cannot tell whether a stop is present, it does not act. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops its linked PRs and any work delegated under it, including its sub-issues at any depth and their PRs. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR, each Issue it links and every ancestor of those Issues (following each Issue's sub-issue parent up to the top) for the label and for any stop comment not yet lifted this way. If any Issue in that chain cannot be read (for example a permission or API failure), or it cannot tell whether a stop is present, it treats the work as stopped, does not act, and records on the PR which Issue it could not check. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. - High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from, or `list=bootstrap-570` for the one-time bootstrap merge, whose comment links the [#570 record](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219); an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. @@ -309,7 +309,7 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; only a human removes it (the human who stopped or a maintainer), never an agent ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; only a human removes it (the human who stopped or a maintainer), never an agent ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, its sub-issues at any depth and their PRs, and delegated work; removing lets them resume; it applies at any status and overrides the rows above | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | Status labels carry the governance above. Work starts only on an Issue with an accountable owner at From a812a8896894ceb8b04b6e3dfe708001e4528aa2 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 17:53:54 +0800 Subject: [PATCH 27/31] docs: limit the stop check to the governing chain and its real ancestors The stop check now covers the PR, the Issues that govern or delegated the work (the PR body's Refs/Closes scope source, or where the work was delegated) and their sub-issue ancestors. An Issue linked only as background is outside the chain, so it neither stops the work nor has to be readable, while an unreadable Issue inside the chain still stops it. Two examples state the expected outcome. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index df465b2fa..ae0f2ecf4 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -17,7 +17,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Routine PR review and integration may be delegated without fresh human approval per PR. Existing repository permissions and acceptance policies still apply. - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. -- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops its linked PRs and any work delegated under it, including its sub-issues at any depth and their PRs. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent checks the PR, each Issue it links and every ancestor of those Issues (following each Issue's sub-issue parent up to the top) for the label and for any stop comment not yet lifted this way. If any Issue in that chain cannot be read (for example a permission or API failure), or it cannot tell whether a stop is present, it treats the work as stopped, does not act, and records on the PR which Issue it could not check. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. +- Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops the PRs it governs and any work delegated under it, including its sub-issues at any depth and their PRs. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent runs the stop check: it checks the work's stop chain for the label and for any stop comment not yet lifted this way. The stop chain is the PR, the Issues that govern or delegated the work, and every real ancestor of those Issues (following each Issue's sub-issue parent up to the top). A governing Issue is one the PR body references with `Refs #N` or `Closes #N` as the source of this work's scope, and a delegating Issue is one on which the work was delegated to the acting agent; an Issue linked only as background or related reading is not in the chain. If any Issue in the chain cannot be read (for example a permission or API failure), or the agent cannot tell whether a stop is present, it treats the work as stopped, does not act, and records on the PR which Issue it could not check; an Issue outside the chain neither stops the work nor needs to be readable. For example, a PR that refs sub-issue B waits while B's parent A carries `bot:stop`; a PR that refs B and also links an older Issue C as background, which the agent cannot read, is not stopped because of C. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. - High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from, or `list=bootstrap-570` for the one-time bootstrap merge, whose comment links the [#570 record](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219); an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. @@ -309,7 +309,7 @@ lists every repository label with its group and description, and every name has | Status | `status:accepted` or `status:deferred`, replacing `status:proposed` | the acting agent | only after the decision owner records that decision in a comment; at `status:accepted` the direction is settled and assigned work may start; at `status:deferred` no work starts | | Priority | at most one `priority:P0/P1/P2`, only with `status:proposed` or `status:accepted` | the acting agent; the decision owner may change it | with `status:proposed`, how soon the owner should decide; with `status:accepted`, how soon work should start; removed at `status:deferred` | | Help | `help:wanted` | the creator or a maintainer | an Issue needs an owner or contributor | -| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; only a human removes it (the human who stopped or a maintainer), never an agent ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also its linked PRs, its sub-issues at any depth and their PRs, and delegated work; removing lets them resume; it applies at any status and overrides the rows above | +| Stop switch | `bot:stop` | a human adds it, or a maintainer account's agent for a human; only a human removes it (the human who stopped or a maintainer), never an agent ([stop rule](#identity-and-authority)) | adding stops agent changes, reviews and merges on that Issue or PR, and on an Issue also the PRs it governs, its sub-issues at any depth and their PRs, and delegated work (the [stop check](#identity-and-authority) covers only this chain, not background links); removing lets them resume; it applies at any status and overrides the rows above | | Protected switch | `skill-eval:execute` | only the owner adds it; the owner or an agent may remove it | adding authorizes paid Skill Eval for one PR; removing revokes it | Status labels carry the governance above. Work starts only on an Issue with an accountable owner at From cb6bbd8297e689fd298a8beaec86a33b3c4e108b Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 19:20:34 +0800 Subject: [PATCH 28/31] docs: count formal Approve reviews and use the guide's stop check in review-pr Align with #440 and the open #607: the two approvals are formal GitHub Approve reviews from distinct eligible accounts on the current head; the review body's wording, including LGTM, no longer counts. The identity line now starts every comment and review. The independent-approvals observer section says it is advisory, not an approval count, and is removed by #607. review-pr now applies the guide's full stop check instead of naming only the PR and its governing Issue. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/review-pr/SKILL.md | 22 ++++++------ AGENTS.md | 2 +- docs/agent-collaboration.md | 57 +++++++------------------------ 3 files changed, 24 insertions(+), 57 deletions(-) diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 1bbf6b49e..3111781ab 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -8,8 +8,7 @@ description: Independently review a pull request targeting InferMatrixLab/InferR Use the [review eligibility and merge rules](../../../docs/agent-collaboration.md#pr-review-and-merge) and the [contribution evidence rules](../../../docs/contributing.md). Start every comment and review with one line naming the acting agent and the human -it acts for, for example `, acting for @.`; an **Approve** -keeps `LGTM` on its first non-empty line and puts that line next. If you +it acts for, for example `, acting for @.`. If you authored or materially contributed to the change or were its accountable parent, label your assessment as a self-check and hand the formal review to an independent reviewer. @@ -42,12 +41,11 @@ by the reviewed base and head and the supporting evidence. ### Formal GitHub review -For PASS, select **Approve**. Write `LGTM` alone on the first non-empty line of -that review body, followed by the verdict and evidence. Match the exact, -case-sensitive token `LGTM`. For example: +For PASS, select **Approve** and record the reviewed revision and evidence. +GitHub counts the submitted review state regardless of the review body's wording. +Example review body: ```text -LGTM , acting for @. PR review verdict — PASS @@ -73,10 +71,10 @@ Agents may submit formal reviews without a separate human delegation; see Submit one only from an eligible independent account, and only as that account's formal reviewer agent; other agents under the account report in comments. Never submit one on your own PR, -and not while the PR or its governing Issue carries `bot:stop` or has a -human's stop comment that has not been lifted there (see the -[stop rule](../../../docs/agent-collaboration.md#identity-and-authority)). -If you cannot tell whether a stop is present, do not submit. Before +and not while the guide's +[stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds a stop on the PR's stop +chain or cannot rule one out; in that case do not submit, and record on the PR +which Issue you could not check. Before submitting, confirm that the PR is open and the reviewed target, base and head are still current. If the revision changed, reassess the affected diff and evidence before submitting. @@ -88,8 +86,8 @@ report the review URL. Each eligible GitHub account with write access counts once. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when -reviewable changes are pushed. The integrator also verifies the `LGTM` bodies, -any blocking reviews and required checks. A PR review verdict applies to the +reviewable changes are pushed. The integrator checks reviewer eligibility, +blocking reviews and required checks. A PR review verdict applies to the reviewed change. Campaign verdicts follow their frozen validators and evidence. The revision, diff and evidence workflow draws on the diff --git a/AGENTS.md b/AGENTS.md index 34a465f06..c5a7ac7df 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -161,7 +161,7 @@ ruff check src tests 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. 4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself on every comment and review (on an Approve, after the `LGTM` line), never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its only assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). +5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself first on every comment and review, never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its only assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 7–8 in [agent collaboration](docs/agent-collaboration.md#working-rules). ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index ae0f2ecf4..cfe3cff32 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -20,7 +20,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops the PRs it governs and any work delegated under it, including its sub-issues at any depth and their PRs. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent runs the stop check: it checks the work's stop chain for the label and for any stop comment not yet lifted this way. The stop chain is the PR, the Issues that govern or delegated the work, and every real ancestor of those Issues (following each Issue's sub-issue parent up to the top). A governing Issue is one the PR body references with `Refs #N` or `Closes #N` as the source of this work's scope, and a delegating Issue is one on which the work was delegated to the acting agent; an Issue linked only as background or related reading is not in the chain. If any Issue in the chain cannot be read (for example a permission or API failure), or the agent cannot tell whether a stop is present, it treats the work as stopped, does not act, and records on the PR which Issue it could not check; an Issue outside the chain neither stops the work nor needs to be readable. For example, a PR that refs sub-issue B waits while B's parent A carries `bot:stop`; a PR that refs B and also links an older Issue C as background, which the agent cannot read, is not stopped because of C. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. - There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. - High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from, or `list=bootstrap-570` for the one-time bootstrap merge, whose comment links the [#570 record](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219); an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. -- Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first, except in an **Approve**, where `LGTM` stays alone on the first non-empty line and the identity line comes next. +- Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first. ## Roles @@ -85,11 +85,11 @@ are recorded by the accountable agent for any human to override. ### PR review and merge For a PR targeting `main`, each completed review gives an explicit **PASS** or -**DO NOT PASS** verdict. For PASS, submit **Approve** with `LGTM` alone on the -first non-empty line of the same review body, followed by the agent's identity -line. Only the exact, case-sensitive spelling `LGTM` qualifies. For DO NOT -PASS, submit **Request changes** with -the blockers and the expected corrections or evidence. +**DO NOT PASS** verdict. For PASS, submit **Approve**. GitHub counts the formal +review even when its body is empty. Conversation comments and **Comment** +reviews contribute zero approvals, including comments that say `LGTM` or `PASS`. +For DO NOT PASS, submit **Request changes** with the blockers and the expected +corrections or evidence. An eligible approval comes from an independent reviewer using a GitHub account with repository write access or higher, judged by its permission when it @@ -120,7 +120,7 @@ identity line names the acting reviewer and the human it acts for. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when reviewable changes are pushed. Before merging, the integrator verifies two -current approvals that meet the eligibility and body rules above, resolution +current approvals from distinct eligible reviewers as described above, resolution of all blocking reviews, and passing required checks. Windows/macOS `host-compatibility` checks are advisory under the @@ -148,43 +148,12 @@ while the required `knowledge-model-policy` check does not run on `merge_group` events. If `main` still turns red after a merge, an agent first reverts the merge that broke it, then fixes forward in a new PR. -### Independent-approval check rollout (not active) - -The proposed `independent-approvals` observer in #440/#441 does not replace the -live native review rule above. Until the separately accepted ruleset cutover, -two native approvals and resolution or authorized dismissal of blocking -Request changes are still required. The review skill continues to describe that -live rule. - -The observer counts GitHub User accounts with current write access, the exact -first non-empty line `LGTM`, and a formal approval on the current head. GitHub -Bot/App actors and unresolved actor types do not count. It excludes the PR author -and linked commit authors/committers; the integrator still checks parent, -material-contributor and delegation independence separately. A later opinionated -vote replaces that account's approval; another reviewer's dissent stays visible. - -Before each merge, re-read current-head reviews and permissions instead of using -an earlier successful status as proof of current eligibility. The observer's -read-only `--pull-request` mode performs fresh reads; inspect its reported count -and state, since exit zero alone only means reconciliation had no API error. - -**Status-source cutover remains blocked.** The current observer uses the shared -GitHub Actions status identity. Another workflow with `statuses: write` can use -that identity too; checking `github-actions[bot]` or the context name does not -authenticate the originating workflow. GitHub documents both [workflow token -permissions](https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#permissions) -and [binding a required check to an expected App](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches#require-status-checks-before-merging). - -Before replacing the native review gate, the owner must record an exclusive -trusted status source, such as a separately permissioned App, and bind the -required check to its identity. Verify on a disposable head that a status written -by a different actor and by another Actions workflow cannot satisfy the gate. -Both negative probes must actually run and fail to satisfy it. Unit tests or a -code-reading claim cannot substitute for that live verification. Keep the native -gate in place if either probe is missing or succeeds. Record the current-head -permission-revocation check, the two-approval/dissent matrix, the merge-box result -and before/after ruleset JSON in #440 before the final cutover. At no point may -both gates be disabled. +### Independent-approval check (advisory, to be removed) + +The `independent-approvals` commit status from #441 is advisory and is not an +approval count; [#607](https://github.com/InferMatrixLab/InferRSI/pull/607) +removes it. Only the formal **Approve** reviews counted under the rules above +and the native ruleset count. ### Agent–Agent: isolated work and conditional handoff From 93f0b1dccdd2680f235ceb78a81da77a73e9df87 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Mon, 23 Nov 2026 21:20:38 +0800 Subject: [PATCH 29/31] =?UTF-8?q?docs:=20fix=20the=20comment=20order=20?= =?UTF-8?q?=E2=80=94=20identity=20line=20first,=20then=20the=20conclusion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Working rule 8 asked comments to start with a one-line conclusion while AGENTS.md and the review-pr example start every comment and review with the acting-agent identity line. State one order: the identity line is the first line, the one-line conclusion the first substantive line after it. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- docs/agent-collaboration.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 376fff2f5..f954f5b6b 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -115,7 +115,9 @@ and the accountable parent for the delivery slice cannot supply an independent approval, including through another agent acting under their account. Each eligible account counts once. An agent may submit a formal review without a separate human delegation; its -identity line names the acting reviewer and the human it acts for. +identity line names the acting reviewer and the human it acts for. The identity +line is the first line of every agent comment and review; the one-line conclusion +(working rule 8) is the first substantive line after it. The [main ruleset](https://github.com/InferMatrixLab/InferRSI/rules/25528020) requires at least two approving reviews and dismisses stale approvals when @@ -176,7 +178,7 @@ sequenceDiagram 5. **Handoff:** only for an actual transfer or accepted decision change, record the delta, recipient and next action. Keep acceptance status/link, communication status and application status separate. "Applied" needs artifact/evidence; otherwise retain pending or unknown. No full conversation traces or new ledger. 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use non-closing `Refs #N` until closure is authorized. GitHub treats a closing keyword followed by an Issue reference as closing syntax even inside a negated sentence, so never write one in PR text; for an authorized closure, put `Closes #N` alone on its own line. The ready lane's `pr-references` job reports any other use. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. Before an authorized closure, publish a closure summary card ([closure summaries](#closure-summaries)). 7. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. -8. **Comments:** agent comments start with a one-line conclusion; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. +8. **Comments:** every agent comment starts with the acting-agent identity line, then a one-line conclusion as the first substantive line; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. ## Closure summaries From dbaad9eedcf68e5fdb963f246352142e7faa764e Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Tue, 24 Nov 2026 07:52:46 +0800 Subject: [PATCH 30/31] docs: add collaboration skills and slim the agent entry page (#572) * docs: add collaboration skills and slim the agent entry page Agents each read the collaboration guide and applied it differently, because review-pr was the only collaboration skill. Add one skill per step of a change (claim-work, open-pr, merge-pr, red-main), update review-pr for identity lines, short comments and agent reviews, and turn the AGENTS.md collaboration part into one-line pointers. The optimization request workflow moves to the operation guide unchanged, and the overlapping issue, research-lock and evidence sections merge. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: check assignee, status and stacked base in the claim and merge skills claim-work now checks that the Issue has an assignee and status:accepted, and that the claimer is the deciding agent or works under its delegation, before claiming. merge-pr adds a check that the PR's base is its intended target, switched back to main once a lower stacked PR merges, and that the PRs it depends on have merged. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: use bot:stop and complete the merge-pr preconditions Rename agent:stop to bot:stop in the skills and the entry page. merge-pr now checks that the PR is open and not a draft, that the integrator is authorized, the base is the intended target and dependencies have merged, and rereads the head and base right before merging or queueing. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: leave high-risk merges to maintainers and recheck base and approvals in merge-pr The merge skill now reports a high-risk PR as needing a human maintainer to merge and never as merge-ready, matching the collaboration guide. Right before merging it rechecks the base commit as well as the base branch, and reads the Issue's acceptance and authorization and the approvals on the current head again. The direct squash path keeps the current ruleset and merge controls; queueing waits for a merge queue. Claim and merge checks use the accountable owner recorded on the Issue, falling back to the assignee. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: honor unlifted stop comments in the claim, review and merge skills The skills now treat a human's stop comment on the PR or its governing Issue like bot:stop until a human lifts it or adds the label there, and merge-pr rechecks both right before merging, matching the guide. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: let maintainer accounts approve and agents merge high-risk PRs in the skills Follow the #570 policy change: review-pr lets a maintainer account, including its agent, give the maintainer approval on a high-risk PR, and merge-pr check 9 now only requires at least one approval from a maintainer account before the normal flow. AGENTS.md drops the human-merge wording. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: list the audit fields in the merge-pr record for high-risk PRs The merge record comment on a high-risk PR lists the reviewed head, the approving accounts with review links, and the merge SHA and merging account, matching the guide. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: have the skills write the fixed merge-audit and recovery lines and count outside authors' votes merge-pr writes the merge-audit line itself right after a high-risk merge and, for an author without write access, counts only maintainer-account approvals; open-pr adds the recovery line when a revert cannot undo an external effect, and review-pr requests it when missing. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: record the maintainer approver in the merge-audit line The merge-pr record now has the maintainer field from the guide, naming the approving account that held repository write permission at merge time. Agent-assisted-by: DSH / deepseek-v4.1-flash (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: bind the merge to the checked head and verify recovery in merge-pr merge-pr now squash-merges with the checked head as the expected head (--match-head-commit, or sha on the REST endpoint) and starts over if GitHub refuses it, and its final reread also rechecks open Request changes reviews. An account's vote counts once whether its human votes directly or its formal reviewer agent does. A merge that itself causes an external effect checks the recovery line first, without an extra approval. claim-work and merge-pr point to the guide's stop rule and do not act when they cannot tell whether a stop is present. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: let a maintainer account's agent integrate in merge-pr The integration path no longer says only a human maintainer: you may integrate when you act for a maintainer account. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: require and verify an Admin-role approval in merge-pr On a high-risk PR, merge-pr now needs one approval from an account whose repository role is Admin, checked right before merging with the collaborator permission API (role_name must be admin); Maintain and Write approvals count toward the two but not as that one. The merge-audit line records admin=@. review-pr and AGENTS.md say the same. Decision: InferMatrixLab/InferRSI#570 (issuecomment-7078247553). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: check the high-risk approver list in merge-pr Check 9 now reads .github/high-risk-approvers.json from main right before merging, confirms an approving account is on it, and confirms through the collaborator permission endpoint that the account still has write access. The merge-audit line records approver=@. review-pr and the AGENTS.md merge entry follow the list instead of the Admin role. Decision: InferMatrixLab/InferRSI#570 (issuecomment-7078872219). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: read the approver list at the checked main commit in merge-pr Check 9 now reads .github/high-risk-approvers.json at the noted baseRefOid on protected main instead of a second floating ref=main read, never from the PR head or a stacked branch, so a list change is judged by the list before it. If the list or the permission cannot be read, do not merge. The bootstrap stays in the guide and is linked, not repeated. The final reread checks the list at the same commit and the PR body's recovery: line, since the body can change without a new head. merge-audit gains list=. review-pr points to the same rule. Review: InferMatrixLab/InferRSI#572 (12:18Z Dong1017, 12:19Z zengchuang-hw). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: name the bootstrap list= value in merge-pr The merge-audit list= field is the baseRefOid the list was read from, or list=bootstrap-570 only for the one-time bootstrap merge described in the guide. Review: InferMatrixLab/InferRSI#571 (12:56Z zengchuang-hw). Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: accept a cursor[bot] approval as one vote in merge-pr on non-high-risk PRs Check 5 now accepts a cursor[bot] Approve on the current head as one of the two approvals when check 9 finds the PR is not high-risk; the other still comes from an account with write access, and a cursor[bot] Request changes is still handled as a blocker. On a high-risk PR, or when that cannot be told, it does not count. The AGENTS.md review and merge lines say the same. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: drop the cursor[bot] vote from merge-pr This reverts 8d25b9d2e. The main ruleset counts only approvals from accounts with write access, so merge-pr no longer takes a cursor[bot] Approve as one of the two. Its Request changes is still handled under check 7. Agent-assisted-by: Claude Code / claude-opus-5-5 (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: split binding and advisory Request changes in merge-pr The guide makes cursor[bot] reviews advisory, but check 7 and the final reread still required every Request changes to be turned into Approve or dismissed, so a reasoned answer to an advisory review could never clear it. Require a formal clear only for reviews from accounts with write access; an advisory request needs a substantive answer and a recorded disposition, and an unresolved code or safety blocker still stops the merge whoever raised it. Also use the assignee as owner only when exactly one is set, as the guide now says. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: dismiss an advisory review that GitHub still blocks on in merge-pr Follow the guide: an advisory review such as cursor[bot]'s still needs a substantive answer and a recorded disposition, and if GitHub's merge state still shows the PR blocked by it on the current head, someone the guide allows dismisses it with the reason recorded before merging. The final recheck now includes GitHub's merge state. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: check a stop on every ancestor Issue in the collaboration skills merge-pr, review-pr and claim-work now check the PR, its linked Issues and each Issue's sub-issue parent chain for a stop, and treat an unreadable chain as stopped, matching the stop rule in the collaboration guide. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: use the guide's stop check in the collaboration skills claim-work, review-pr and merge-pr now point to the guide's single stop check and its stop chain (governing or delegating Issues and their real ancestors) instead of each naming its own scope, so a background link no longer blocks a review or merge while a stopped parent still does. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> * docs: count formal Approve reviews in merge-pr, not their body text Align the merge and review entries with #440 and the open #607: two formal Approve reviews from distinct eligible accounts on the current head; the body's wording, including LGTM, is not a counting condition. The other merge checks are unchanged. Agent-assisted-by: bothouse / claude (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --------- Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/claim-work/SKILL.md | 62 ++++++++++++++ .agents/skills/merge-pr/SKILL.md | 125 +++++++++++++++++++++++++++++ .agents/skills/open-pr/SKILL.md | 62 ++++++++++++++ .agents/skills/red-main/SKILL.md | 45 +++++++++++ .agents/skills/review-pr/SKILL.md | 6 ++ AGENTS.md | 75 +++++------------ docs/agent-collaboration.md | 9 ++- docs/operations.md | 37 +++++++++ 8 files changed, 361 insertions(+), 60 deletions(-) create mode 100644 .agents/skills/claim-work/SKILL.md create mode 100644 .agents/skills/merge-pr/SKILL.md create mode 100644 .agents/skills/open-pr/SKILL.md create mode 100644 .agents/skills/red-main/SKILL.md diff --git a/.agents/skills/claim-work/SKILL.md b/.agents/skills/claim-work/SKILL.md new file mode 100644 index 000000000..584fa36ac --- /dev/null +++ b/.agents/skills/claim-work/SKILL.md @@ -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 --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 "" + gh search prs --repo InferMatrixLab/InferRSI --state open "" + ``` + +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 +, acting for @: claiming . +Next artifact: by . +``` + +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 `
`, and leave the work to others. diff --git a/.agents/skills/merge-pr/SKILL.md b/.agents/skills/merge-pr/SKILL.md new file mode 100644 index 000000000..fe65accc7 --- /dev/null +++ b/.agents/skills/merge-pr/SKILL.md @@ -0,0 +1,125 @@ +--- +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 --repo InferMatrixLab/InferRSI \ + --json state,isDraft,headRefOid,baseRefName,baseRefOid,body,labels,reviews,reviewDecision,statusCheckRollup,files +``` + +Also read the governing Issue's labels, accountable owner and recorded +authorization. Note `headRefOid` and `baseRefOid`: the checks below hold for +that pair only. + +## 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:** the guide's + [stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds no stop on the PR's + stop chain; a stop comment holds even after the label exists. If it finds a + stop or cannot rule one out, do not merge, and record on the PR which 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 5 comes from an account listed in + `.github/high-risk-approvers.json`; that account's agent may give it. Other + approvals count toward the two but not as this one. Read the list from the + protected `main` commit you noted as `baseRefOid` (the base is `main` by + check 4), never from the PR head or a stacked branch, so a PR that changes + the list is judged by the list before it + (`gh api "repos/InferMatrixLab/InferRSI/contents/.github/high-risk-approvers.json?ref=" --jq .content | base64 -d`). + Confirm the approving login is on it, and confirm the account still has + write access: + `gh api repos/InferMatrixLab/InferRSI/collaborators//permission --jq .permission` + must print `admin` or `write`. If you cannot read the list or the + permission, or no approving account passes both, do not merge. The PR that + creates the list is approved once as the + [high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority) + says. + Otherwise follow the normal flow. +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=@; containment=` 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. + +Right before merging, read the PR and the governing Issue again. Recheck the +stop check from check 3 on the whole stop chain; `headRefOid`, `baseRefName` and `baseRefOid` against the pair you +noted; the Issue's `status:accepted` and your authorization; and, on the +current head, the approvals, any open binding **Request changes** review, any advisory +request without a recorded disposition, GitHub's merge state, and any +unresolved code or safety blocker from check 7, and, on a +high-risk PR, the listed approver and its write access from check 9, against +the list at the same `baseRefOid`; and the PR body's `recovery:` line from +check 10, since the body can change without a new head. 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, so GitHub refuses the merge if the head has moved: + +```bash +gh pr merge --repo InferMatrixLab/InferRSI --squash \ + --match-head-commit --subject "" --body "" +``` + +With the REST merge endpoint, pass the same head as `sha`. If the merge is +refused because the head changed, start over from the checks above; never retry +without the expected head. The repository ruleset and merge controls apply +unchanged. There is +no merge queue yet; once one is enabled, the rules for queueing are added here. +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= approvals=@ , @ approver=@ list= merge= by=@`, +where `approver=` names the approving account you found on the list and +verified in check 9, and `list=` is the `baseRefOid` 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). diff --git a/.agents/skills/open-pr/SKILL.md b/.agents/skills/open-pr/SKILL.md new file mode 100644 index 000000000..a5e0ee37a --- /dev/null +++ b/.agents/skills/open-pr/SKILL.md @@ -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 ../ 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: / [effort=] ()` 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 --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 #`. 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=@; containment=`. +- 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). diff --git a/.agents/skills/red-main/SKILL.md b/.agents/skills/red-main/SKILL.md new file mode 100644 index 000000000..157abf96d --- /dev/null +++ b/.agents/skills/red-main/SKILL.md @@ -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 --limit 20 + ``` + +2. List the merges between those two commits with + `git log --first-parent ..`. 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 +``` + +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. diff --git a/.agents/skills/review-pr/SKILL.md b/.agents/skills/review-pr/SKILL.md index 3111781ab..feea3e217 100644 --- a/.agents/skills/review-pr/SKILL.md +++ b/.agents/skills/review-pr/SKILL.md @@ -65,6 +65,12 @@ as it stands on protected `main` (not the PR head or a stacked branch; see the [high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority)), including its agent, counts as the required listed approval. Other approvals count toward the two but not as that one. +If a revert cannot undo the change's external effect (credentials, published +assets, access) and the PR body lacks a +`recovery: owner=@; containment=` line, request it. +Post a review or +comment only for a new head, new evidence or a new question. Lead with the +one-line conclusion and put details in a collapsible `
` section. Agents may submit formal reviews without a separate human delegation; see [identity and authority](../../../docs/agent-collaboration.md#identity-and-authority). diff --git a/AGENTS.md b/AGENTS.md index 47e7cc66e..8a7f9a77e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -73,35 +73,21 @@ Parameterized or manual acceptance runs are issue-scoped; they are not the defau - **Emit RunSpec snapshots** — record repo × revision × backend × device × model × scenario (`contracts/runspec.py`, campaign `plan/`). - **Evaluator + evidence win** — never treat agent narrative as `PASS`; verdicts follow frozen gates and `evidence//` artifacts. -## Issues and claims (PM) +## Issues, claims and evidence -- Open or update an **acceptance issue before claiming `PASS`** (or publishing numbers). -- Do **not** invent thresholds in the tree; pins and numeric gates stay **issue-scoped** only. -- Public wording: [evidence and claim rules](docs/contributing.md#evidence-and-claims). - -## Research lock - -- Cite **acceptance issues + pinned SHAs** in downstream text; do not invent gain or quality bars. -- **Public wording only after `PASS`** — follow [evidence and claim rules](docs/contributing.md#evidence-and-claims); until then, label unverified or `INCONCLUSIVE`. +- Open or update an **acceptance issue before claiming `PASS`** (or publishing numbers). Cite **acceptance issues + pinned SHAs** in downstream text. +- Do **not** invent thresholds, gain or quality bars in the tree; pins and numeric gates stay **issue-scoped** only. +- **Public wording only after `PASS`** — follow [evidence and claim rules](docs/contributing.md#evidence-and-claims) (including external demo scope); until then, label unverified or `INCONCLUSIVE`. - Use [cite-check-downstream-pr](src/inferrsi/knowledge/data/skill_library/workflows/governance/cite-check-downstream-pr/SKILL.md) and [competitor-scan](src/inferrsi/knowledge/data/skill_library/workflows/research/competitor-scan/SKILL.md) as **operators**, not campaign scripts (no pins in skill bodies). -## Evidence and clearing the bar - -Verdicts are **`PASS`**, **`FAIL`**, or **`INCONCLUSIVE`** only (`src/inferrsi/contracts/claim.py`). - -A public **`PASS`** requires: +Verdicts are **`PASS`**, **`FAIL`**, or **`INCONCLUSIVE`** only (`src/inferrsi/contracts/claim.py`). A public **`PASS`** requires: 1. Pinned baseline and candidate revisions (in the issue, cited in results) 2. Validators **frozen** before candidate search (`validator/` + gate checklist in `plan/`) -3. A complete evidence tree under `evidence//`: `plan/`, `results/`, `patch/`, `validator/` +3. A complete evidence tree under `evidence//` ([layout](evidence/README.md)): `plan/`, `results/`, `patch/`, `validator/` Agents and human reviewers **clear** work only with artifacts—not vibes. Green draft/ready CI does not imply campaign `PASS`. -| Topic | Doc | -| --- | --- | -| Claim wording and external demo scope | [evidence and claim rules](docs/contributing.md#evidence-and-claims) | -| Evidence layout | [evidence/README.md](evidence/README.md) | - ## Skills For an inference task, first select one of the [seven required primary skills by deliverable](plugins/inferrsi/skills/inferrsi/SKILL.md#load-the-primary-inference-task). Run `inferrsi skills enter ` and read the returned instructions before the first evidence search. For an accuracy regression, use `inferrsi skills enter task-accuracy`. If the required skill cannot load, report the blocker. Frozen evaluations follow their assigned entry and knowledge condition. @@ -110,40 +96,9 @@ Portable operator guidance and candidate procedures live in the [skill library]( ## Optimization requests -For requests to use benchmarks to verify RSI knowledge efficiency, start with -`inferrsi benchmarks compare --help` and follow its returned `next_action`. -The default knowledge comparison runs Qwen denoising and MoE forward, each -on/off in independent sessions. Configuration, native handoff, trace and report -details are in [benchmark comparison](docs/benchmark-comparison.md). - -Ordinary project optimization stays in the current Agent conversation. Follow -the [shared optimization workflow](docs/optimization-workflow-unification.md): -prepare explicit workload, quality/measurement scripts, metric, gates, declared -project inputs and budget, then use `campaign start/diagnose/knowledge/round/status/final`. -Record the measured bottleneck before optional knowledge retrieval or candidate search. -Harness freezes those supplied conditions and assesses the retained results; -it does not infer acceptance from the user's goal. Ordinary optimization does -not depend on Benchmark. Use `up_to` with a recorded stop reason or declare exact rounds. -This and the packaged task path below share one Harness controller. Managed -campaigns generate dashboard views from that control record; do not use legacy -`campaign record/decide` to create a second set of optimization state. - -For a request to run an optimization task through RSI, follow the -[current-Agent benchmark workflow](docs/optimization-benchmarks.md). -Use `benchmarks session` to freeze the budget, record the measured bottleneck, -submit each changed candidate, -read its feedback, and independently retest the selected candidate with `final`. -Report the session summary after the declared rounds and final are complete. -`benchmarks run` is the single-candidate measurement operation inside that workflow. -Benchmark requests default to a fresh conversation on the current host; follow -[native Agent sessions](docs/native-agent-sessions.md). The initiator resolves -the task/configuration, records a prompt through `agents prepare`, then dispatches, -creates and binds one native session. It does not start the optimization campaign. -The execution Agent reads the RSI entry, runs start through independent final, -and returns the summary and artifacts. It must not redelegate. The initiator -observes the native session and records the delivered results without inferring -acceptance from host completion. An explicit current-conversation request uses -the same full optimization lifecycle directly. +Benchmark comparisons, ordinary project optimization and packaged optimization +tasks each have one entry workflow; see +[optimization requests](docs/operations.md#optimization-requests). ## Dev smoke (local) @@ -160,8 +115,16 @@ ruff check src tests 1. Read the contribution guide and validation levels before large code or CI changes. 2. Prefer minimal diffs; match existing layout and naming. 3. Do not reopen closed campaign work or add pins to shared automation without explicit human direction. -4. Work Issue-first: confirm the governing Issue's accepted scope before changing code, keep each change a bounded delegated slice with independent review, and report PR readiness and Issue completion separately — see [agent collaboration](docs/agent-collaboration.md). -5. Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. Identify yourself first on every comment and review, never approve your own PR, merge a high-risk PR (CI, releases, secrets, permissions) only with at least one of its two approvals from an account on the high-risk approver list in `.github/high-risk-approvers.json` (its agent may give it), claim work only on an Issue with an accountable owner (recorded on the Issue, or else its only assignee) labeled `status:accepted` (the agent acting for its accountable owner decides there), keep comments short, and revert a merge that turns `main` red before fixing forward — see [identity and authority](docs/agent-collaboration.md#identity-and-authority) and working rules 8–9 in [agent collaboration](docs/agent-collaboration.md#working-rules). + +## Collaboration + +Rules: [agent collaboration](docs/agent-collaboration.md). Agents may carry work end to end; humans set direction through Issues and stop work with `bot:stop`. One skill per step: + +- Claim before starting: [claim-work](.agents/skills/claim-work/SKILL.md) — confirm the Issue has an accountable owner and `status:accepted` and that you are its deciding agent or work under its delegation, search for duplicates, claim on the Issue with the next artifact time, release if nothing appears. +- Open a PR: [open-pr](.agents/skills/open-pr/SKILL.md) — a bounded slice with independent review, branched from current `main`, local checks run, AI declaration filled; report PR readiness and Issue completion separately. +- Review: [review-pr](.agents/skills/review-pr/SKILL.md) — identify yourself first on every comment and review, keep comments short, never approve your own PR; one formal reviewer agent per account. +- Merge: [merge-pr](.agents/skills/merge-pr/SKILL.md) — open and ready, authorized, expected base and dependencies merged, two independent approvals, required checks green, no `bot:stop` or unlifted stop comment, and on a high-risk PR (CI, releases, secrets, permissions) at least one approval from an account on the high-risk approver list in `.github/high-risk-approvers.json` that still has write access, verified at merge time. +- Red `main`: [red-main](.agents/skills/red-main/SKILL.md) — revert the merge that broke it, then fix forward in a new PR. ## Privacy and security diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 8f87f2483..30987c586 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -29,7 +29,7 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in | Accountable agent (parent) | Own the Issue outcome, plan and remaining criteria; implement or delegate bounded slices and independent review; report completion for acceptance. | | Implementer | Own a bounded slice; plan, research, coordinate, change, check and report actual results. | | Reviewer | Independently inspect accepted requirements, actual diff, affected consumers and evidence. Use the [PR review skill](../.agents/skills/review-pr/SKILL.md) to give a revision-scoped verdict. | -| Integrator | Verify authorization, current head/base, dependencies and applicable review/check results; integrate or report a blocker. | +| Integrator | Verify authorization, current head/base, dependencies and applicable review/check results; integrate or report a blocker. Use the [merge PR skill](../.agents/skills/merge-pr/SKILL.md). | Assign the accountable agent to the Issue, not only its first PR. One Issue may have several delivery PRs; a delegated subagent stays within its slice and @@ -148,7 +148,8 @@ Until then, the current ruleset and merge controls apply unchanged. Enabling the queue is a repository setting for maintainers, and it cannot be enabled while the required `knowledge-model-policy` check does not run on `merge_group` events. If `main` still turns red after a merge, an agent first -reverts the merge that broke it, then fixes forward in a new PR. +reverts the merge that broke it, then fixes forward in a new PR; see the +[red main skill](../.agents/skills/red-main/SKILL.md). ### Agent–Agent: isolated work and conditional handoff @@ -178,7 +179,7 @@ sequenceDiagram 5. **Handoff:** only for an actual transfer or accepted decision change, record the delta, recipient and next action. Keep acceptance status/link, communication status and application status separate. "Applied" needs artifact/evidence; otherwise retain pending or unknown. No full conversation traces or new ledger. 6. **Completion:** merged PR ≠ accepted goal ≠ campaign `PASS` ≠ release. Use non-closing `Refs #N` until closure is authorized. GitHub treats a closing keyword followed by an Issue reference as closing syntax even inside a negated sentence, so never write one in PR text; for an authorized closure, put `Closes #N` alone on its own line. The ready lane's `pr-references` job reports any other use. Subtasks cannot implicitly close a parent goal. Knowledge proposals to [#17](https://github.com/InferMatrixLab/InferRSI/issues/17) are optional; no automatic promotion. Before an authorized closure, publish a closure summary card ([closure summaries](#closure-summaries)). 7. **Parents and dependencies** (repository-wide, [#570 decision](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7092074182)): an Issue may stand alone with no parent. If it has a parent, it has exactly one, and it is attached as a GitHub sub-issue of that parent. Dependencies point one way and never form a cycle: a child links up to its parent, and only the parent lists its children and holds any acceptance shared by several of them, such as a joint run on the integrated main. Each Issue states its own completion condition: the PR(s) whose merge, or the check whose result, completes it. A completion condition never waits for another Issue to close, so a child does not stay open until a sibling or the parent closes. A real source or code prerequisite (this Issue's change needs another Issue's merged change) may still be recorded as a dependency on the Issue or its PRs; it orders the work and can hold a PR, but it is not a closure condition. Integration or acceptance evidence the Issue's own scope requires, such as a shared integration check, is different: it may be that Issue's completion condition as a named check, stated as the check's result, never as another Issue's closure. Ordering between PRs belongs on those PRs or once in the parent, not in sibling Issues' completion conditions. Existing Issues are brought in line only with their author's agreement. -8. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. +8. **Claims:** before starting a fix or opening a PR, search open Issues and PRs for the same work and claim it with a comment on the governing Issue; if someone already holds a live claim, coordinate there instead of starting a parallel fix. An agent's claim states when it will next show an artifact (draft PR, branch or findings). A claim that states no time allows 24 hours. If nothing appears by then, the claim lapses: the agent posts one comment releasing it and leaves the work to others. See the [claim work skill](../.agents/skills/claim-work/SKILL.md). 9. **Comments:** every agent comment starts with the acting-agent identity line, then a one-line conclusion as the first substantive line; put details in a collapsible `
` section. Post in a thread only for a new head, new evidence or a new question; do not post status-only updates. Do not post, or else minimize, agent comments that only report the agent's own failure or exhausted quota. ## Closure summaries @@ -256,7 +257,7 @@ flowchart LR ## Records - **Issue:** goal/criteria; scope; accountable account and parent agent if assigned; acting contributor if known; acceptance/delegation link; completion/closure owner. Unknown fields may remain TBD while proposed. Ordinary work starts from the [scoped-task template](../.github/ISSUE_TEMPLATE/scoped-task.md); baseline-vs-candidate campaigns use the [campaign acceptance form](../.github/ISSUE_TEMPLATE/campaign-acceptance.yml). -- **PR:** governing Issue; delivered artifacts; checks/results/limitations; dependencies and gaps. Add requirement-to-artifact mapping only when useful, and handoff fields only when applicable. No author-prefilled independent approval. Start from the [PR template](../.github/PULL_REQUEST_TEMPLATE.md). +- **PR:** governing Issue; delivered artifacts; checks/results/limitations; dependencies and gaps. Add requirement-to-artifact mapping only when useful, and handoff fields only when applicable. No author-prefilled independent approval. Start from the [PR template](../.github/PULL_REQUEST_TEMPLATE.md); the [open PR skill](../.agents/skills/open-pr/SKILL.md) covers the steps. - **Commit:** short descriptive subject; why/what when useful. Keep governing Issue references out of commit subjects, bodies and trailers — the PR body carries them. Preserve author identity and the required DCO sign-off (`git commit -s`); never invent a signing identity. Agent-assisted commits identify material agent contributors with `Agent-assisted-by: ()` trailers; repeat for multiple contributors and retain attribution when squashing. Protected knowledge contributions require the [current-head knowledge declaration](knowledge-model-policy.md) and use `Agent-assisted-by: / [effort=] ()` when known. Unknown values stay truthful and do not satisfy admission; model/version remains optional for other work. The trailer is self-reported provenance, not cryptographic signing, independent review or approval; review attribution belongs on the revision-scoped review record. - **Squash merge:** the required integration method. Before an authorized merge, prepare a concise squash message: subject plus a short summary, no governing Issue references, no redundant intermediate-commit messages; preserve the required DCO sign-off and material `Agent-assisted-by` attribution. Never invent identities or sign-offs. diff --git a/docs/operations.md b/docs/operations.md index 77d899e5f..93c80dad7 100644 --- a/docs/operations.md +++ b/docs/operations.md @@ -493,3 +493,40 @@ snapshot pinned at startup. The campaign Dashboard remains available through - **Side effects:** writes the requested files; nothing is executed and no network or GPU is touched. - **Failure behavior:** exit code 2 with the offending field name when the specification is incomplete, ambiguous or inconsistent; a report without a paired measurement states why it has no figure. - **Example:** [campaign summary chart](campaign-summary-chart.md) + +## Optimization requests + +For requests to use benchmarks to verify RSI knowledge efficiency, start with +`inferrsi benchmarks compare --help` and follow its returned `next_action`. +The default knowledge comparison runs Qwen denoising and MoE forward, each +on/off in independent sessions. Configuration, native handoff, trace and report +details are in [benchmark comparison](benchmark-comparison.md). + +Ordinary project optimization stays in the current Agent conversation. Follow +the [shared optimization workflow](optimization-workflow-unification.md): +prepare explicit workload, quality/measurement scripts, metric, gates, declared +project inputs and budget, then use `campaign start/diagnose/knowledge/round/status/final`. +Record the measured bottleneck before optional knowledge retrieval or candidate search. +Harness freezes those supplied conditions and assesses the retained results; +it does not infer acceptance from the user's goal. Ordinary optimization does +not depend on Benchmark. Use `up_to` with a recorded stop reason or declare exact rounds. +This and the packaged task path below share one Harness controller. Managed +campaigns generate dashboard views from that control record; do not use legacy +`campaign record/decide` to create a second set of optimization state. + +For a request to run an optimization task through RSI, follow the +[current-Agent benchmark workflow](optimization-benchmarks.md). +Use `benchmarks session` to freeze the budget, record the measured bottleneck, +submit each changed candidate, +read its feedback, and independently retest the selected candidate with `final`. +Report the session summary after the declared rounds and final are complete. +`benchmarks run` is the single-candidate measurement operation inside that workflow. +Benchmark requests default to a fresh conversation on the current host; follow +[native Agent sessions](native-agent-sessions.md). The initiator resolves +the task/configuration, records a prompt through `agents prepare`, then dispatches, +creates and binds one native session. It does not start the optimization campaign. +The execution Agent reads the RSI entry, runs start through independent final, +and returns the summary and artifacts. It must not redelegate. The initiator +observes the native session and records the delivered results without inferring +acceptance from host completion. An explicit current-conversation request uses +the same full optimization lifecycle directly. From 6a8f735078441a90cf282a7b9565253ac0bd2458 Mon Sep 17 00:00:00 2001 From: Dong1017 <55723162+Dong1017@users.noreply.github.com> Date: Tue, 24 Nov 2026 09:55:13 +0800 Subject: [PATCH 31/31] docs: guard collaboration merges against state changes Keep native auto-merge off for managed PRs and protect the high-risk approver list through integration. Agent-assisted-by: Codex (implementer) Signed-off-by: Dong1017 <55723162+Dong1017@users.noreply.github.com> --- .agents/skills/merge-pr/SKILL.md | 96 ++++++++++++++++++-------------- docs/agent-collaboration.md | 3 +- 2 files changed, 57 insertions(+), 42 deletions(-) diff --git a/.agents/skills/merge-pr/SKILL.md b/.agents/skills/merge-pr/SKILL.md index fe65accc7..a22f8f310 100644 --- a/.agents/skills/merge-pr/SKILL.md +++ b/.agents/skills/merge-pr/SKILL.md @@ -14,12 +14,12 @@ head; otherwise report the first failing check. ```bash gh pr view --repo InferMatrixLab/InferRSI \ - --json state,isDraft,headRefOid,baseRefName,baseRefOid,body,labels,reviews,reviewDecision,statusCheckRollup,files + --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` and `baseRefOid`: the checks below hold for -that pair only. +authorization. Note `headRefOid`, `baseRefName` and `baseRefOid` for the checks +below. ## Check every condition @@ -27,11 +27,18 @@ that pair only. 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:** the guide's - [stop check](../../../docs/agent-collaboration.md#identity-and-authority) finds no stop on the PR's - stop chain; a stop comment holds even after the label exists. If it finds a - stop or cannot rule one out, do not merge, and record on the PR which Issue - you could not check. +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 --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 @@ -64,22 +71,24 @@ that pair only. 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 5 comes from an account listed in - `.github/high-risk-approvers.json`; that account's agent may give it. Other - approvals count toward the two but not as this one. Read the list from the - protected `main` commit you noted as `baseRefOid` (the base is `main` by - check 4), never from the PR head or a stacked branch, so a PR that changes - the list is judged by the list before it - (`gh api "repos/InferMatrixLab/InferRSI/contents/.github/high-risk-approvers.json?ref=" --jq .content | base64 -d`). - Confirm the approving login is on it, and confirm the account still has - write access: - `gh api repos/InferMatrixLab/InferRSI/collaborators//permission --jq .permission` - must print `admin` or `write`. If you cannot read the list or the - permission, or no approving account passes both, do not merge. The PR that - creates the list is approved once as the - [high-risk rule](../../../docs/agent-collaboration.md#identity-and-authority) - says. - Otherwise follow the normal flow. + 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 + `` 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 `` 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 `` + (`gh api "repos/InferMatrixLab/InferRSI/contents/.github/high-risk-approvers.json?ref=" --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//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 @@ -87,38 +96,43 @@ that pair only. owner and the containment steps. If it is missing, do not merge and ask the author to add it. This adds no approval requirement. -Right before merging, read the PR and the governing Issue again. Recheck the -stop check from check 3 on the whole stop chain; `headRefOid`, `baseRefName` and `baseRefOid` against the pair you -noted; the Issue's `status:accepted` and your authorization; and, on the -current head, the approvals, any open binding **Request changes** review, any advisory -request without a recorded disposition, GitHub's merge state, and any -unresolved code or safety blocker from check 7, and, on a -high-risk PR, the listed approver and its write access from check 9, against -the list at the same `baseRefOid`; and the PR body's `recovery:` line from -check 10, since the body can change without a new head. If anything changed or -no longer holds, start over. +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 +`` 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, so GitHub refuses the merge if the head has moved: +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 `` at merge time. ```bash gh pr merge --repo InferMatrixLab/InferRSI --squash \ --match-head-commit --subject "" --body "" ``` -With the REST merge endpoint, pass the same head as `sha`. If the merge is -refused because the head changed, start over from the checks above; never retry -without the expected head. The repository ruleset and merge controls apply -unchanged. There is -no merge queue yet; once one is enabled, the rules for queueing are added here. +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= approvals=@ , @ approver=@ list= merge= by=@`, where `approver=` names the approving account you found on the list and -verified in check 9, and `list=` is the `baseRefOid` you read the list from +verified in check 9, and `list=` is the `` 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 diff --git a/docs/agent-collaboration.md b/docs/agent-collaboration.md index 30987c586..4caf20bdb 100644 --- a/docs/agent-collaboration.md +++ b/docs/agent-collaboration.md @@ -18,8 +18,9 @@ Campaign acceptance, DCO, CI lanes and evidence rules stay in - Completion is accepted by the named person or authorized agent. Acceptance/closure authority must be clear before those actions; it need not block already-authorized implementation. - Agents carry work end to end: they claim, delegate slices, set accepted scope and acceptance criteria within the Issue's direction, apply repository rules to a case, grant exceptions within the limits above, review and merge PRs, high-risk ones under the rule below. Each such decision is recorded on the Issue or PR with its reason. - Humans do two things: open Issues that set direction and stop work at any time. A human adds `bot:stop` to an Issue or PR to stop it, or a maintainer account's agent adds it for a human with a comment there linking that human's stop request; agents then make no further changes, reviews or merges there and resume only after the stop is lifted as below. A stop on an Issue also stops the PRs it governs and any work delegated under it, including its sub-issues at any depth and their PRs. An Issue owner's or another human's comment on an Issue or PR asking agents to stop has the same effect, and creating the label does not end it. Only a human lifts a stop (removes the label or lifts the comment): the human who stopped the work (by the label or a comment) or a maintainer acting in person; no agent lifts one, including a maintainer account's agent ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7073497490), unchanged by the [later amendment](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)). Adding the label for a human or migrating a recorded human stop comment to `bot:stop` keeps the stop in force and is not lifting it, so a maintainer account's agent may do either. Each lift or migration is recorded by a comment on that same Issue or PR (for a migration, with the label added there). If it is unclear whether a stop was posted, lifted or migrated, or by whom, the stop stays in effect. Right before each push, review or merge, an agent runs the stop check: it checks the work's stop chain for the label and for any stop comment not yet lifted this way. The stop chain is the PR, the Issues that govern or delegated the work, and every real ancestor of those Issues (following each Issue's sub-issue parent up to the top). A governing Issue is one the PR body references with `Refs #N` or `Closes #N` as the source of this work's scope, and a delegating Issue is one on which the work was delegated to the acting agent; an Issue linked only as background or related reading is not in the chain. If any Issue in the chain cannot be read (for example a permission or API failure), or the agent cannot tell whether a stop is present, it treats the work as stopped, does not act, and records on the PR which Issue it could not check; an Issue outside the chain neither stops the work nor needs to be readable. For example, a PR that refs sub-issue B waits while B's parent A carries `bot:stop`; a PR that refs B and also links an older Issue C as background, which the agent cannot read, is not stopped because of C. A maintainer creates `bot:stop` with the Dong1017 account as soon as this guide merges. -- There is no merge queue yet, so a stop needs only that recheck right before the merge. Before a merge queue is enabled, whoever enables it records who removes a stopped PR's queued entry and verifies that path, and a final stop check right before each PR is queued is part of enabling it. +- Keep GitHub auto-merge off for PRs governed by this guide. An armed request can merge after a stop without the integrator's final check. The authorized integrator, or a maintainer if the integrator cannot act, disables any already-armed request and verifies it is gone. On a stop, this applies to every affected PR, including those stopped through a governing or ancestor Issue. Cancelling auto-merge is part of enforcing the stop. Until cancellation is confirmed, hold the work and report that the PR may still merge automatically. If GitHub already merged the PR, report that outcome to the Issue owner for authorized recovery. Enable an asynchronous merge path only after verifying it prevents a PR from merging while stopped. Before enabling a merge queue, record who removes stopped PRs and verify the removal procedure. Recheck for a stop right before enqueueing. - High-risk changes are CI workflows and required checks, releases (release workflow, version, tags, publishing), secrets and credentials, and permissions (workflow `permissions`, repository access, rulesets, the high-risk approver list). They still need two independent approvals, at least one from an account on the high-risk approver list in [`.github/high-risk-approvers.json`](../.github/high-risk-approvers.json) that still has repository write access at merge time; that account's agent may give it. Other accounts count toward the two approvals but not as this one ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219)). Changing that file is itself a high-risk change. Which copy of the list counts: the PR that creates the file is approved once against the five accounts recorded in [#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219), under the existing repository controls. After that, only the copy in the protected `main` commit that the merging agent verifies right before the merge counts, never the copy on the PR head or a stacked branch, so a PR that changes the list is judged by the list in effect before it. If the merging agent cannot read that list or the approver's current write access, it does not merge. This repository is run by bot maintainers: an account and the agent working for it count as that account, and the account holder answers for everything the account does. High-risk changes are tracked after the fact rather than gated on proof of human origin ([#570](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7077630550)): the approval and the merge each carry an identity line naming the acting agent or human (for the merge, in a PR comment posted with it), so both can be audited later. The merging agent writes that comment itself at merge time: the identity line, then one line `merge-audit: head= approvals=@ , @ approver=@ list= merge= by=@`. `approver=` names the approving account the merging agent found on the high-risk approver list and verified still had write access at merge time, from the collaborator permission GitHub reports for that account; `list=` is the protected `main` commit that list was read from, or `list=bootstrap-570` for the one-time bootstrap merge, whose comment links the [#570 record](https://github.com/InferMatrixLab/InferRSI/issues/570#issuecomment-7078872219); an identity line declares who acted without proving it. When a revert cannot undo a change's external effect (exposed credentials, a published asset, changed access), the author or the author's agent puts one line `recovery: owner=@; containment=` in the PR body before the change takes effect; a reviewer agent that finds it missing requests it, and it adds no approval gate. Misuse is handled after the fact by the account holder and the maintainers: revert, record it on the Issue, and tighten the rule if it recurs. Every step here uses only labels, identity lines and fixed lines like these, so an agent can do it and a bot pipeline can check it; no step waits on a human. +- After the one-time bootstrap, a high-risk merge must keep the checked list effective through integration. Use a merge path that rejects a changed checked base, or serialize high-risk merges with all updates to the list, including manual and automated ones. Under serialization, the integrator holds the exclusive slot from before reading the current protected `main` for the final check until GitHub confirms the merge or rejects it. A head-matched merge alone cannot protect the list. If neither path can be verified, hold the merge. See [merge PR](../.agents/skills/merge-pr/SKILL.md). - Each account carries at most one agent team, or the agent uses its own account. Each account has one formal reviewer agent; other agents under that account, such as a patrol, report in comments and do not submit **Approve** or **Request changes**. Every agent comment and every formal review (including **Approve** and **Request changes**) carries one line naming the acting agent and the human it acts for, so humans, integrators and other agents can tell who acted. The line comes first. ## Roles