Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto
#67 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
shell
Área
devtools

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Shell
Estrellas
16
Forks
6
Merge medio
6 h 24 min
PR fusionados (30 d)
5

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DimitriGeelen/agentic-engineering-framework

Todos los issues de DimitriGeelen/agentic-engineering-framework

Issues similares

Más issues de Shell/Bash

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.