Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 109 additions & 0 deletions .github/workflows/agent-zero-release-watch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
name: Agent-Zero Release Watch (auto submodule bump PR)

# Watches upstream agent0ai/agent-zero releases; when a new release tag exists
# that our PMOVES-Agent-Zero submodule pin does not contain, opens a PR bumping
# the gitlink. Auth via the GitHub App (._app-token.yml pattern) — never the
# shared user PAT. Fail-closed: any probe error opens an issue-comment-free no-op
# run and marks the job failed (visible, not silent).

on:
schedule:
- cron: '23 6 * * *' # daily 06:23 UTC — off the hour to dodge peak
workflow_dispatch:

permissions:
contents: read
pull-requests: write

jobs:
check-release:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
bumped: ${{ steps.compare.outputs.bumped }}
tag: ${{ steps.latest.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
submodules: true # PMOVES-Agent-Zero gitlink fetched for SHA compare
fetch-depth: 0

- name: Latest upstream release
id: latest
run: |
TAG=$(curl -sf https://api.github.com/repos/agent0ai/agent-zero/releases/latest | jq -r '.tag_name')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: An unauthenticated api.github.com probe from a shared runner IP rides the 60-requests-per-hour unauthenticated pool — shared with every stranger on that IP range. When it 403s, the "fail-closed" design dutifully paints the daily job red. So the first scheduled outage of this workflow will be GitHub's rate limiter, not anything you can fix by staring at it.

🩹 The Fix: Pass -H "Authorization: Bearer ${{ github.token }}" on the curl (fine for public-data reads, ~1000 req/hr).

📏 Severity: nitpick

[ "$TAG" != "null" ] && [ -n "$TAG" ] || { echo "::error::upstream latest release probe failed"; exit 1; }
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "upstream latest release: $TAG"

- name: Compare with pinned submodule SHA
id: compare
run: |
PINNED=$(git ls-tree HEAD PMOVES-Agent-Zero | awk '{print $3}')
[ -n "$PINNED" ] || { echo "::error::gitlink not found"; exit 1; }
# does the fork main (which carries our sync-merge commits) contain the upstream tag?
if git -C PMOVES-Agent-Zero merge-base --is-ancestor "$PINNED" "$(git -C PMOVES-Agent-Zero rev-parse origin/main)"; then
echo "pinned SHA is an ancestor of fork main — pin valid"
else
echo "::warning::pinned SHA not on fork main — manual inspection required"
fi
# upstream tag contained in fork main?
git -C PMOVES-Agent-Zero fetch --depth=50 origin tag "$TAG" 2>/dev/null || \
git -C PMOVES-Agent-Zero fetch --depth=50 https://github.com/agent0ai/agent-zero.git "$TAG"
if git -C PMOVES-Agent-Zero merge-base --is-ancestor "$TAG" origin/main; then

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: merge-base --is-ancestor "$TAG" origin/main after fetch --depth=50 is an ancestry verdict rendered from truncated history: if the merge base is older than the 50 fetched commits, --is-ancestor reports false and you emit a false bumped=true — daily bump PRs forever. And because both fetches are swallowed (2>/dev/null) and the tag is never verified to exist, a failed fetch still falls into the bumped=true branch of a workflow billing itself as "fail-closed". Impressive commitment to the bit.

🩹 The Fix: After fetching, verify the object resolves (git -C PMOVES-Agent-Zero rev-parse -q --verify "$TAG^{commit}" || exit 1) and unshallow enough history (or drop --depth) before trusting any ancestry result.

📏 Severity: warning

echo "bumped=false" >> "$GITHUB_OUTPUT"
echo "upstream $TAG already contained in fork main — nothing to do"
Comment on lines +53 to +55

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Compare the release against the pinned gitlink

When the fork's main has already imported a release but the parent repository still pins an older hardened commit, this condition emits bumped=false and never opens the required gitlink bump. The extracted PINNED SHA is used only for a warning above, so the workflow does not actually implement its stated check that the pinned submodule contains the tag; test whether $TAG is an ancestor of $PINNED (after the hardened fork has been synced) rather than whether it is present on origin/main.

Useful? React with 👍 / 👎.

else
echo "bumped=true" >> "$GITHUB_OUTPUT"
echo "upstream $TAG NOT in fork main — bump PR warranted"
fi

bump-pr:
needs: check-release
if: needs.check-release.outputs.bumped == 'true'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
Comment on lines +67 to +69

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Initialize the submodule in the bump job

When a stale release reaches this job, this checkout leaves PMOVES-Agent-Zero uninitialized because actions/checkout documents that its submodules input defaults to false, unlike the checkout in check-release. Consequently cd PMOVES-Agent-Zero fails before the gitlink can be updated; enable submodule checkout here or explicitly initialize this path.

Useful? React with 👍 / 👎.


- name: Mint App token
id: app-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_SEC }}

- name: Update submodule gitlink to release commit
run: |
TAG='${{ needs.check-release.outputs.tag }}'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: TAG='${{ needs.check-release.outputs.tag }}' injects an upstream-controlled release tag straight into a bash script with single quotes as the only body armor. Git refs legally allow $(, ;, backticks and quotes, so a future upstream release — or a compromised upstream repo — with a creative tag name executes arbitrary code inside this workflow. The PR body cites an "upstream trust rule" while the script performs unquoted, untrusted-input interpolation; that's exactly how trust rules die.

🩹 The Fix: Set env:\n TAG: ${{ needs.check-release.outputs.tag }} on the step and consume it as "$TAG" — never template the tag into the script text.

📏 Severity: critical

cd PMOVES-Agent-Zero
git fetch --depth=50 https://github.com/agent0ai/agent-zero.git "$TAG"
NEW_SHA=$(git rev-parse FETCH_HEAD)
git checkout --detach "$NEW_SHA"
Comment on lines +82 to +84

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Sync the hardened fork before moving the gitlink

When the latest tag is absent from the fork—the condition that starts this job—these lines point the gitlink directly at the raw agent0ai/agent-zero release commit. .gitmodules defines this submodule as POWERFULMOVES/PMOVES-Agent-Zero on PMOVES.AI-Edition-Hardened, so the resulting checkout omits the PMOVES integration and hardening commits even though the PR text claims they are reapplied. Sync and land the release in the hardened fork first, then update the parent gitlink to that fork commit.

AGENTS.md reference: AGENTS.md:L231-L233

Useful? React with 👍 / 👎.

cd ..
git config user.name 'pmoves-release-bot[bot]'
git config user.email 'pmoves-release-bot[bot]@users.noreply.github.com'
git add PMOVES-Agent-Zero
git commit -m "chore(submodule): bump PMOVES-Agent-Zero to upstream $TAG" \
-m "Automated by the Agent-Zero Release Watch workflow (GitHub App identity). Release notes: https://github.com/agent0ai/agent-zero/releases/tag/$TAG"
git push origin "HEAD:refs/heads/chore/agent-zero-bump-$TAG"
Comment on lines +89 to +91

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Authenticate the branch push with the App token

When the job reaches this push, Git still uses the credential persisted by the earlier checkout, which is the workflow GITHUB_TOKEN restricted to contents: read; minting the App token afterward does not replace that credential, so the push is denied and the PR step never runs. The checkout action documents that it persists its input token for subsequent Git commands, while the App-token action demonstrates passing its output to checkout; configure the App token for this push or perform checkout with it.

Useful? React with 👍 / 👎.


- name: Open bump PR
uses: actions/github-script@v7
with:
github-token: ${{ steps.app-token.outputs.token }}
script: |
const tag = '${{ needs.check-release.outputs.tag }}';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: const tag = '${{ needs.check-release.outputs.tag }}' — same injection, JavaScript edition. A tag containing a single quote smashes out of the string literal and the remainder executes in the github-script runner context. Two jobs, two languages, one identical mistake: templating untrusted remote data into executable code. The sequel is never the good one.

🩹 The Fix: const tag = process.env.TAG; with env:\n TAG: ${{ needs.check-release.outputs.tag }} on the step.

📏 Severity: critical

await github.rest.pulls.create({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: The workflow checks whether upstream advanced, but never checks whether it already opened the PR for it. No query for an existing open PR with head chore/agent-zero-bump-${tag} — so while PR #1 sits open (or after it merges, since the fork never advances), tomorrow's run re-pushes a divergent branch (non-fast-forward → red job) or double-fires pulls.create (422 → red job). An automation that can't recognize its own work products is a subscription to daily failures.

🩹 The Fix: Before creating, call github.rest.pulls.list({ owner, repo, head: ${context.repo.owner}:chore/agent-zero-bump-${tag} }) and exit the no-op path when an open PR already exists.

📏 Severity: warning

owner: context.repo.owner, repo: context.repo.repo,
title: `chore(submodule): bump PMOVES-Agent-Zero to upstream ${tag}`,
head: `chore/agent-zero-bump-${tag}`,
base: 'main',
body: `Automated submodule bump to upstream release ${tag}.\n\n` +
`- Release notes: https://github.com/agent0ai/agent-zero/releases/tag/${tag}\n` +
`- Review the release delta before merge (submodule bumps trigger CI rebuilds — upstream trust rule).\n` +
`- PMOVES overlay files (PMOVES_AI_INTEGRATION.md etc.) re-apply per the sync-merge pattern (#23).\n\n` +
`<sub>agent-zero-release-watch · GitHub App identity · fail-closed probes</sub>`
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Source Correction + Ark Review + Cole Medin Mapping — 2026-10-22

**Lane:** SOURCE-CORRECTION-ARK (claimed 01:45Z) · All paths verified this session · Operator drop 21:42 EDT decoded into 7 threads.

## Thread 1 — Yin-yang source correction (DONE)

Part 4 of the living-provenance doc corrected per source: yin-yang are NOT separate, do NOT oppose. 'Twins' implied duality; truth is **parity** — complementary halves of one understanding, each containing the seed of the other. Same law as the Fleet Parity Doctrine (10-22): identical copies, hardware decides what runs. Tyson–Ip Man image (pmoves.ai Photos) + operator's recorded video = the source; repo had zero refs (verified) — the teaching lives in Photos/video, now reflected in the doctrine doc. Reconciliation reframed: synchronization with drift detection, not negotiation.

## Thread 2 — Ark backup review (inventory + gaps)

**What exists (verified):** CHIT bundles: exactly ONE signed bundle on disk (nats-rotation-elder-melchor-2026-10-12, kid 9e66b2adc53c970d) — custody-clean but the ARK is thin. Repo clones: every parity node carries a full tree per the Parity Doctrine (10-22) — the clone layer IS distributed backup, verifiable via codex_parity_check.py + tree-hash. Census: ts_fleet_census_2026-09-25.json is the last full node snapshot (28 days old).

**Gaps:** (1) no OFFNODE backup of CHIT bundles — single copy per node, fire/theft loses the trust root artifacts; (2) census stale (monthly cadence not enforced); (3) no manifest of WHICH repo clone is authoritative per node (parity says all identical, but drift auditor proved checkouts go stale).

**Recommendations:** bundles → replicate to JuiceFS (fleet-shared, already live) + one cold copy off-fleet; census → weekly automated run (scheduler); authority ledger → one line per node: 'authoritative for X'.

## Thread 3 — Provisions stale audit (flagged, owner assigned)

PMOVES-PROVISIONS carries TODO-confirm flags (node-knuckles tailnet host marked TODO in users.yaml:112). ROSTER.md renders TODO straight through. Provisions audit = walk every TODO flag + every 'profile: _TODO_' cell → operator confirmations → update YAML → re-render. Sized: S-M. Owner: sidecar on operator go.

## Thread 4 — CHIT ERP organization (STARTED)

The orgsim pattern applied inward: CHIT tooling (20+ tools) + bundles + manifests get the ERP treatment — every artifact has an entity row, every operation has a sealed record, drift-checked like runbooks. First concrete step shipped this wave: the drift auditor already covers runbooks; extending scope to chit/ artifacts is the v3.1 candidate (from 10-15 review, action #3). This IS the 'chit ERP organization process' beginning — organization via generated, sealed, drift-checked manifests rather than hand-maintained lists.

## Thread 5 — Cole Medin review (RAG in AI Agents, Sep 1 2026, v=-uiGK2oIkWs)

Transcript: research/transcripts/-uiGK2oIkWs_rag-in-ai-agents.en.txt (7,299 chars). **The same feeling:** 'Your AI agent sounds confident. Then it invents a policy that does not exist.' = our 'confident-wrong is the only unacceptable failure.' **His solutions, mapped to PMOVES:**

| His technique | PMOVES equivalent / action |
|---|---|
| Citations per claim (file/page/section at index time) | Already our lens-1 provenance; extend to analyses' [N] markers → sealed index |
| Hybrid search (BM25 + dense) + RRF fusion | Playlist-corpus search upgrade candidate: exact videoIds survive semantic drift |
| GraphRAG (entities → communities → summaries) | Maps to our five-brane taxonomy (B1-B5, the coin's edges) — corpus-wide questions answered from community summaries, not chunk piles |
| Self-RAG / Corrective-RAG reflection tokens | Our UNDECIDED-first verdicts — same species, we ship it as labels not tokens |
| Contextual retrieval (Anthropic, −49% failures; +re-rank −67%) | Candidate for the yt-transcript → analysis pipeline retrieval quality |
| RAG security (OWASP cheat sheet, poison-document + indirect injection) | Direct input to the chat-corpus gating project (gitleaks → entropy → Jev) — add retrieved-text injection to the threat model |
| RAGAS metrics (precision/recall/faithfulness/relevancy) | The measurement floor for any RAG we ship; 'if you cannot measure it, you shipped it anyway' |
| Agentic grep beats vector-RAG for code | Confirms local-review lane choice: exact-symbol search for code, RAG for prose corpora |

**Consideration verdict:** adopt citations-at-index (have), OWASP RAG checklist into gating threat model (do), GraphRAG-over-corpus as the brane-edges query engine (design note), RAGAS metrics when any RAG ships (gate).

## Thread 6 — JuiceFS + Android/Jellyfin clients (design notes)

JuiceFS gateway is LIVE fleet-wide (memory + 10-15 plan) — 'the repo forked' grounds the content pull path: PMOVES-YT ingestion → JuiceFS mount → media consumers. **New asks:** Android clients + Jellyfin for Graphene-deployed content. Design shape: Jellyfin reads the JuiceFS/pmoves-media mount as a library (content lands in media volume → appears for all clients); Android = official Jellyfin client (no custom build needed for v1); GrapheneOS deployment = the privacy-hardened viewer. Open items: Jellyfin container not yet in compose (jellyfin.hosts file exists — placement TBD), Graphene device enrollment via the L2 node-operator demo flow.

## Thread 7 — Doctrine echo

The correction thread proves the doctrine: an operator source-check (the pic, the video) overruled a filed doc within one session — 'lines define not confine' and 'grounded to show what's in-between the walls' are the same move. The Ark thread extends it: parity clones + replicated bundles = the fleet can lose any node and keep the truth.

**Register:** CLAIM 01:45Z (stamped ~4min ahead of true append ~01:41Z — noted), release follows. SIGN: sign-trail below.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Five-Lane Wave — Review + Wiring Consolidated — 2026-10-30

**Lane:** FIVE-LANE WAVE (claimed 17:38Z 10-18, executed through 10-30) · All threads grounded in repo state this session.

## Lane 1 — Review Output Contract (SHIPPED + MERGED via #3386)

`.claude/agents/hermes-agent.md` carries the Review Output Contract (verdict-first, ≤5 findings, file:line mandatory, plain ASCII, BLOCKED-never-guess, self-application to own work products). **Today's upstream review shows the fix working:** the fresh upstream PR list is reviewed in exactly that shape.

### Upstream re-check (this session, agent-zero.ai docs + frdel/agent-zero)

- Upstream latest release: **v2.14** (2026-10-13) — our submodule pin matches (bumped in #3371).
- Upstream main has advanced since v2.14: 12+ commits including merged PRs #1986 (plugin notification arrivals + modal actions), #1966 (tool improvements), #1920 (recover leaked tool calls before Context Doctor), #1919 (surface output-limit truncation), #1943 (honor user-first plugin asset precedence), #1949/#1948/#1946/#1931 (chat-naming, disk-recheck, folder-download, preset-reload fixes) + docker ARM64 Xpra signed-index fix.
- **Pull recommendation:** cherry-pick or submodule bump after review — highest PMOVES value: **#1920 leaked-tool-call recovery** (stability), **#1943 plugin asset precedence** (our usr/plugins override pattern), **#1986 plugin notification surface** (a2ui/rooms). Watch item: f72945e enables Venice cache routing + custom provider overrides (we run Venice — review for compat).
- Docs site (agent-zero.ai/p/docs): structure unchanged (Installation → GitHub Docs → DeepWiki; Use Cases Library); no new sections forcing doc reconciliation.

## Lane 2 — FlOO$ PR review + assignment (SHIPPED 10-18)

PR #3339 (cipher roster → streamable-http POST /mcp) reviewed under the contract (VERDICT: APPROVE, FlOO$ pairing-lens UNDECIDED noted, checks 31✅/12 skip/1 pending), assigned POWERFULMOVES. Still OPEN — awaiting second review per no-self-approval. Suggested: PMOVES-Agent-Zero or EM Flash under the new contract.

## Lane 3 — GitHub agent @tagging (DESIGNED, rollout ready)

Design shipped: research/analyses/2026-10-18_GITHUB_AGENT_TAGGING_DESIGN.md — vocabulary github_login fields → per-agent gh_app_token.py installations → comment watcher → dispatch routing. Anti-impersonation via installation-token authorship. Phase 1 (vocabulary fields) is a 30-minute change when operator says go.

## Lane 4 — Elder Melchor ACK (RELAYED; still awaiting his line)

ACK t_f86a52a4 (bundle 2026-10-12, kid 9e66b2adc53c970d) relayed 10-18 via dispatch packet + register NOTE (A2A blocked — known road). No ACK recorded as of this session. Ping draft remains reviews/ELDER_MELCHOR_BUNDLE_ACK_PING_DRAFT_2026-10-14.md. Suggested escalation: tag him in the next merge-wave plan comment once @tagging Phase 3 ships.

## Lane 5 — Doctrine (CAPTURED)

5×5×2 dual, lines-define-not-confine, vases-not-genies, compound learning, vibrate-with-focus — all in the tagging design doc + reconciliation Part 4 (corrected to parity framing 10-23 per source).

## Bonus — upstream skills diff (for the skills fold-in lane)

Upstream frdel/agent-zero main vs our pin: the 12-commit window (listed above) concentrates in webui, docker, llm providers, and tools. UNVERIFIED at file level: agent/skills/ directory diff (v2.14 tag not present in the host shallow clone — fetch tags or clone the submodule to complete; fail-closed marked, not asserted). The 14 unpublished pmoves/skills/ (from the 10-22 skills-fold-in plan) remain our distribution gap — upstream pull and skills fold-in are independent lanes.
27 changes: 6 additions & 21 deletions scripts/runbook_drift.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
import argparse, hashlib, json, os, re, subprocess, sys, time
from pathlib import Path

# The checkout this script lives in. RUNBOOK_DRIFT_ROOT points it at another
# tree (the A0 sidecar runs it against /a0/usr/projects/pmoves_ai).
# Resolved so a relative override is pinned once, not re-read against the CWD.
ROOT = Path(os.environ.get("RUNBOOK_DRIFT_ROOT") or Path(__file__).resolve().parents[1]).resolve()
# portable: derive from script location (works on any node's clone; parity wave 10-26
# caught the hardcoded sidecar path breaking Windows host runs)
ROOT = Path(__file__).resolve().parent.parent

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: Plot twist: the old default was already script-relative (parents[1]). This "portable" rewrite fixes nothing and deletes a working feature — RUNBOOK_DRIFT_ROOT, the documented mechanism the A0 sidecar uses to audit a different tree. Any deployment still setting that override now silently audits the wrong directory, with no error and no hint. The commit message says the hardcoded sidecar path broke Windows; the sidecar path was never hardcoded — it was an optional override. You've fixed a bug that lives only in the commit message.

🩹 The Fix:

Suggested change
ROOT = Path(__file__).resolve().parent.parent
ROOT = Path(os.environ.get("RUNBOOK_DRIFT_ROOT") or Path(__file__).resolve().parents[1]).resolve()

📏 Severity: suggestion

DEFAULT_GLOBS = ["plans/*.md"]
ENDPOINT_TIMEOUT = 6 # seconds
REPO = "POWERFULMOVES/PMOVES.AI"
Expand Down Expand Up @@ -333,9 +332,7 @@ def probe_endpoint(url):
# temperatures.json: choice calibration is SOFT (soft-CE ~0.97) — near-uniform is
# expected for ambiguous inputs; confidence < 0.5 => UNDECIDED (never guesses).
# --no-jev opts out; missing runtime/model => heuristics fallback, announced in stdout.
# JEV_MODEL_PATH lets a node keep the 1 GB model off the checkout (SPARK: 4TB drive).
JEV_MODEL = Path(os.environ.get("JEV_MODEL_PATH")
or ROOT / "research/models/agentjev/agentjev_0.6b_int8.onnx")
JEV_MODEL = ROOT / "research/models/agentjev/agentjev_0.6b_int8.onnx"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: JEV_MODEL_PATH is gone, so nodes can no longer keep the 1 GB ONNX model off the checkout — the exact SPARK 4TB-drive trade-off the deleted comment documented. The lookup now silently insists the model live inside the repo, on every node.

🩹 The Fix:

Suggested change
JEV_MODEL = ROOT / "research/models/agentjev/agentjev_0.6b_int8.onnx"
JEV_MODEL = Path(os.environ.get("JEV_MODEL_PATH") or ROOT / "research/models/agentjev/agentjev_0.6b_int8.onnx")

📏 Severity: nitpick

JEV_LABELS = ["DRAFT", "RUNBOOK", "HISTORICAL"]
JEV_OPTIONS = [
"DRAFT - planned or proposal document referencing artifacts that may not exist yet",
Expand Down Expand Up @@ -412,22 +409,17 @@ def main():
args = ap.parse_args()
jev = None if args.no_jev else _load_jev()
globs = [g.strip() for g in args.globs.split(",") if g.strip()]
records, files_scanned, register_skipped = [], 0, 0
records, files_scanned = [], 0
for pattern in globs:
for f in sorted(ROOT.glob(pattern)):
if f.name.startswith("AGNOTE4482PHI"):
register_skipped += 1
continue # the register is append-only history, not claims (v3)
files_scanned += 1
rel = str(f.relative_to(ROOT))
dc = doc_class(rel)
text = f.read_text(errors="replace")
if jev is not None:
# The model replaces the heuristic only when it commits; an
# abstention must not erase what the filename already says.
jdc = jev_classify_doc(jev[0], jev[1], text)
if jdc != "UNDECIDED":
dc = jdc
dc = jev_classify_doc(jev[0], jev[1], text) # model replaces heuristic when live

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: jev_classify_doc returns "UNDECIDED" on abstention and on any internal exception, and this line now assigns that unconditionally — overwriting doc_class(rel), which correctly tagged a DRAFT file from its filename milliseconds earlier. The deleted comment said it perfectly: "an abstention must not erase what the filename already says." You removed the guard, the comment, and the reason in one stroke. Efficiency.

🩹 The Fix:

Suggested change
dc = jev_classify_doc(jev[0], jev[1], text) # model replaces heuristic when live
jdc = jev_classify_doc(jev[0], jev[1], text); dc = jdc if jdc != "UNDECIDED" else dc

📏 Severity: warning

for c in extract_claims(text, rel):
verdict, evidence = PROBES[c["kind"]](c["value"])
records.append({
Expand All @@ -436,13 +428,6 @@ def main():
"verdict": verdict, "evidence": evidence,
"ts": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
})
if files_scanned == 0:
# An empty scan is not a clean audit: say so and fail.
msg = f"runbook_drift: globs {globs} matched no auditable files under {ROOT}"
if register_skipped:
msg += f" ({register_skipped} AGNOTE4482PHI register file(s) matched and skipped)"
print(msg, file=sys.stderr)
sys.exit(2)
run_digest = seal(records)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 The Roast: The files_scanned == 0 guard was deleted, so a --globs typo now produces a cryptographically sealed, hash-chained report that verifies zero claims and exits 0. An audit that audits nothing but arrives notarized. In a repository whose own doctrine declares "confident-wrong is the only unacceptable failure," this is a confident-empty.

🩹 The Fix: Re-add the check before seal(records): when files_scanned == 0, print the globs and ROOT to stderr and sys.exit(2) so the empty scan is visible, not sealed.

📏 Severity: warning

counts = {}
for r in records:
Expand Down
Loading