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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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/27] 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