pr: commit worktree changes before push; fix merge/pr order docs

POST /tasks/{id}/pr used to push the branch as-is, so uncommitted
worktree changes never reached the PR (empty diff). Now, after all
skip checks pass, the endpoint commits the worktree on host/<task>
(guarded: refuses when the worktree is on another branch), cleans
__pycache__/*.pyc like host.py merge does, and falls back to the
cloud identity when no git identity is configured. Nothing-to-commit
proceeds. Docs corrected: PR comes after status-merge and before
any local git merge (which deletes branch+worktree).
This commit is contained in:
host committed 2026-10-26 15:20:02 +08:00
1 parent b984171f27
commit 0b96b2929c
5 files changed
+263 -10

No files matched your search

+10 -3
View File
@@ -758,10 +758,17 @@ interrupted 且终态任务 cancel 返回 400、心跳后 sweep 不扫刚心跳
reason=no_worktree;worktree 里没有 git remote origin 时
reason=no_remote;本机没有 gh 二进制时 reason=no_gh;gh 未登录
(gh auth status 非零)时 reason=gh_not_authenticated;以上全过
才 push 分支 + gh pr create,成功后把 pr_url/pr_number 写回任务
才先把 worktree 改动提交到分支上(worktree 必须正好在
host/<host 任务名> 上,否则直接失败;nothing to commit 时跳过;
缺 git 身份时回退 cloud/cloud@local 再试),再 push 分支 +
gh pr create,成功后把 pr_url/pr_number 写回任务
记录并记审计 pr_created,返回 200 含 pr_url。push 或 pr create
失败时返回 502 且错误文本写清是哪一步(push 还是 pr_create),
任务状态保持 merged 不变,绝不把任务标 failed。worker 不自动推:
失败时返回 502 且错误文本写清是哪一步(commit、push 还是
pr_create),
任务状态保持 merged 不变,绝不把任务标 failed。顺序:任务
completed -> POST /tasks/{id}/merge 改状态 -> POST
/tasks/{id}/pr,本地 host.py merge 会删分支和 worktree、须在
PR 之后做,此后调 PR 会跳过 no_worktree。worker 不自动推:
自动 PR 只由显式调本端点触发,默认自动推会把测试任务也推到远端。
projects 表新增 `auto_pr` 列(默认 0,老库幂等补列);
`POST /projects` 接受可选 auto_pr(只接受 0/1,非法值 400);