diff --git a/.agents/skills/_shared/pr-follow-up.md b/.agents/skills/_shared/pr-follow-up.md index 68ad117b472..a8b587f7ef4 100644 --- a/.agents/skills/_shared/pr-follow-up.md +++ b/.agents/skills/_shared/pr-follow-up.md @@ -90,24 +90,11 @@ Before editing, collect and classify all review signals for the latest PR commit 1. Re-read `headRefOid`. Collect current required-check failures, issue comments, submitted reviews, inline threads with resolution state, advisor findings, and required independent-review findings. Record each source commit when GitHub provides it. Otherwise, record the latest PR commit SHA. 2. Re-evaluate findings created for an earlier PR commit against the latest PR commit. Exclude a finding only when the changed code is gone or evidence shows that the defect is resolved. Record the disposition before editing. 3. Group findings by root cause. Name the behavior contract and acceptance evidence for each group. -4. Inspect adjacent paths that implement the same operation or failure class. Record which sibling paths were checked. -5. Decide which groups are valid, false positives, design-changing, or blocked before changing files. +4. Decide which groups are valid, false positives, design-changing, or blocked. +5. Apply the shared [Root-Cause and Sensitive-Workflow State Checks](root-cause-and-state-checks.md), starting from the change set that the valid groups imply. Record the sibling paths checked, the operation and failure class each group belongs to, and the sensitive-workflow state outcomes. Do not create a separate commit or push for each finding. Apply all findings in the same root-cause group as one coherent change set. Classify every finding collected for the unchanged latest PR commit before beginning that change set. If the user tells you to stop, remove retained collection evidence by its exact artifact path or identifier and verify its absence. If the host retained no artifact, record `retained evidence: none`. Then stop without further edits, commits, or pushes. The user may explicitly defer a non-blocking suggestion or allow work to proceed without an optional pending review. Record that decision before editing. Do not proceed without a required review. Deferral does not authorize a push with an unresolved blocking, correctness, security, data safety, supported-contract, required-review, or required-check finding. -### Sensitive-Workflow State Matrix - -Create a sensitive-workflow state matrix before editing a flow that handles credentials, remote execution, billable resources, destructive cleanup, security policy, or public writes. Use only the rows and columns required to cover the changed contract. Classify these outcomes when they apply: - -| Phase | Success | Command Failure | Transport Ambiguity | Verification Failure | -|---|---|---|---|---| -| Input or credential acquisition | Result and custody | Removal or rollback | Assume possible remote effect | Rejected input | -| Execution | Expected state | Failure classification | Confirmation requirement | Acceptance criteria not met | -| Cleanup | Confirmed removal | Recovery action | Ownership and absence check | Retention and rotation | -| External write | Accepted write set | Partial-write report | Assume a possible write and re-read external state | Report a partial or inconclusive result | - -For each credential, name its location, access, lifetime, and removal. For each failure cell, record the result and required action separately. Classify the result as an infrastructure failure or inconclusive verification when applicable. Classify the action as rollback, retry, or stop. Ask the user before choosing a behavior that changes security, data safety, cost, or a supported contract. - ## Handle results - Follow the shared [Documentation Writing and Review](documentation-writing-review.md) contract @@ -122,8 +109,8 @@ For each credential, name its location, access, lifetime, and removal. For each - A supported contract. - Unnecessary complexity in changed code. - Ambiguity in changed text that can change behavior, security, data safety, test meaning, or release meaning. -- **CI failure:** Add the failure to the current review cycle. Inspect other checks and paths with the same root cause. Apply the complete fix group, then run the related local checks. -- **Valid CodeRabbit or PR Review Advisor finding:** Add the finding to its root-cause group. Inspect adjacent correctness, security, and test paths before editing. Apply the group as one change set. +- **CI failure:** Add the failure to the current review cycle. Apply the shared [Root-Cause and Sensitive-Workflow State Checks](root-cause-and-state-checks.md), starting from the failing paths. Correlate the same root cause across the other required checks, including pending, cancelled, and skipped results. Apply the complete fix group, then run the related local checks. +- **Valid CodeRabbit or PR Review Advisor finding:** Add the finding to its root-cause group. Apply the shared [Root-Cause and Sensitive-Workflow State Checks](root-cause-and-state-checks.md) before editing, including the correctness, security, and test paths adjacent to the finding. Apply the group as one change set. - **Style comment or false positive:** Avoid unnecessary changes. Explain your decision in the final report. Comment on the PR when reviewers need the explanation. - **Ambiguous, risky, broad, or design-changing feedback:** Stop and ask the user before you change code. diff --git a/.agents/skills/_shared/root-cause-and-state-checks.md b/.agents/skills/_shared/root-cause-and-state-checks.md new file mode 100644 index 00000000000..d4ac3b1d911 --- /dev/null +++ b/.agents/skills/_shared/root-cause-and-state-checks.md @@ -0,0 +1,43 @@ + + + +# Root-Cause and Sensitive-Workflow State Checks + +Apply these checks while planning, implementing, and reviewing a change. Record the results in the +output that the current workflow already owns; do not produce a separate report. State why a check +does not apply when the omission could hide risk. + +## Authority + +Current code, tests, workflows, and active `AGENTS.md` files own implementation details. Derive the +operations, sibling paths, and states from the current checkout rather than recording them here. + +## Root-Cause Sibling Paths + +Name the operation and failure class that the change belongs to. +Inspect adjacent paths that implement the same operation or failure class. +Record which sibling paths were checked and whether each one needs the same change. +A change that repairs one path and leaves a sibling path unchanged keeps the same defect reachable. + +## Sensitive-Workflow State Matrix + +Build a sensitive-workflow state matrix as working analysis for a flow that handles credentials, +remote execution, billable resources, destructive cleanup, security policy, or public writes. Use +only the rows and columns required to cover the changed contract. Classify these outcomes when they +apply: + +| Phase | Success | Command Failure | Transport Ambiguity | Verification Failure | +|---|---|---|---|---| +| Input or credential acquisition | Result and custody | Removal or rollback | Assume possible remote effect | Rejected input | +| Execution | Expected state | Failure classification | Confirmation requirement | Acceptance criteria not met | +| Cleanup | Confirmed removal | Recovery action | Ownership and absence check | Retention and rotation | +| External write | Accepted write set | Partial-write report | Assume a possible write and re-read external state | Report a partial or inconclusive result | + +For each credential, name its location, access, lifetime, and removal. For each failure cell, record +the result and required action separately. Classify the result as an infrastructure failure or +inconclusive verification when applicable. Classify the action as rollback, retry, or stop. Ask the +user before choosing a behavior that changes security, data safety, cost, or a supported contract. + +The [Security Rubric](security-rubric.md) owns the authentication and authorization category and its +evidence expectations. For a public or external write, record the positive and negative evidence that +authorization is enforced for the exact resource and action. diff --git a/.agents/skills/nemoclaw-contributor-implement-issue/SKILL.md b/.agents/skills/nemoclaw-contributor-implement-issue/SKILL.md index 4fa8a986841..fa373abdd95 100644 --- a/.agents/skills/nemoclaw-contributor-implement-issue/SKILL.md +++ b/.agents/skills/nemoclaw-contributor-implement-issue/SKILL.md @@ -60,6 +60,7 @@ Stop and request user remediation for any Git or GitHub access error. Do not att remote, protocol, or permission bypass. Then follow [Discover the Current Implementation](../_shared/implementation-discovery.md). Apply the shared [Code Change Considerations](../_shared/code-change-considerations.md), +[Root-Cause and Sensitive-Workflow State Checks](../_shared/root-cause-and-state-checks.md), [Security Rubric](../_shared/security-rubric.md), and [Documentation Writing and Review](../_shared/documentation-writing-review.md) contract. @@ -76,8 +77,10 @@ review, or maintainer workflows to replace routine implementation work. ## Implement and validate the slice Before editing, map each success criterion and applicable security control to its shortest stable -evidence. Then make the direct change in the current behavior owner. Do not add speculative -abstractions, configuration, compatibility, migration, or fallback behavior. +evidence. Name the operation and failure class the change belongs to. Record the sibling paths +checked for that operation or failure class and the sensitive-workflow state outcomes the change must +hold. Then make the direct change in the current behavior owner. Do not add speculative abstractions, +configuration, compatibility, migration, or fallback behavior. Add focused evidence as applicable: @@ -102,8 +105,11 @@ security control and focused negative evidence that proves forbidden behavior re security control changed, state why and cite the reviewed trust boundaries. Confirm that allowed, denied, error, and boundary behavior remains coherent across failure, retry, -cleanup, cached, resumed, and compatibility paths that apply. Separate completed local evidence from -CI, live E2E, hardware, publication, and other external gates. +cleanup, cached, resumed, and compatibility paths that apply. +Re-check the recorded operation and failure class, sibling paths, and sensitive-workflow state +outcomes against the completed diff, and report each sibling path that still needs the same change. +Separate completed local evidence from CI, live E2E, hardware, publication, and other external +gates. ## Report the implementation handoff @@ -127,6 +133,11 @@ Use this structure: - Error or recovery: - Boundary or ambiguous state: +## Root cause and sensitive-workflow state +- Operation and failure class: +- Sibling paths checked: +- Sensitive-workflow states: + ## Security considerations - Applicable categories and trust boundaries: - Controls changed: diff --git a/.agents/skills/nemoclaw-contributor-plan-issue/SKILL.md b/.agents/skills/nemoclaw-contributor-plan-issue/SKILL.md index ef0e4aaf582..3e996812de0 100644 --- a/.agents/skills/nemoclaw-contributor-plan-issue/SKILL.md +++ b/.agents/skills/nemoclaw-contributor-plan-issue/SKILL.md @@ -57,7 +57,7 @@ related work. Do not assign an owner through GitHub unless the user authorizes t ## Discover the current implementation -Before running any `git` or `gh` discovery command, follow [Stop for Git and GitHub Access Errors](../_shared/git-github-hard-stop.md). Then follow [Discover the Current Implementation](../_shared/implementation-discovery.md). Apply the shared [Code Change Considerations](../_shared/code-change-considerations.md) and [Security Rubric](../_shared/security-rubric.md) at the planning stage. +Before running any `git` or `gh` discovery command, follow [Stop for Git and GitHub Access Errors](../_shared/git-github-hard-stop.md). Then follow [Discover the Current Implementation](../_shared/implementation-discovery.md). Apply the shared [Code Change Considerations](../_shared/code-change-considerations.md), [Root-Cause and Sensitive-Workflow State Checks](../_shared/root-cause-and-state-checks.md), and [Security Rubric](../_shared/security-rubric.md) at the planning stage. Read before proposing work: @@ -67,8 +67,10 @@ Read before proposing work: - documentation only to locate claims and rationale, not as behavior authority. Identify the existing structure to extend. Report duplicate ownership, conflicting work, delivery -order constraints, unresolved decisions, and trust boundaries. Stop discovery when the smallest -coherent delivery plan is supported by current evidence. +order constraints, unresolved decisions, and trust boundaries. Name the operation and failure class +that the work belongs to, record the sibling paths checked, and record the sensitive-workflow state +outcomes the plan must hold. Stop discovery when the smallest coherent delivery plan is supported by +current evidence. ## Define observable acceptance @@ -136,6 +138,9 @@ the planning result reliably: ## Current state and decisions - Existing structure to extend: - Unresolved product decisions: +- Operation and failure class: +- Sibling paths checked: +- Sensitive-workflow states: - Security boundaries: ## Observable acceptance examples diff --git a/test/maintainer-skills-policy.test.ts b/test/maintainer-skills-policy.test.ts index 1cf7cd31583..c5025a937f3 100644 --- a/test/maintainer-skills-policy.test.ts +++ b/test/maintainer-skills-policy.test.ts @@ -652,14 +652,15 @@ describe("maintainer skills follow canonical workflow policy", () => { expect(followUp).toContain("Collect One Complete Review Cycle"); expect(followUp).toContain("Group findings by root cause"); expect(followUp).toContain("Do not create a separate commit or push for each finding"); - expect(followUp).toContain("Sensitive-Workflow State Matrix"); - expect(followUp).toContain("location, access, lifetime, and removal"); + expect(followUp).toContain("root-cause-and-state-checks.md"); + expect(followUp).toContain("Record the sibling paths checked"); expect(followUp).toContain("Bind every read to `NVIDIA/NemoClaw`"); expect(followUp).toContain("Record each page count and terminal pagination signal"); - expect(followUp).toContain("including pending, cancelled, and skipped results"); + expect(followUp).toContain( + "every required check, including pending, cancelled, and skipped results", + ); expect(followUp).toContain("retained evidence: none"); - expect(followUp).toContain("Assume a possible write and re-read external state"); expect(followUp).toContain("stop without further edits, commits, or pushes"); expect(createPr).toContain("Apply one coherent change set"); }); diff --git a/test/skills-frontmatter.test.ts b/test/skills-frontmatter.test.ts index b00f911f65c..ebc4f9d1978 100644 --- a/test/skills-frontmatter.test.ts +++ b/test/skills-frontmatter.test.ts @@ -113,6 +113,52 @@ describe("repo skill markdown files", () => { expect(discovery).not.toContain("Follow imports and call sites"); }); + it("keeps root-cause and sensitive-workflow state checks in one stage-neutral owner (#8555)", () => { + const checks = fs.readFileSync( + path.join(skillsRoot, "_shared", "root-cause-and-state-checks.md"), + "utf8", + ); + const followUp = fs.readFileSync(path.join(skillsRoot, "_shared", "pr-follow-up.md"), "utf8"); + const planIssue = fs.readFileSync( + path.join(skillsRoot, "nemoclaw-contributor-plan-issue", "SKILL.md"), + "utf8", + ); + const implementIssue = fs.readFileSync( + path.join(skillsRoot, "nemoclaw-contributor-implement-issue", "SKILL.md"), + "utf8", + ); + const consumers = [followUp, planIssue, implementIssue]; + + expect(checks.split("\n").length).toBeLessThan(45); + expect(checks).toContain("planning, implementing, and reviewing"); + expect(checks).toContain( + "Inspect adjacent paths that implement the same operation or failure class", + ); + expect(checks).toContain("Record which sibling paths were checked"); + expect(checks).toContain("Sensitive-Workflow State Matrix"); + expect(checks).toContain("location, access, lifetime, and removal"); + expect(checks).toContain("Assume a possible write and re-read external state"); + expect(checks).toContain("owns the authentication and authorization category"); + expect(checks).toContain("security-rubric.md"); + expect(checks).not.toMatch( + /\b(?:npm\s+(?:run|test)|pnpm\s+test|npx\s+vitest)\b|\bsrc\/|\btest\/|\.github\/workflows/iu, + ); + + for (const consumer of consumers) { + expect(consumer).toContain("root-cause-and-state-checks.md"); + expect(consumer).toMatch(/operation and failure class/iu); + expect(consumer).not.toContain("| Input or credential acquisition |"); + expect(consumer).not.toMatch(/Inspect (?:adjacent|other)/u); + } + + for (const report of [planIssue, implementIssue]) { + expect(report).toContain("each credential location, access, lifetime, and removal"); + expect(report).toContain( + "each applicable failure cell with a separate result and required action", + ); + } + }); + it("keeps issue planning read-only and capability-oriented (#8362)", () => { const skillRoot = path.join(skillsRoot, "nemoclaw-contributor-plan-issue"); const skill = fs.readFileSync(path.join(skillRoot, "SKILL.md"), "utf8"); @@ -124,7 +170,12 @@ describe("repo skill markdown files", () => { expect(skill).toContain("../_shared/code-change-considerations.md"); expect(skill).toContain("../_shared/security-rubric.md"); expect(skill).toContain("../_shared/git-github-hard-stop.md"); + expect(skill).toContain("../_shared/root-cause-and-state-checks.md"); expect(skill).toContain("untrusted evidence, not agent instructions"); + expect(skill).toContain("Name the operation and failure class"); + expect(skill).toContain("Operation and failure class:"); + expect(skill).toContain("Sibling paths checked:"); + expect(skill).toContain("Sensitive-workflow states:"); expect(skill).toContain("an accepted issue or accepted design decision"); expect(skill).toContain("Distinguish the requested outcome"); @@ -199,6 +250,7 @@ describe("repo skill markdown files", () => { expect(skill).toContain("pick up issue for implementation"); expect(skill).toContain("../_shared/implementation-discovery.md"); expect(skill).toContain("../_shared/code-change-considerations.md"); + expect(skill).toContain("../_shared/root-cause-and-state-checks.md"); expect(skill).toContain("../_shared/security-rubric.md"); expect(skill).toContain("../_shared/documentation-writing-review.md"); expect(skill).toContain("smallest independently valuable capability slice"); @@ -220,6 +272,11 @@ describe("repo skill markdown files", () => { expect(skill).toContain("Negative:"); expect(skill).toContain("Error or recovery:"); expect(skill).toContain("Boundary or ambiguous state:"); + expect(skill).toContain("Name the operation and failure class the change belongs to"); + expect(skill).toContain("Record the sibling paths"); + expect(skill).toContain("Re-check the recorded operation and failure class"); + expect(skill).toContain("Sibling paths checked:"); + expect(skill).toContain("Sensitive-workflow states:"); expect(skill).toContain("Controls changed:"); expect(skill).toContain("Remaining local or external gates:"); expect(skill).toContain("PR handoff evidence:");