Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

CTL-003 blames PreToolUse hook wiring for staleness its own writer schedules

Aperta
#67 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
shell
Ambito
devtools

Direzione di ricerca

Start with the CTL-003 check in agents/audit/audit.sh around line 2700 and the counter/recheck logic in agents/context/budget-gate.sh around lines 108 and 237-240. Compare the wall-clock freshness check with the invocation-based rewrite cadence; the downstream patch and regression test are described in the issue, but no test path in this repository is named. Done means CTL-003 distinguishes a live gate from a stale one using the counter heartbeat and reports only evidence it measured.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

  • Framework version: 1.6.258
  • Project: 050-email-archive (shared-tooling mode)
  • Reported: 2026-09-25T02:28:03Z

Description

Symptom

[WARN] CTL-003: Budget status file stale (5min old)
       Evidence: Budget gate may not be running during active session
       Mitigation: Check PreToolUse hook wiring for budget-gate.sh

Both the Evidence and Mitigation lines were false. Measured at the moment of the WARN, in an
actively-working session:

cat .context/working/.budget-gate-counter   -> 396   (incrementing)
stat -c %Y .context/working/.budget-status  -> 1790302032
date +%s                                    -> 1790302101   (69s old)

The hook was wired and firing. The same check reported PASS 23 minutes earlier in the same
session with no configuration change in between.

Root cause

Two thresholds set independently in two files, with nothing coupling them:

value source
gate rewrites .budget-status every 5 invocations (RECHECK_INTERVAL) agents/context/budget-gate.sh:108, early-exit at :240
CTL-003 requires the file younger than 5 minutes agents/audit/audit.sh:2700

The gate cadence is counted in tool calls; the check threshold is wall-clock. CTL-003 therefore
fires whenever five consecutive tool calls span more than five minutes, which is ordinary for a
session running long commands or doing extended reasoning. The check reports on how fast the
session is working, not on whether the gate is alive.

The 5-120 minute window makes it sharper: above 120 minutes CTL-003 PASSes again ("no active
session"). So it passes when the gate is definitely idle and warns when it is definitely working.

.budget-gate-counter is written on EVERY invocation (budget-gate.sh:237), before the recheck
early-exit, so it is a true heartbeat and was available but unused.

Patch applied downstream

-# CTL-003 OE: Budget Gate — status file is fresh during active session
+# CTL-003 OE: Budget Gate — the gate is alive during an active session
 BUDGET_FILE="$CONTEXT_DIR/working/.budget-status"
+GATE_COUNTER_FILE="$CONTEXT_DIR/working/.budget-gate-counter"
 if [ -f "$BUDGET_FILE" ]; then
     budget_age=$(find "$BUDGET_FILE" -mmin -5 2>/dev/null)
+    gate_live=$([ -f "$GATE_COUNTER_FILE" ] && find "$GATE_COUNTER_FILE" -mmin -5 2>/dev/null)
     if [ -n "$budget_age" ]; then
         pass "CTL-003: Budget status file fresh (< 5min old)"
+    elif [ -n "$gate_live" ]; then
+        pass "CTL-003: Budget gate live (counter touched <5min ago; status rewritten every Nth call)"
     else
         budget_mtime=$(stat -c %Y "$BUDGET_FILE" 2>/dev/null || echo 0)
         now=$(date +%s)
         age_min=$(( (now - budget_mtime) / 60 ))
+        gate_mtime=$(stat -c %Y "$GATE_COUNTER_FILE" 2>/dev/null || echo 0)
+        if [ "$gate_mtime" -eq 0 ]; then
+            gate_age_desc="never written"
+        else
+            gate_age_desc="$(( (now - gate_mtime) / 60 ))min old"
+        fi
         if [ "$age_min" -gt 120 ]; then
             pass "CTL-003: Budget status file stale (${age_min}min — no active session)"
         else
             warn "CTL-003: Budget status file stale (${age_min}min old)" \
-                 "Budget gate may not be running during active session" \
+                 "Gate counter is also stale (${gate_age_desc}) — the gate itself has not run" \
                  "Check PreToolUse hook wiring for budget-gate.sh"
         fi
     fi

A downstream regression test pins the contract:
src/backend/tests/ctl003GateLivenessContract.test.js (6 assertions, including that
budget-gate.sh still writes its counter before the recheck early-exit — if that ever changes,
the counter stops being a heartbeat and this fix silently becomes wrong again).

Class, not incident

This is the fourth check in this audit surface found asserting an unmeasured cause: a
probe-failure WARN that emitted hardcoded evidence contradicting reality (#65), a headline that
did not match its own payload (#64), and D3 commit velocity comparing a partial day against
complete-day averages. The general rule worth adopting: a control may report what it measured;
it may not assert a cause it never inspected.
Where discriminating evidence is already on disk,
it should be read before the claim is printed.


Reported via fw upstream report from field installation

Lingua principale
Shell
Stelle
16
Fork
6
Merge medio
6h 24m
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DimitriGeelen/agentic-engineering-framework

Tutte le issue di DimitriGeelen/agentic-engineering-framework

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.