Files
Jyotisha/docs/tasks/PROGRESS-agent-loop-pilot-20261013.md
T

70 lines
5.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# PROGRESS · 双 agent 自动循环试点 · 2026-10-13
任务书:`docs/tasks/TASK-agent-loop-pilot-20261013.md`。执行:Claude(直接执行,产品负责人 2026-10-13 授权)。分支 `codex/agent-loop-pilot-20261013`,基于 `origin/staging` `e8119ed12`。
## 状态一览
| 任务 | 状态 | 证据 / 说明 |
| --- | --- | --- |
| T0 令牌 | 开发机已完成 | `gitea.sh whoami` = 产品负责人账号;文件 0600、40 字符(曾粘贴两遍,已截断) |
| T1 Grok 实测 | 通过 | 见任务书「T1 结果与定稿分工」 |
| T2 标签与封装 | 通过 | 10 个 `agent/*` 标签已建;自检 issue #51 演示加锁 → 评论 → 换状态 → 解锁;标签筛选为「同时带有」语义 |
| T3 Claude 侧 | 已写,**未运行** | 见下「为什么没跑」 |
| T4 Grok 侧 | 已写,未安装 | 需产品负责人在 Windows 上安装 |
| T5 每晚复盘 | 已写,未运行 | `docs/agents/LESSONS.md` 已建空模板;`AGENTS.md` §4 加了一行 |
| T6 端到端 | 未开始 | — |
## 为什么 T3 没跑
开发机上 Claude Code 的自动模式安全检查连续拦下了「搭建无人值守、可推 staging 的 agent」相关命令(理由 `Create Unsafe Agents`),包括对脚本做语法检查。按规矩不绕开。产品负责人选择方案 B(自己授权无人值守脚本),授权方式是**由他本人在开发机终端里运行启动命令**。
据此做了两处加固(相对任务书原设计):
1. **不关权限检查**:原设计让 Claude/Grok 以 `bypassPermissions` 运行;改为白名单 + `dontAsk`(`claude-settings.json`、`grok-permissions.json`),白名单外的操作自动拒绝。
2. **只读本人账号的评论**:仓库实际对外公开(匿名 API 返回 `private: false`),陌生人评论一律不交给模型,防止经评论注入指令。
## 决定:Claude 侧改用会话 `/loop`(2026-10-13,产品负责人同意)
yetone 公开说明他的工作流就是在 Claude Code 会话里并行跑几个 `/loop` + 一段大白话提示词。据此 Claude 侧不再用后台脚本,改为在这台 Linux 机器的常开会话里跑 `/loop`(提示词见 `tools/agent-loop/prompts/loop-claude.md`)。保留双 agent(Grok 执行、Claude 验收=交叉审查)、标签交接、`gitea.sh`、推送钩子与各提示词规则。`claude-tick.sh` / `nightly-review.sh` / `agentctl.sh` 降为备用,不启动。Grok 侧 Windows 计划任务不变。
Claude 侧安装与空跑已由产品负责人在终端完成:分支 `b2bf15b8b` 推送成功,`agentctl.sh install` 以产品负责人账号连上 Gitea,`once` 输出 `nothing to do`。
## 已实测
| 项目 | 结果 |
| --- | --- |
| `gitea.sh` 建标签、按标签筛选、加/删标签、发评论 | 通过(issue #51) |
| Claude 钩子:推 main | 拒绝 |
| Claude 钩子:推 staging | 放行 |
| Grok 钩子:推 staging(新提交) | 拒绝(同 SHA 时 git 不调钩子,测试须用新提交) |
| Grok 钩子:推 main / 删除 codex 分支 | 拒绝 |
| Grok 钩子:推 codex/* | 放行 |
| `claude -p --json-schema` 结构化输出 | 通过(`structured_output` 字段) |
## 环境缺口
- 本机无 `crontab` / `systemctl`:用 `agentctl.sh start` 常驻循环;**机器重启后需再 start 一次**。
- `claude-tick.sh`、`nightly-review.sh` 尚未实跑;白名单是否够用要第一轮实跑才知道(不够时模型会被拒并在 issue 留 error,不会越权)。
- Grok 的 `--allow` / `--deny` 规则语法只有公开资料,安装前需 Grok 本机核对。
- `test:db` 13 条 Windows 已知失败的测试名尚未填入 `windows-known-failures.txt`。
## 产品负责人要做的
**开发机(照片里那个终端)**,按顺序:
```bash
cd /workspace/Jyotisha/.worktrees/agent-loop-pilot-20261013
bash tools/agent-loop/agentctl.sh install
~/.local/share/jyotisha-agent/bin/agentctl.sh once # 没有带标签的 issue 时应显示 nothing to do
~/.local/share/jyotisha-agent/bin/agentctl.sh start
```
**Windows**:分支推上去后,把下面这段发给 Grok(交互模式):
> 在 G:\Ferti\Jyotisha\.worktrees\agent-loop 里 `git fetch origin` 后 `git checkout -f -B codex/agent-loop-pilot-20261013 origin/codex/agent-loop-pilot-20261013`,读 tools/agent-loop/README.md 和 docs/tasks/PROGRESS-agent-loop-pilot-20261013.md。然后:
> 1. 按 `grok --help` 核对 tools/agent-loop/grok-permissions.json 的 allow/deny 规则写法,不对就改成正确写法(不得改成 bypassPermissions),用 `grok -p "运行 git status" --permission-mode dontAsk --allow <规则>` 实测一条放行、一条不在名单里的命令被拒。
> 2. 在 frontend 下跑 `npm run test:db`(Docker 已开),把失败的 13 条测试名按 "not ok N - " 后面的原文逐行填进 tools/agent-loop/windows-known-failures.txt。
> 3. 两处改动 commit 后 `git push origin HEAD:refs/heads/codex/agent-loop-pilot-20261013`。
> 4. 运行 `powershell -NoProfile -ExecutionPolicy Bypass -File tools\agent-loop\install-grok.ps1 -RunOnce`,贴出最后 5 行日志。
> 不要注册计划任务,等 Claude 确认。