Skip to content

security(sidecar): sync copies and skills pin from v0.70.1 - #48

Merged
noelmcloughlin merged 1 commit into
mainfrom
knowledge-sync
Nov 19, 2026
Merged

noelmcloughlin merged 1 commit into
mainfrom
knowledge-sync

Conversation

@noelmcloughlin

@noelmcloughlin noelmcloughlin commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Brings the sidecar copies and the skills pin of this repository to Knowledge Trust Ladder v0.70.1, from v0.69.2.

Refreshed on 2026-11-19. This pull request proposed v0.70.0 before. This run replaced its commits with a sync to v0.70.1, so read the diff again.

The sync writes the release's copy over these files. The sync job's summary on the run's page names any that held a local edit:

  • .lokf/m365/ktl-docent-m365.md
  • .lokf/scripts/knowledge-report.sh
  • .lokf/scripts/knowledge-sync.sh

The skills pin, ktl in .lokf/pyproject.toml, moves from v0.69.2 to v0.70.1, and .lokf/uv.lock holds the hashes uv resolved for it in this run.

Workflow changes held for a person

This release also changes these workflows. They are not on the branch: a workflow pushed with a token runs on that push, with this repository's secrets, before anyone has read it.

  • .github/workflows/knowledge-release.yaml
  • .github/workflows/knowledge-sync.yaml
The held diff
diff --git a/.github/workflows/knowledge-release.yaml b/.github/workflows/knowledge-release.yaml
index 668303c..550295c 100644
--- a/.github/workflows/knowledge-release.yaml
+++ b/.github/workflows/knowledge-release.yaml
@@ -86,6 +86,14 @@ jobs:
         with:
           egress-policy: audit
 
+      # The input is held to the shape of a tag before anything names a ref by it.
+      - name: Check the tag is a release tag
+        run: |
+          if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
+            echo "::error::'$TAG' is not vMAJOR.MINOR.PATCH."
+            exit 1
+          fi
+
       # The bundle as it stood at the tag, not at the branch head.
       - name: Checkout
         uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -643,5 +651,11 @@ jobs:
           GH_REPO: ${{ github.repository }}
         run: |
           shopt -s nullglob
