From 09056bda1d1275e8824070f747483739cb37fbca Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:49:26 +0100 Subject: [PATCH 1/3] fix(ci): run the unit tests when agent instruction files change #12493 added the guardrails section "Long-running work reports progress proactively" but changed no Python, so "Run Tests" skipped it and test_every_companion_section_is_registered failed on main. Register the section and the classifier-denial rule with their CLAUDE.md anchors, and let ci-tests.yml run the tests for changes to CLAUDE.md, AGENTS.md, the Copilot instructions, .claude/guardrails.md, .claude/skills/ and agentic/commands/, which the unit tests read. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8 --- .github/workflows/ci-tests.yml | 13 ++++++++----- changelog.d/guardrails-section-registry.md | 11 +++++++++++ tests/unit/test_agent_instructions.py | 10 +++++++++- 3 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 changelog.d/guardrails-section-registry.md diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index 26b7ffa3a71..ef0d490d96a 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -90,11 +90,14 @@ jobs: TESTABLE_CHANGES=$(echo "$CHANGED_FILES" | grep '\.py$' | grep -v '^plots/' || true) # Also run tests when the test configuration, a lock file or pinned runtime, a - # workflow or action, or a prompt changes: tests/unit/workflows parses every - # workflow YAML, tests/unit/prompts reads the prompt files, and - # tests/unit/core/test_version_sources.py checks that every version resolves - # from uv.lock, package-lock.json, Manifest.toml and .python-version. - CONFIG_CHANGES=$(echo "$CHANGED_FILES" | grep -E '^(pyproject\.toml|pytest\.ini|conftest\.py|uv\.lock|package\.json|package-lock\.json|Project\.toml|Manifest\.toml|\.python-version)$|^(\.github/workflows/|\.github/actions/|prompts/)' || true) + # workflow or action, a prompt, or an agent instruction file changes: + # tests/unit/workflows parses every workflow YAML, tests/unit/prompts reads the + # prompt files, tests/unit/core/test_version_sources.py checks that every version + # resolves from uv.lock, package-lock.json, Manifest.toml and .python-version, and + # tests/unit/test_agent_instructions.py and tests/unit/skills read CLAUDE.md, + # the Copilot instructions, .claude/guardrails.md, the skills and the commands + # (#12493 changed only those, skipped this job, and left main red). + CONFIG_CHANGES=$(echo "$CHANGED_FILES" | grep -E '^(pyproject\.toml|pytest\.ini|conftest\.py|uv\.lock|package\.json|package-lock\.json|Project\.toml|Manifest\.toml|\.python-version|CLAUDE\.md|AGENTS\.md|\.github/copilot-instructions\.md|\.claude/guardrails\.md)$|^(\.github/workflows/|\.github/actions/|prompts/|\.claude/skills/|agentic/commands/)' || true) # Force run on workflow_dispatch with force_run=true if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force_run }}" == "true" ]]; then diff --git a/changelog.d/guardrails-section-registry.md b/changelog.d/guardrails-section-registry.md new file mode 100644 index 00000000000..5fb17336397 --- /dev/null +++ b/changelog.d/guardrails-section-registry.md @@ -0,0 +1,11 @@ +### Fixed + +- **The unit tests run when an agent instruction file changes, and main is green + again.** #12493 added the section "Long-running work reports progress + proactively" to `.claude/guardrails.md` but changed no Python, so "Run Tests" + skipped it and `test_every_companion_section_is_registered` failed on main. + The section and the classifier-denial rule are now registered with their + CLAUDE.md anchors, and `ci-tests.yml` also runs the tests for changes to + `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, + `.claude/guardrails.md`, `.claude/skills/` and `agentic/commands/`, which + `tests/unit/test_agent_instructions.py` and `tests/unit/skills` read. diff --git a/tests/unit/test_agent_instructions.py b/tests/unit/test_agent_instructions.py index 31b2028ede9..37de25f316b 100644 --- a/tests/unit/test_agent_instructions.py +++ b/tests/unit/test_agent_instructions.py @@ -425,7 +425,15 @@ def test_guardrails_split_stays_subordinate() -> None: "gemini pushes only its `gemini/*` branch and opens only draft prs", "never extract, copy, or proxy the agy login", ], - "External-system writes need explicit, named authorization": ["explicit, named authorization"], + "External-system writes need explicit, named authorization": [ + "explicit, named authorization", + "permission-classifier denial anywhere in the session", + ], + "Long-running work reports progress proactively": [ + "never let the user be the one to ask", + "no new commit and no message for about 30 minutes is a suspected stall", + "after every context compaction, re-check each delegate's real state", + ], "After every merge, check that the site renders": [ "after every merge, check that the site renders", "`scripts/site-smoke.mjs`", From 7b047117519e745431443f8adfe59c173c1d0773 Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Sun, 1 Nov 2026 00:49:38 +0100 Subject: [PATCH 2/3] docs(changelog): reference #12494 in the registry fix fragment Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8 --- changelog.d/guardrails-section-registry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/guardrails-section-registry.md b/changelog.d/guardrails-section-registry.md index 5fb17336397..4e2542b2973 100644 --- a/changelog.d/guardrails-section-registry.md +++ b/changelog.d/guardrails-section-registry.md @@ -8,4 +8,4 @@ CLAUDE.md anchors, and `ci-tests.yml` also runs the tests for changes to `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, `.claude/guardrails.md`, `.claude/skills/` and `agentic/commands/`, which - `tests/unit/test_agent_instructions.py` and `tests/unit/skills` read. + `tests/unit/test_agent_instructions.py` and `tests/unit/skills` read. (#12494) From dd7160b02919747d56656db68e28bbc8e4bec6cf Mon Sep 17 00:00:00 2001 From: Markus Neusinger <2921697+MarkusNeusinger@users.noreply.github.com> Date: Sun, 1 Nov 2026 01:02:29 +0100 Subject: [PATCH 3/3] fix(ci): also run the unit tests for agentic/docs/project-guide.md test_agent_instructions.py reads it through AGENT_FILES (Copilot review). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01H7HSkGyea1k2v293XiAMo8 --- .github/workflows/ci-tests.yml | 7 ++++--- changelog.d/guardrails-section-registry.md | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-tests.yml b/.github/workflows/ci-tests.yml index ef0d490d96a..18113f54f9b 100644 --- a/.github/workflows/ci-tests.yml +++ b/.github/workflows/ci-tests.yml @@ -95,9 +95,10 @@ jobs: # prompt files, tests/unit/core/test_version_sources.py checks that every version # resolves from uv.lock, package-lock.json, Manifest.toml and .python-version, and # tests/unit/test_agent_instructions.py and tests/unit/skills read CLAUDE.md, - # the Copilot instructions, .claude/guardrails.md, the skills and the commands - # (#12493 changed only those, skipped this job, and left main red). - CONFIG_CHANGES=$(echo "$CHANGED_FILES" | grep -E '^(pyproject\.toml|pytest\.ini|conftest\.py|uv\.lock|package\.json|package-lock\.json|Project\.toml|Manifest\.toml|\.python-version|CLAUDE\.md|AGENTS\.md|\.github/copilot-instructions\.md|\.claude/guardrails\.md)$|^(\.github/workflows/|\.github/actions/|prompts/|\.claude/skills/|agentic/commands/)' || true) + # the Copilot instructions, .claude/guardrails.md, agentic/docs/project-guide.md, + # the skills and the commands (#12493 changed only those, skipped this job, and + # left main red). + CONFIG_CHANGES=$(echo "$CHANGED_FILES" | grep -E '^(pyproject\.toml|pytest\.ini|conftest\.py|uv\.lock|package\.json|package-lock\.json|Project\.toml|Manifest\.toml|\.python-version|CLAUDE\.md|AGENTS\.md|\.github/copilot-instructions\.md|\.claude/guardrails\.md|agentic/docs/project-guide\.md)$|^(\.github/workflows/|\.github/actions/|prompts/|\.claude/skills/|agentic/commands/)' || true) # Force run on workflow_dispatch with force_run=true if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.force_run }}" == "true" ]]; then diff --git a/changelog.d/guardrails-section-registry.md b/changelog.d/guardrails-section-registry.md index 4e2542b2973..9d8f105a3ed 100644 --- a/changelog.d/guardrails-section-registry.md +++ b/changelog.d/guardrails-section-registry.md @@ -7,5 +7,6 @@ The section and the classifier-denial rule are now registered with their CLAUDE.md anchors, and `ci-tests.yml` also runs the tests for changes to `CLAUDE.md`, `AGENTS.md`, `.github/copilot-instructions.md`, - `.claude/guardrails.md`, `.claude/skills/` and `agentic/commands/`, which + `.claude/guardrails.md`, `agentic/docs/project-guide.md`, `.claude/skills/` + and `agentic/commands/`, which `tests/unit/test_agent_instructions.py` and `tests/unit/skills` read. (#12494)