fix: address review feedback on prediction agent (#140)

- Remove CLAUDE_TIMEOUT no-op override — inherit factory default (7200s) from env.sh
- Use anchored grep -qxF "NO_PREDICTIONS" to avoid false early exits
- Fetch closed PRs (state=closed, merged_at filter) instead of open — captures merged activity signals
- Parse staleness age from filename date (YYYY-MM-DD.json) instead of file mtime
- Log a warning when date -d falls back due to non-GNU date
- Add comment explaining global lock serialisation trade-off

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
openhands 2026-03-19 10:13:22 +00:00
parent c06cf81031
commit d2f788239a
2 changed files with 18 additions and 7 deletions

View file

@ -17,6 +17,9 @@ FACTORY_ROOT="$(dirname "$SCRIPT_DIR")"
source "$FACTORY_ROOT/lib/env.sh"
LOG_FILE="$SCRIPT_DIR/prediction.log"
# Global lock — projects are processed serially. If a single run takes longer
# than the cron interval (1h), the next cron invocation will find the lock held
# and exit silently. That is acceptable: LLM calls are cheap to skip.
LOCK_FILE="/tmp/prediction-poll.lock"
PROJECTS_DIR="$FACTORY_ROOT/projects"