diff --git a/prompts/claude-platform.md b/prompts/claude-platform.md index d019e87..0824f67 100644 --- a/prompts/claude-platform.md +++ b/prompts/claude-platform.md @@ -25,6 +25,15 @@ Therefore: - If something genuinely cannot complete within one turn, do not pretend a notification is coming. Finish with a concrete status and explicitly ask the user to send a follow-up message to continue. For recurring polling of CI/scheduled work, use the `schedule_task` / `watch_ci` tools, which DO re-invoke you. - Never leave an intermediate "I'll wait … I'll be notified" planning sentence as your final answer. +### Wait on a PID, not on `pgrep -f` + +A wait loop like `while pgrep -f "pytest evals"; do sleep 10; done` matches its own shell, whose command line contains the same text. It never sees the job exit and runs until its timeout (2026-11-11: an eval finished at 16:47 but the loop only ended at 16:53, and every later wait lost minutes the same way). + +- Save the PID when you start the job: `nohup > "$HOME/.tmp/job.log" 2>&1 & echo $! > "$HOME/.tmp/job.pid"` +- Wait on that PID: `pid=$(cat "$HOME/.tmp/job.pid"); while kill -0 "$pid" 2>/dev/null; do sleep 10; done` (in the same shell, `wait "$pid"` is enough) +- If you can only match by name, use a pattern that cannot match itself: `pgrep -f "[p]ytest evals"`. This only works if the plain text (`pytest evals`) appears nowhere else in that same command, so do not launch and wait in one command this way +- When the loop ends, check the log tail or exit status to make sure the job finished and the loop did not just hit its timeout + ## Media attachments When a locally generated image, screenshot, video, audio, or document should appear in Discord, include a `MEDIA:` directive on its own line with an absolute local path: diff --git a/prompts/codex-platform.md b/prompts/codex-platform.md index 0e9fb43..7abe46c 100644 --- a/prompts/codex-platform.md +++ b/prompts/codex-platform.md @@ -24,6 +24,7 @@ Your output is sent directly to the Discord group. - Prefer reading the current workspace before making assumptions - Modify only what is needed for the task - Verify changes when you can instead of claiming they should work +- When waiting for a long job, save its PID at launch and poll with `kill -0 "$pid"`. Do not poll with `pgrep -f ""` from a shell whose own command line contains that text: it matches itself and only exits at its timeout. If you must match by name, use `pgrep -f "[p]ytest evals"` - For CI/status/watch requests that require future follow-up, schedule `watch_ci` - Do not use generic recurring task registration from Codex - If the user wants a reminder or other non-CI recurring task, tell them to ask Claude/클코 to schedule it