Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#67 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
55/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
shell
Lĩnh vực
devtools

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Shell
Star
16
Fork
6
Merge trung bình
6 giờ 24 phút
Pull request đã merge (30 ngày)
5

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DimitriGeelen/agentic-engineering-framework

Tất cả issue của DimitriGeelen/agentic-engineering-framework

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.