| name | long-task-watcher |
| description | Reliable progress monitoring for long-running background tasks (live audits, training, multi-step CI). Covers Monitor + tail buffering pitfalls, polling vs streaming patterns, post-mortem cat/grep, and the Petri ร GEODE eval log discovery flow. Triggered by "monitor", "tail -F", "progress", "background", "live audit", "stdbuf", "buffering" keywords. |
| user-invocable | false |
Long-Task Watcher
Use this skill when you need to track progress of a long-running background command โ geode audit --live, multi-sample evals, slow CI watches, training jobs โ and surface its events back into the conversation. The Monitor tool is the right primitive, but its usual tail -F | grep pattern has a sharp corner that bit us during Petri ร GEODE's N7' / N8 live runs.
The N7' / N8 incident (don't repeat this)
| ๋จ๊ณ | ๋์ | ๊ฒฐ๊ณผ |
|---|
Bash run_in_background: true ๋ก geode audit --live ์คํ | task id br6pe219i, output file ์ stdout ๋์ | OK |
๊ทธ ์งํ Monitor ์์ โ tail -F file | grep -E "samples \[0-9\]+/12|โ|error|..." | head -200 | task ๊ฐ ~3 ๋ถ ๋ง์ anthropic credit ๋ถ์กฑ์ผ๋ก ์ข
๋ฃ | OK |
| ๋งค์นญ ๋ผ์ธ 5๊ฐ (BadRequestError, credit balance, Task interrupted, Log:) ๊ฐ file ์ ์กด์ฌ | tail -F ๊ฐ ์์ ์์ ์ ๋ง์ง๋ง 10 ๋ผ์ธ์ emit + ์ ๋ผ์ธ์ inotify ๋ก watch | event 0๊ฑด |
| 60๋ถ ํ Monitor timeout | task ๋ ์ด๋ฏธ ์ข
๋ฃ๋ ์ํ โ tail -F ๊ฐ ์์ํ wait | event 0๊ฑด stuck |
์์ธ โ tail -F ๊ฐ pipe ์ ์ถ๋ ฅ๋ ๋์ stdout buffering. macOS BSD tail ์ line-buffered ์ด์ง๋ง background task ์ stdout flush ํ์ด๋ฐ, file inotify ํธ๋ฆฌ๊ฑฐ, Monitor ์ capture ํ์ด๋ฐ์ด ์ด๊ธ๋๋ฉด ๋งค์นญ ๋ผ์ธ์ด buffer ์์ ๊ฐํ ์๊ฐ ๋ด emit ๋์ง ์์. ๋ณธ case ์์ 5๊ฐ ๋งค์นญ ๋ผ์ธ์ ์ด byte ์๊ฐ ~250B ๋ผ stdout ์ 4KB block-buffer ํ๋๋ฅผ ๋ชป ์ฑ์ฐ๋ ์ํฉ๋ ์์ฌ.
์์ธ ๋ถ์: https://github.com/mangowhoiscloud/geode-eval-artifacts/blob/main/sil/audit-reports/2026-05-11-petri-2b-7-n7-prime-n8-n4.md ์ N7' Monitor ํ์์์ ์น์
.
์์ ํจํด โ ์ํฉ๋ณ ์ ํ
| ์ํฉ | ์ถ์ฒ ํจํด | ์ด์ |
|---|
| task ๊ฐ ๋น ๋ฅด๊ฒ ๋๋จ (~์๋ถ) | Bash run_in_background ๋ฐ์ ์๋ฃ ์๋ฆผ ํ `cat output | grep ...` |
| task ๊ฐ ๊ธธ๊ฒ ์งํ, ์งํ ๋ผ์ธ ์์ฃผ emit | Monitor + stdbuf -oL tail -F file | stdbuf -oL grep --line-buffered "..." | stdbuf ๊ฐ ๋ชจ๋ ๋จ๊ณ์ stdout ์ line-buffered ๋ก ๊ฐ์ . macOS ์์๋ brew install coreutils ํ ์ฌ์ฉ ๊ฐ๋ฅ |
| CI / poll ํ ์ธ๋ถ endpoint | Monitor + bash while-true polling loop (sleep 30s) + gh pr checks --json ๊ฐ์ ํ ๋ฒ ํธ์ถ | tail ์ ์. ์ธ๋ถ ์ํ๊ฐ ๊ณง ์ง์ค. ๋ณธ PoC ์ PR CI ๋ชจ๋ํฐ๋ง์ด ์ด ํจํด |
| task ์ PID ๊ฐ ์ฌ๋ผ์ง๋ฉด ์ข
๋ฃ | polling loop ์ kill -0 $PID 2>/dev/null || break ์ถ๊ฐ | ์ข
๋ฃ ์ ์๋ break โ Monitor timeout ์ ๊ธฐ๋ค๋ฆผ |
inspect_ai ์ Log: <path>.eval ๋ผ์ธ | task ์ข
๋ฃ ํ ์๋ archive โ ๋ณธ PoC ๋ _extract_eval_log_path + _maybe_auto_archive ๋ก ์ฒ๋ฆฌ | ์ฌ์ฉ์ ๋ช
์ ํธ์ถ ๋ถํ์ |
๊ถ์ฅ default โ "task ์ข
๋ฃ ํ cat-and-grep"
Bash(command="...your long command...", run_in_background=true)
Bash(command="cat /private/tmp/.../tasks/<task_id>.output | grep -E '<filter>'")
์ด ํจํด์:
- โ
๋ถ์ค ๋ผ์ธ ์์ (file ์ ์ฒด grep)
- โ
buffering ์ด์ ๋ฌด๊ด (file ์ด ์ด๋ฏธ stable)
- โ
Monitor timeout ์ํ ์์ (Monitor ์ ์)
- โ
๊ฐ์ฅ ๋จ์
๋จ์ : ์งํ ์ค ๊ฐ์์ฑ ์์. task ๊ฐ 30๋ถ ์ด์ ๊ฑธ๋ฆฌ๋ฉด ์ฌ์ฉ์๊ฐ ๋ต๋ตํ ์ ์์. ๊ทธ ๊ฒฝ์ฐ streaming ํจํด ์ถ๊ฐ.
Streaming โ stdbuf -oL ์๋ฌด
macOS BSD tail + grep + head pipeline:
tail -F file 2>/dev/null | grep -E --line-buffered "..." | head -200
stdbuf -oL tail -F file 2>/dev/null | stdbuf -oL grep -E "..." | head -200
stdbuf ๋ macOS ๊ธฐ๋ณธ์ ์์. brew install coreutils ํ์. ๋๋ gtail --line-buffered (gnu tail).
Petri ร GEODE ์ audit live monitoring ๊ถ์ฅ
geode audit --live ๊ฐ ๋๋๋ฉด inspect_ai ๊ฐ stdout ๋ง์ง๋ง ์ค์ Log: logs/<...>.eval emit. ๋ณธ PoC ๋ #1010 PR ๋ถํฐ run_audit ์ live ๋ถ๊ธฐ์์ ์๋์ผ๋ก:
_extract_eval_log_path(stdout, stderr) โ Log: <path> ์ ๊ท์ ๋งค์นญ
archive_eval(<path>) โ raw โ ~/.geode/petri/logs/, summary YAML โ docs/audits/eval-logs/
- ๊ฒฐ๊ณผ๋ฅผ
AuditReport.archived_raw / archived_summary ์ ๋ณด์กด
๋ฐ๋ผ์ ์ฌ์ฉ์/Claude ๋ task ๋๋ ํ report.archived_summary ๋ง ์ฝ์ผ๋ฉด ๋ชจ๋ sample ์ dim score / timing / seed_id ๊ฐ yaml ๋ก ์์ ๋ค์ด์ด. ๋ณ๋ monitor pattern ๋ถํ์.
์งํ ๊ฐ์์ฑ์ด ํ์ํ ๊ฒฝ์ฐ (1 sample ๋น ~30 ์ด ร ์ฌ๋ฌ sample), ๋ณธ skill ์ streaming ํจํด ์ฌ์ฉ.
์งง์ ์ฒดํฌ๋ฆฌ์คํธ
Reference
- ์ฌ๋ก:
https://github.com/mangowhoiscloud/geode-eval-artifacts/blob/main/sil/audit-reports/2026-05-11-petri-2b-7-n7-prime-n8-n4.md ยง N7' Monitor ํ์์์
- ์๋ archive:
plugins/petri_audit/runner.py _extract_eval_log_path / _maybe_auto_archive
- inspect_ai eval log ํ์:
logs/<ISO-timestamp>_audit_<id>.eval ๋์ Log: <path> line emit