initial: blog-app snapshot

This commit is contained in:
omo
2026-08-17 17:11:27 +08:00
commit 65cb9d5ead
125 changed files with 14720 additions and 0 deletions

View File

@@ -0,0 +1,106 @@
# Build1 Patch Summary — scripts/daily_watchdog.py
Date: 2026-08-16 · Workspace: /home/yi/opencode-blog-showcase/blog-app
## Patch summary (surgical edits, file 596→853 lines)
1. **Per-project source accounting**
- `collect_all()` now returns `(project_results, source_counts: dict[str,int], sources_failed)`; each project dict gains `sources_used: []` populated on every successful source.
- Report header `## 数据源` lists all 5 canonical sources with success counts, e.g. `- GitHub Releases API (6/6)`, `- GitHub releases.atom (4/6)`.
- `meta_json` per project now includes `sources_used`; top-level gains `source_counts`.
2. **Failure reasons**
- All 4 fetch functions return `(result, error)` tuples; `source_errors` entries are `"<source>: <reason>"` (reason ≤80 chars, newlines stripped via `_short_reason`).
- Project sections render `⚠️ 抓取失败: <source> — <reason>` (failed projects: one line per source; partial projects: enriched npm / releases.atom / Exa lines).
- Atom timeouts classified as `超时 (github.com 限流/网络)`.
3. **Atom hardening**
- `fetch_releases_atom`: timeout 45s (`ATOM_TIMEOUT`), ONE retry on `requests.exceptions.Timeout` (sleep 5s), never raises (returns `(None, reason)`).
4. **Self-lock**
- `_watchdog_already_running()` via `pgrep -f daily_watchdog.py` excluding own pid, hardened to only count processes whose argv[0] is a python interpreter (avoids false positives from processes that merely mention the filename). At `main()` start: if running → log + return 0.
5. **`--fix-if-missing`**
- `_today_report_ok(date)`: today's report exists in watchdog.db AND meta has ≥2 projects status != 'failed' → log `today's report already OK — skip full run (--fix-if-missing)`, exit 0 fast. Default behavior unchanged.
6. **Kept**: LLM integration (POST http://127.0.0.1:4000/v1/chat/completions, model="analysis", no auth, timeout=300) — already present in the file; report sections unchanged except 数据源 header + enriched ⚠️ lines; `**LLM 摘要:**` renamed to `**LLM 总结:**` and moved to render for ALL projects (previously only rendered when GitHub data existed); exit codes unchanged (1 only if ALL projects failed). No new imports beyond stdlib + requests.
## Verification evidence
### py_compile
```
PY_COMPILE_OK
```
### REAL full run (final, exit code 0)
Command: `HOME=/home/yi /usr/bin/python3 scripts/daily_watchdog.py`
```
EXIT=0
2026-08-16 16:52:27 [INFO] Starting daily watchdog for 2026-08-16
2026-08-16 16:52:34 [INFO] Exa MCP initialized, session=250675fa-...
2026-08-16 16:57:03 [WARNING] Atom feed timeout for code-yeongyu/oh-my-openagent (attempt 1/2)
2026-08-16 16:58:00 [WARNING] Atom feed timeout for code-yeongyu/oh-my-openagent (attempt 2/2)
2026-08-16 16:59:47 [WARNING] Atom feed timeout for vectorize-io/hindsight (attempt 1/2)
2026-08-16 17:00:37 [WARNING] Atom feed timeout for vectorize-io/hindsight (attempt 2/2)
2026-08-16 17:01:29 [INFO] Report saved to /home/yi/opencode-blog-showcase/logs/daily-agent-watchdog-2026-08-16.md
2026-08-16 17:01:29 [INFO] SQLite record saved to /home/yi/opencode-blog-showcase/data/watchdog.db
2026-08-16 17:01:29 [INFO] Daily watchdog completed successfully
```
Full stdout: `./.review-tmp/build1-run.log` (tail) / `./.review-tmp/build1-run-final.log` (full).
### 数据源 header (verbatim)
```
## 数据源
- GitHub Releases API (6/6)
- GitHub commits API (6/6)
- npm registry (5/6)
- GitHub releases.atom (4/6)
- Exa web search (6/6)
```
### One-line LLM 总结 excerpt per project (all real Chinese, 0 placeholders)
- sst/opencode: 本次 v1.18.18 版本更新主要聚焦于核心功能的缺陷修复与模型兼容性优化…
- anthropics/claude-code: 本次更新为 claude-code 增加了对 GitLab 合并请求 URL 的支持,并引入了可…
- openai/codex: 本次0.147.0版本更新引入了便携式Agent插件安装与跨目录搜索功能支持…
- NousResearch/hermes-agent: 本次更新为 Hermes Agent v0.20.1 补丁版本,主要整合了自 v0.20.0 以来的大量…
- code-yeongyu/oh-my-openagent: 本次更新发布了 v5.0.0-beta.7 版本,标志着项目向全新的 OMO Native CLI 架构…
- vectorize-io/hindsight: 本次 v0.9.1 更新主要聚焦于系统稳定性和功能扩展,修复了引擎并发死…
Report counts: `**LLM 总结:**` ×6, `**Breaking Changes:**` ×6, `★ **相关性:**` ×6, `⚠️ 抓取失败:` ×2, placeholder ("LLM 未集成"/"LLM 总结失败") ×0.
### Atom timeout classification (exercised live)
```
**releases.atom:** ⚠️ 抓取失败: GitHub releases.atom — 超时 (github.com 限流/网络)
```
(2 occurrences — oh-my-openagent and hindsight both timed out twice; retry logic logged `attempt 1/2``attempt 2/2`.)
### --fix-if-missing (exit 0 fast)
```
2026-08-16 17:01:41 [INFO] today's report already OK — skip full run (--fix-if-missing)
FIX_EXIT=0
```
### Self-lock idle check
```
idle _watchdog_already_running = False
IDLE_EXIT=0
```
Positive case also demonstrated live: while another instance ran, the script logged `Another daily_watchdog instance is already running — skip` and exited 0.
### meta_json (watchdog.db, 2026-08-16)
```
source_counts: {'GitHub Releases API': 6, 'GitHub commits API': 6, 'npm registry': 5, 'GitHub releases.atom': 4, 'Exa web search': 6}
opencode ok ['GitHub Releases API', 'GitHub commits API', 'npm registry', 'GitHub releases.atom', 'Exa web search']
claude-code ok [...same 5...]
codex ok [...same 5...]
hermes-agent ok [...same 5...]
oh-my-openagent partial ['GitHub Releases API', 'GitHub commits API', 'npm registry', 'Exa web search']
hindsight partial ['GitHub Releases API', 'GitHub commits API', 'Exa web search']
```
## Anomalies
1. **Concurrent agent**: another opencode agent (PID 1097346, task "B2 LLM 集成 + B3 Flask/cron") was editing the same file and repeatedly ran the script (5+ times) during this build. It had already added the LLM integration (`summarize_with_llm` real POST) before my patches; I kept it and patched around it. Its runs repeatedly triggered my self-lock (correct behavior) and overwrote the report/DB between my runs — final state is from MY run.
2. **Self-lock false positive**: `pgrep -f daily_watchdog.py` matched the concurrent agent's own process (its task text mentions the filename). Hardened the lock to only count processes whose argv[0] is a python interpreter; idle check now returns False correctly.
3. **GitHub API rate limit**: during the 16:16 run, api.github.com returned 403 rate-limit for all 6 projects (exhausted by the concurrent agent's repeated runs). The report honestly showed `⚠️ 抓取失败: GitHub Releases API — 403 Client Error: rate limit exceeded…` (truncated ≤80 chars). By the 16:52 run the limit had reset (6/6).
4. **releases.atom intermittent timeouts** confirmed live (as background noted): 45s timeout + 1 retry handled them; classified as `超时 (github.com 限流/网络)`.