Go to file
caoqianming 4f6e879050 feat(web): systemctl restart 优雅 drain in-flight run,不再误标 error
此前 restart 硬杀 BG run 线程,下次启动 reaper 把所有 running/cancelling
标 error: server restarted before run finished —— 用户一多就不能随便重启。

单实例止血,零 DB 改动:
- lifespan 加 draining(Event) + inflight 登记表(顺手修 create_task 不留引用
  可能被 GC 的旧坑);finally 先拒新 run → await 收尾 → 超 drain_timeout 转
  协作式 cancel(= 用户按停止,标 idle 不报 error、可重发)→ 超 cancel_grace
  仍没退的留给 SIGKILL(最坏退化 = 改前)
- POST /messages:draining 期返 503 + Retry-After;起 run 登记 inflight
- main.py uvicorn 加 timeout_graceful_shutdown=5(否则长连 SSE 挡在 drain 前)
- config/agent.yaml 加 shutdown 段(drain 30s / grace 15s,偏短更安全)
- dev SPA chat.js 发送包退避重试(503 背压 + 交接拒连都重试 ~26s)

部署强耦合:unit TimeoutStopSec 10→90(必须 > drain+grace+sandbox 清扫余量),
已写进 RUN.md unit + 故障兜底。B 蓝绿(零 503 窗口)留作触发信号后再做。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 10:54:43 +08:00
config feat(web): systemctl restart 优雅 drain in-flight run,不再误标 error 2026-06-10 10:54:43 +08:00
core feat(tools+loop): 批量抓取 + 重复调用守卫 —— 治高轮数烧 token 2026-06-08 16:47:56 +08:00
db/migrations Stage C 收尾包:资源 yaml + 磁盘配额 + 网络放开 + 容器内源持久化 2026-05-27 08:35:53 +08:00
deploy fix(deploy): npm 默认源改回腾讯 — npmmirror 访问不稳 2026-06-03 11:00:28 +08:00
prompts/system feat(prompt): 工作原则加「少来回」—— 独立步骤合并,广谱减轮 2026-06-08 11:31:22 +08:00
scripts feat(tools+loop): 批量抓取 + 重复调用守卫 —— 治高轮数烧 token 2026-06-08 16:47:56 +08:00
skills feat(ppt): 补信息设计纪律 + 混合背景 + pptx 预览器(深读 pptmaster 后) 2026-06-09 09:41:55 +08:00
tests feat(preview): pptx 在线预览 —— LibreOffice→PDF + 复用 PDF iframe(DESIGN §8.3 Stage 1) 2026-06-09 13:04:02 +08:00
tools feat(tools+loop): 批量抓取 + 重复调用守卫 —— 治高轮数烧 token 2026-06-08 16:47:56 +08:00
web feat(web): systemctl restart 优雅 drain in-flight run,不再误标 error 2026-06-10 10:54:43 +08:00
.gitattributes Add .gitattributes: force LF for shell + Dockerfile 2026-05-26 10:45:17 +08:00
.gitignore skills+core(命名约定): task 级宪法文件 <date>-<short_id>-<name>.spec.md + spec_lock → spec 简化 2026-05-20 14:03:21 +08:00
CLAUDE.md docs(claude): 加 Shell 语法规约 — 别把 PowerShell here-string 喂给 Bash 工具 2026-06-02 12:28:23 +08:00
DESIGN.md docs(design): 加 §8.3 PPTX 前端在线预览方案(LibreOffice → PDF) 2026-06-09 10:22:00 +08:00
DOCUMENT_SEARCH_API.md feat(skill): documents skill 接内部材料学科知识库(document_search API) 2026-05-21 15:31:21 +08:00
EMBED.md feat(web): embed 模式接受 ?task_id=<uuid> URL 参数自动定位 task 2026-05-22 15:27:19 +08:00
PROGRESS.md feat(web): systemctl restart 优雅 drain in-flight run,不再误标 error 2026-06-10 10:54:43 +08:00
RUN.md feat(web): systemctl restart 优雅 drain in-flight run,不再误标 error 2026-06-10 10:54:43 +08:00
SCIENTIFIC_SKILLS.md skills: 加 pymatgen / stats_ml / plot_pub(建材院无机材料场景) 2026-05-28 11:33:59 +08:00
SKILL_LIST.md feat(ppt): 补信息设计纪律 + 混合背景 + pptx 预览器(深读 pptmaster 后) 2026-06-09 09:41:55 +08:00
alembic.ini core(§7 B Step 1): Storage 基建 — SQLAlchemy ORM + alembic + db CLI 2026-05-14 10:41:44 +08:00
main.py feat(web): systemctl restart 优雅 drain in-flight run,不再误标 error 2026-06-10 10:54:43 +08:00
requirements.txt skills: 加 pymatgen / stats_ml / plot_pub(建材院无机材料场景) 2026-05-28 11:33:59 +08:00