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

fw metrics: quoted last_update timestamps crash the stale-task integer test

Đang mở Phù hợp với người mới
#46 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
78/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
cli, tooling

Hướng nghiên cứu

Bắt đầu bằng cách đọc metrics.sh quanh các dòng 96–99 và _date_to_epoch trong compat.sh, các dòng 32–57; tái hiện bằng một tệp tác vụ có giá trị last_update được đặt trong dấu ngoặc kép. Báo cáo đề xuất loại bỏ dấu ngoặc kép trong metrics.sh hoặc sửa hành vi fallback trong compat.sh. Hoàn tất khi các dấu thời gian được đặt trong dấu ngoặc kép không còn gây ra lỗi biểu thức số nguyên và báo cáo chỉ số vẫn xử lý an toàn các ngày không hợp lệ.

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.769
  • Project: 1409-sprind (shared-tooling mode)
  • Reported: 2026-09-21T15:49:38Z

Description

Symptom

fw metrics prints its report but also emits repeated stderr noise:

metrics.sh: line 99: [: 0
0: integer expression expected

The occurrence count scales with the number of active tasks whose last_update:
frontmatter is YAML-quoted (observed 25x in a 49-active-task repo this run).

Root cause, traced to source

  1. metrics.sh:96 extracts the timestamp: grep "^last_update:" "$f" | sed 's/last_update: //' | cut -dT -f1.
    When the YAML value is single-quoted (e.g. last_update: '2026-09-19T12:26:14Z' — which
    fw bvp estimate/fw task update write whenever the YAML dumper judges a quote necessary),
    the cut -dT -f1 leaves a stray leading quote: '2026-09-19.
  2. date -d "'2026-09-19" fails to parse (tested live: date: invalid date "'2026-09-19"),
    and so do the BSD-date and python3 fallbacks inside _date_to_epoch (compat.sh:32-57).
  3. _date_to_epoch's final fallback (compat.sh:56-57) does echo "0"; return 1 — it prints
    "0" to stdout and signals failure.
  4. The caller, metrics.sh:98, is last_ts=$(_date_to_epoch "$last_update" 2>/dev/null || echo 0).
    Because step 3 returned exit code 1, the || fires too, appending a second "0". last_ts
    is now the two-line string "0\n0".
  5. metrics.sh:99: if [ "$last_ts" -lt "$seven_days_ago" ] && ... — a two-line value fed to
    [ -lt ] produces exactly the observed error text.

Minimal repro

f=.tasks/active/<any task with a quoted last_update:>.md
raw=$(grep "^last_update:" "$f" | sed 's/last_update: //' | cut -dT -f1)
date -d "$raw" +%s   # fails with a leading-quote artifact

Suggested fix

Either (a) strip surrounding quotes before cut in metrics.sh:96 (e.g. pipe through
tr -d "\"'" first), or (b) make _date_to_epoch's final fallback silent (no echo) and let
callers own their own || echo 0, removing the double-echo. (a) is the smaller, more local fix.

Context

Found while investigating WR3-05 (SPRIND Streichliste value-review round 3), which observed
the symptom once without root-causing it. .agentic-framework/ is vendored/read-only in that
project (T-1017), so this report is filed rather than patched locally.


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.