fix: Git Workflow 多 Session 并发隔离改造 - Closes #124
CI / test (pull_request) Successful in 22s

核心变更:
- _common.sh: setup_worktree 改为 session-unique detached worktree (origin/main)
- 所有 Agent 文档移除 git checkout main / git pull origin main
- Feature branch 统一从 origin/main 创建: git fetch origin && git checkout -b <branch> origin/main
- CLAUDE.md: 新增工作区隔离章节, primary worktree 定义为只读参考区
- 新增 start_generic.sh: Generic session worktree 隔离启动器

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 16:11:32 +08:00
parent 9629eb6ae0
commit e4f0b77ca8
9 changed files with 80 additions and 66 deletions
+3 -3
View File
@@ -65,7 +65,7 @@ export GITEA_USER=pzhang_dev_agent_01 # Dev-Agent 账号
1. 读取项目章程和全局状态:`docs/PROJECT_CHARTER.md``docs/GLOBAL_STATE.md`
2. 确认环境变量已设置(GITEA_USER + ~/.gitea/config.yaml
3. 确认当前在独立的 git worktree 中(启动脚本已自动切到 `~/.gitea/worktrees/`),不与其他 agent 共享工作目录
3. 确认当前在独立的 git worktree 中(启动脚本已自动切到 `~/.gitea/worktrees/<user>/<timestamp>/`),不与其他 agent 共享工作目录。工作区始终基于 origin/main,请勿 checkout main 分支
4.`/loop 10m` 开启 10 分钟间隔的自动轮询
4. 轮询内容(多轮递进):
a. `--action list --labels product-code` — 先捡带 `product-code` 标签的 Issue
@@ -156,8 +156,8 @@ python scripts/agent_poller.py --action get --issue N
```
1. [判定] 是代码级修复还是质量级修复?
2. git pull origin main
3. git checkout -b dev/issue-N-<slug>
2. git fetch origin
3. git checkout -b dev/issue-N-<slug> origin/main
4. 修改功能代码 + 更新/补充 UT 和接口集成测试
5. python -m pytest -v # 本地全量 UT/集成测试
6. [仅质量级修复] python scripts/run_pipeline.py --input "input/<文档>.docx"
+6 -12
View File
@@ -15,7 +15,7 @@ description: QE Agent — 自动化验收测试开发与质量门禁。轮询 Gi
1. 读取项目章程和全局状态:`docs/PROJECT_CHARTER.md``docs/GLOBAL_STATE.md`
2. 设好环境变量(见下方"环境要求")
3. 确认当前在独立的 git worktree 中(启动脚本已自动切到 `~/.gitea/worktrees/`),不与其他 agent 共享工作目录
3. 确认当前在独立的 git worktree 中(启动脚本已自动切到 `~/.gitea/worktrees/<user>/<timestamp>/`),不与其他 agent 共享工作目录。工作区始终基于 origin/main,请勿 checkout main 分支
4.`/loop 10m` 开启 10 分钟间隔的自动轮询
4. 轮询内容(多轮递进):
a. `--action list --labels test-code` — 先捡带 `test-code` 标签的 Issue
@@ -111,22 +111,16 @@ python scripts/agent_poller.py --action comment --issue <N> --body "QE-Agent 已
### Step 3: 实施测试
#### 3.1 确保代码最新
#### 3.1 确保代码最新并创建分支
```bash
git checkout main
git pull origin main
```
#### 3.2 创建分支
```bash
git checkout -b test/issue-<N>
git fetch origin
git checkout -b test/issue-<N> origin/main
```
分支命名规则:`test/issue-<N>``test/issue-<N>-<简短描述>`
#### 3.3 编写测试代码
#### 3.2 编写测试代码
测试代码在 `tests/acceptance/` 目录下。现有结构:
@@ -148,7 +142,7 @@ tests/acceptance/
- Layer B 覆盖率测试不需要 LLM API
- Layer C QE 审计需要 `deepseek-v4-flash` API
#### 3.4 本地验证
#### 3.3 本地验证
```bash
# 跑全部验收测试(需要 LLM API)