-          gh release upload "$TAG" ./*.zip ./*.yaml ./*.tsv ./*.sha256 ./*.intoto.jsonl --clobber
+          # gh retries a slow upload itself, and a retry of one that reached
+          # GitHub fails with "already exists"; --clobber makes a new attempt safe.
+          for attempt in 1 2 3; do
+            gh release upload "$TAG" ./*.zip ./*.yaml ./*.tsv ./*.sha256 ./*.intoto.jsonl --clobber && exit 0
+            [ "$attempt" = 3 ] || { echo "::warning::The upload to $TAG failed (attempt $attempt); trying again."; sleep 15; }
+          done
+          exit 1
         working-directory: ${{ runner.temp }}/release
diff --git a/.github/workflows/knowledge-sync.yaml b/.github/workflows/knowledge-sync.yaml
index 7929478..789f424 100644
--- a/.github/workflows/knowledge-sync.yaml
+++ b/.github/workflows/knowledge-sync.yaml
@@ -45,7 +45,10 @@ name: Knowledge sync
 # request, and applied by a person who has read them. Or, with the
 # repository variable KNOWLEDGE_SYNC_REVIEW_ENVIRONMENT naming an
 # Environment with required reviewers, `review` waits for one of them and
-# `push-workflows` then pushes the changes as a second commit.
+# `push-workflows` then pushes the changes as a second commit. An
+# Environment with no required reviewer counts as unset: the changes wait
+# for a person and neither job runs. Reviewers are off until a host wants
+# that second gate.
 #
 # `publish` pushes and opens the pull request with the KNOWLEDGE_SYNC_TOKEN
 # secret, since a pull request opened with GITHUB_TOKEN starts no checks,
@@ -106,8 +109,10 @@ jobs:
     permissions:
       contents: read # read the pin out of .lokf/pyproject.toml, here and on the sync branch
       pull-requests: read # read this workflow's pull requests
+      actions: read # read the review Environment's rules
     outputs:
       tag: ${{ steps.read.outputs.tag }}
+      review: ${{ steps.review.outputs.review }}
       from: ${{ steps.read.outputs.from }}
       open: ${{ steps.read.outputs.open }}
       open_tag: ${{ steps.read.outputs.open_tag }}
@@ -193,7 +198,7 @@ jobs:
           newest() {
             gh api "repos/${GITHUB_REPOSITORY}/pulls?head=${GITHUB_REPOSITORY_OWNER}:$1&state=all&sort=created&direction=desc&per_page=5" \
               --jq '.[] | [.number, .state, (.merged_at != null), .head.sha, (.head.repo.full_name // "-")] | @tsv' \
-              | awk -F'\t' -v repo="$GITHUB_REPOSITORY" '$1 ~ /^[0-9]+$/ && $4 ~ /^[0-9a-f]{40}$/ && $5 == repo { print; exit }'
+              | awk -F'\t' -v repo="$GITHUB_REPOSITORY" '!done && $1 ~ /^[0-9]+$/ && $4 ~ /^[0-9a-f]{40}$/ && $5 == repo { print; done = 1 }'
           }
           # The pin .lokf/pyproject.toml carries at a commit, or nothing.
           pin_at() {
@@ -271,6 +276,27 @@ jobs:
           } >> "$GITHUB_OUTPUT"
           [ -z "$tag" ] || echo "Syncing to $tag, from ${pin:-no pin}."
 
+      # The review Environment counts with a required reviewer alone: with
+      # none, its approval would be nobody's. Then the workflow changes a
+      # release brings wait for a person, as with the variable unset, and
+      # the two review jobs do not run.
+      - name: Read whether the review Environment has a required reviewer
+        id: review
+        if: steps.read.outputs.tag != '' && vars.KNOWLEDGE_SYNC_REVIEW_ENVIRONMENT != ''
+        env:
+          GH_TOKEN: ${{ github.token }}
+          REVIEW_ENV: ${{ vars.KNOWLEDGE_SYNC_REVIEW_ENVIRONMENT }}
+        run: |
+          set -euo pipefail
+          name="$(jq -rn --arg e "$REVIEW_ENV" '$e | @uri')"
+          if ! n="$(gh api "repos/${GITHUB_REPOSITORY}/environments/${name}" --jq '[.protection_rules[]? | select(.type == "required_reviewers") | .reviewers[]?] | length')"; then
+            echo "::warning::The '${REVIEW_ENV}' Environment could not be read, so any workflow changes this release brings wait for a person, as the pull request says."
+            n=0
+          elif [ "$n" = 0 ]; then
+            echo "::notice::The '${REVIEW_ENV}' Environment has no required reviewer, so any workflow changes this release brings wait for a person, as the pull request says."
+          fi
+          if [ "$n" = 0 ]; then echo "review=false" >> "$GITHUB_OUTPUT"; else echo "review=true" >> "$GITHUB_OUTPUT"; fi
+
   sync:
     name: Sync the copies and the pin (read-only)
     needs: earlier
@@ -315,6 +341,8 @@ jobs:
         id: run
         env:
           TAG: ${{ needs.earlier.outputs.tag }}
+          # A run asked for a release just published waits for the index to show it.
+          KNOWLEDGE_SYNC_INDEX_WAIT: ${{ github.event_name == 'workflow_dispatch' && inputs.tag != '' && '600' || '0' }}
           UV_INDEX_KNOWLEDGE_USERNAME: ${{ secrets.UV_INDEX_KNOWLEDGE_USERNAME }}
           UV_INDEX_KNOWLEDGE_PASSWORD: ${{ secrets.UV_INDEX_KNOWLEDGE_PASSWORD }}
         run: |
@@ -364,8 +392,9 @@ jobs:
     if: needs.sync.outputs.changed == 'true'
     runs-on: ${{ vars.KNOWLEDGE_RUNNER || 'ubuntu-latest' }}
     timeout-minutes: 10
-    # The two jobs that push take turns. A run waiting for the review
-    # Environment holds no turn, so it blocks no later sync.
+    # One publish at a time. A run waiting for the review Environment holds
+    # no turn, so it blocks no later sync; the approved push has a group of
+    # its own, since GitHub drops the older of two runs waiting for one.
     concurrency:
       group: knowledge-sync
       cancel-in-progress: false
@@ -416,6 +445,8 @@ jobs:
         id: check
         env:
           TAG: ${{ needs.earlier.outputs.tag }}
+          # A run asked for a release just published waits for the index to show it.
+          KNOWLEDGE_SYNC_INDEX_WAIT: ${{ github.event_name == 'workflow_dispatch' && inputs.tag != '' && '600' || '0' }}
           UV_INDEX_KNOWLEDGE_USERNAME: ${{ secrets.UV_INDEX_KNOWLEDGE_USERNAME }}
           UV_INDEX_KNOWLEDGE_PASSWORD: ${{ secrets.UV_INDEX_KNOWLEDGE_PASSWORD }}
         run: |
@@ -455,6 +486,7 @@ jobs:
           LEASE: ${{ needs.earlier.outputs.branch }}
           HELD: ${{ steps.check.outputs.held }}
           REVIEW_ENV: ${{ vars.KNOWLEDGE_SYNC_REVIEW_ENVIRONMENT }}
+          REVIEW: ${{ needs.earlier.outputs.review }}
         run: |
           set -euo pipefail
           branch="knowledge-sync"
@@ -498,9 +530,12 @@ jobs:
               echo '```'
               echo
               echo "Without gh, the artifact is on the run's page: ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}."
-              if [ -n "$REVIEW_ENV" ]; then
+              if [ "$REVIEW" = true ]; then
                 echo
                 echo "Or approve the run's ${bt}Approve the held workflow changes${bt} job as a reviewer of the ${bt}${REVIEW_ENV}${bt} Environment, and the workflow pushes them here as a second commit."
+              elif [ -n "$REVIEW_ENV" ]; then
+                echo
+                echo "The ${bt}${REVIEW_ENV}${bt} Environment has no required reviewer, so the workflow pushes nothing by itself; give it one to let an approval push them next time."
               fi
             } > "$heldmd"
             cat "$heldmd" >> "$GITHUB_STEP_SUMMARY"
@@ -594,13 +629,13 @@ jobs:
   # and they run from that push on. Set the Environment up under Settings ->
   # Environments: add required reviewers and limit it to the default
   # branch. It holds no secret. "Prevent self-review" helps only where a
-  # second person can approve. An Environment with no required reviewers
-  # would approve itself, so the next job checks for them before it pushes
-  # anything.
+  # second person can approve. An Environment with no required reviewer
+  # would approve itself, so `earlier` reads its rules and neither job runs
+  # then, and the next job checks again before it pushes anything.
   review:
     name: Approve the held workflow changes
-    needs: [publish]
-    if: needs.publish.outputs.held == 'true' && needs.publish.outputs.commit != '' && vars.KNOWLEDGE_SYNC_REVIEW_ENVIRONMENT != ''
+    needs: [earlier, publish]
+    if: needs.publish.outputs.held == 'true' && needs.publish.outputs.commit != '' && needs.earlier.outputs.review == 'true'
     runs-on: ${{ vars.KNOWLEDGE_RUNNER || 'ubuntu-latest' }}
     timeout-minutes: 5
     permissions: {}
@@ -623,8 +658,11 @@ jobs:
     needs: [earlier, publish, review]
     runs-on: ${{ vars.KNOWLEDGE_RUNNER || 'ubuntu-latest' }}
     timeout-minutes: 10
+    # Its own group: two approvals waiting behind one publish would lose
+    # the older. The push is leased to the pull request's commit, so a
+    # publish that lands first refuses it, and nothing is lost.
     concurrency:
-      group: knowledge-sync
+      group: knowledge-sync-workflows
       cancel-in-progress: false
     environment:
       name: knowledge-sync
@@ -647,9 +685,12 @@ jobs:
         run: |
           set -euo pipefail
           name="$(jq -rn --arg e "$REVIEW_ENV" '$e | @uri')"
-          n="$(gh api "repos/${GITHUB_REPOSITORY}/environments/${name}" --jq '[.protection_rules[]? | select(.type == "required_reviewers") | .reviewers[]?] | length' 2>/dev/null || echo 0)"
+          if ! n="$(gh api "repos/${GITHUB_REPOSITORY}/environments/${name}" --jq '[.protection_rules[]? | select(.type == "required_reviewers") | .reviewers[]?] | length')"; then
+            echo "::error::The '${REVIEW_ENV}' Environment could not be read, so nothing is pushed; run the job again, or apply the held changes by hand as the pull request says."
+            exit 1
+          fi
           if [ "$n" = 0 ]; then
-            echo "::error::The '${REVIEW_ENV}' Environment has no required reviewers, so its approval proves nothing. Nothing is pushed; apply the held changes by hand as the pull request says."
+            echo "::error::The '${REVIEW_ENV}' Environment lost its required reviewers while this run waited, so its approval proves nothing. Nothing is pushed; apply the held changes by hand as the pull request says."
             exit 1
           fi
 

Once you have read them, apply them on this branch:

gh run download 44599072694 --repo lmodel/slsa --name knowledge-sync-workflows
git switch knowledge-sync && git pull
git apply workflows.patch && git add .github/workflows
git commit -m "security(sidecar): sync workflows from v0.70.1" && git push

Without gh, the artifact is on the run's page: https://github.com/lmodel/slsa/actions/runs/44599072694.

Or approve the run's Approve the held workflow changes job as a reviewer of the knowledge-sync-review Environment, and the workflow pushes them here as a second commit.

This repository's own checks run on this pull request, on the synced copies, with a read-only token. A failure there is a bundle to fix in this pull request, or the gate fails on it after the merge.

CHANGELOG.md has the entry under its Unreleased heading and Security.

Reviewer checklist

  • The diff touches only the sidecar's copies, the site's copies, .lokf/pyproject.toml, .lokf/uv.lock and CHANGELOG.md.
  • .lokf/pyproject.toml changes on the ktl line alone, to the release, and .lokf/uv.lock on the ktl entry alone.
  • Any workflow changes held above are read and applied on this branch, or left for the next sync on purpose.
  • You read the release notes of Knowledge Trust Ladder for a step the sync cannot do, such as setting a new variable or secret. If there is one, you do it in this pull request or straight after the merge.
  • Where the gate fails on a convention the release adds or tightens, such as rule 16's one excerpt for each source id, the bundle is fixed through the pen in a pull request of its own, and this one runs again once that merges.
  • CHANGELOG.md has the entry under ## [Unreleased] and ### Security, and the title carries security(sidecar):, so the merge releases.

@noelmcloughlin noelmcloughlin changed the title security(sidecar): sync copies and skills pin from v0.70.0 security(sidecar): sync copies and skills pin from v0.70.1 Nov 19, 2026
@noelmcloughlin
noelmcloughlin merged commit 0c3aa5b into main Nov 19, 2026
23 checks passed
@noelmcloughlin
noelmcloughlin deleted the knowledge-sync branch November 19, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant