From 863246a92a8ed65f30a82cb0fe48a3a75c83ad4d Mon Sep 17 00:00:00 2001 From: EMRG Evolution Date: Fri, 14 Aug 2026 22:33:27 +0800 Subject: [PATCH] emrg: promote task must learn project latest state before promoting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Rant 2026-08-14T22:13:57: promote_prompt.md §0 only read the state file + project config — the promoter had zero knowledge of the actual project source/latest progress, while open-source tasks (#790) must study the full codebase. Asymmetric: same EMRG contributes after deep code study but promotes from a one-line description → stale or wrong answers to community questions (violating red lines #1/#7). Changes: - promote_prompt.md new §0.4 'Learn the project's latest state (MUST every round)': git fetch + last 10 commits, read repo root, scan key modules, refresh cognition; any capability claim must come from just-verified latest state (mirrors open_source B.2b) - §3 Step 2: Good-example note — feature descriptions must come from §0.4-verified state, not stale memory/description guesses - §4 state file: new 'last learned' field (time + commit HEAD) for knowledge freshness - §5 reflection Q3: must record what project info was learned this round (commit range / modules read) - +1 template render test (7 positive assertions); Agent.md 810->811 --- Agent.md | 2 +- emrg/server/promote_prompt.md | 18 ++++++++++++++++- tests/test_scheduler.py | 37 +++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 2 deletions(-) diff --git a/Agent.md b/Agent.md index dcf2b25c..816f771c 100644 --- a/Agent.md +++ b/Agent.md @@ -118,7 +118,7 @@ Community needs voiced in HN agent-UI discussions map directly to EMRG's design: pkill -f "emrg.server"; rm -f ~/.emrg/emrgd.port; python -m emrg ``` -Python: `uv run pytest tests/ -v` (810) — import check: `uv run python -c "from emrg.client.app import run_client"` +Python: `uv run pytest tests/ -v` (811) — import check: `uv run python -c "from emrg.client.app import run_client"` GUI: `cd emrg/gui && npm test` (247: 45 daemon_client + 19 conn-manager + 22 app-commands + 121 renderer smoke + 16 i18n + 7 integration + 3 commands + 5 build-config + 7 gui-state + 2 tool-group) — syntax: `node --check main.js preload.js daemon_client.js renderer/js/*.js` CI: `uv run pytest` (ubuntu + **windows-2025 matrix** — Windows pytest 回归在 PR CI 即失败,v0.2.29 教训 #725) + GUI tests + **actionlint workflow lint** (`rhysd/actionlint@v1.7.12` gate, #444 — workflow 解析错误在 PR CI 即失败,如 `if:` secrets 上下文) Re-trigger: `scripts/re-trigger-ci.sh [branch]` (workflow_dispatch, #527 — 替代空 commit 重触发:Actions outage 会整段丢弃 push 事件,dispatch 走 API 路径不受影响) diff --git a/emrg/server/promote_prompt.md b/emrg/server/promote_prompt.md index ec2f0663..8daf396c 100644 --- a/emrg/server/promote_prompt.md +++ b/emrg/server/promote_prompt.md @@ -36,6 +36,19 @@ Read the full config of `{{ project.name }}` from `~/.emrg/projects.yml` (path, - Check whether the browser harness skill is available (`/skills` or `ls ~/.emrg/skills/`) - Channel unavailable → record it in the state file (blocked = channel unavailable); skip channel actions this round, but still write the reflection +#### 0.4 Learn the project's latest state (MUST every round) + +> ⚠️ 前提:**每次推广前都重新了解项目最新进展**。任何推广内容都建立在你刚核实的最新信息上,不得用记忆/旧版本认知做判断。 + +**在推广前,先快速学习项目现状**(项目路径 `{{ project.path }}`): + +1. **拉取最新代码**:`cd {{ project.path }} && git fetch -q origin && git log --oneline -10 origin/HEAD`(或默认分支)——看最近 10 条 commit,了解最新进展与方向 +2. **读仓库根**:README / docs / 目录结构 → 理解项目定位、模块划分(若与 description 不一致,以实际代码为准) +3. **扫读关键模块**:按目录树看核心模块职责(不必全读,但要能准确回答"这个项目做什么、怎么做的、支持什么") +4. **更新认知**:若本轮发现与上一轮有重大变化(新功能/机制变更/废弃),在推广内容和跟进回复中反映最新状态 + +**推广内容中涉及项目能力/特性的任何表述,都必须是刚从最新代码/文档中核实的**——不得编造、不得沿用旧版本认知。 + --- ### 1. Promotion Red Lines (7 rules — never violate; violating any fails this cycle) @@ -103,6 +116,8 @@ Speak as a real participant, **give value first, then naturally mention {{ proje **Criterion**: if you delete the promotion, the reply is still a complete, valuable discussion = pass; if the reply collapses without the promotion = hard ad, don't post it. +> **任何功能/能力描述必须来自 §0.4 核实的项目最新现状**——不得沿用旧版本认知或凭 description 猜测。社区追问细节时,以刚学习的源码/文档/commit 为依据回答。 + #### Step 3 — Follow up (long-term engagement) Posting the promotion is not the end, it's the beginning: @@ -171,6 +186,7 @@ Path: `{{ source_dir }}/.emrg/sessions/{{ session_id }}/promote_state.md` - promotion log: - promotion opportunities: - promotion tracking: +- last learned: <最近一次 §0.4 学习项目的时间 + 项目 commit HEAD(知识新鲜度)> - banned list: ``` @@ -186,7 +202,7 @@ Each round must answer these 7 questions: 1. **What was this round's goal?** — promote what, which channel, which topic 2. **What would the ideal outcome be?** — what does "done" look like this round? (topic participation succeeded? someone replied?) -3. **What did you actually do?** — which topics searched, what was posted, which old promotions tracked, how much feedback collected/handed off (rant entries count and summary) +3. **What did you actually do?** — which topics searched, what was posted, which old promotions tracked, how much feedback collected/handed off (rant entries count and summary); **which project info did you learn this round (commit range / modules read via §0.4)** 4. **What's the current progress?** — how many promotion log entries? how many tracked discussions? how much feedback collected? 5. **What pitfalls did you hit?** — topic not found, channel rejected, replies ignored or negative 6. **What opportunities did you find?** — which topic had lively discussion, which channel worked well, new channels diff --git a/tests/test_scheduler.py b/tests/test_scheduler.py index 0c61591f..aba29dae 100644 --- a/tests/test_scheduler.py +++ b/tests/test_scheduler.py @@ -677,6 +677,43 @@ def test_open_source_template_full_code_study_b2b(): assert "只有当你理解了作者的设计意图" in out, "理解设计意图后才可贡献应渲染" +def test_promote_template_learn_latest_state_04(): + """promote_prompt.md §0.4 requires learning the project's latest state + before promoting (rant 2026-08-14T22:13:57, mirrors open-source B.2b #790).""" + import jinja2 + + template_path = ( + Path(__file__).resolve().parent.parent + / "emrg" / "server" / "promote_prompt.md" + ) + env = jinja2.Environment(undefined=jinja2.Undefined) + template = env.from_string(template_path.read_text(encoding="utf-8")) + out = template.render( + instance_id="test", host_name="host", uptime="0h 0m", + repo_url="https://github.com/x/y.git", owner="x", repo="y", + local_source="/tmp/pm", source_dir="/tmp/pm", session_id="s1", + evolution_cwd="/tmp/evo", timestamp="20260814", + task={"project": "aitokenpool"}, + project={"path": "/tmp/proj", "name": "aitokenpool", "description": "d"}, + evolution_count=0, git_path="git", gh_path="gh", + ) + # 1) the new section exists (positive discrimination: absent section → red) + assert "0.4 Learn the project's latest state" in out, "0.4 节应渲染" + # 2) MUST every round + assert "每次推广前都重新了解项目最新进展" in out, "每轮 MUST 前提应渲染" + # 3) latest commit inspection command with project.path + assert "git fetch -q origin" in out, "git fetch 最新代码应渲染" + assert "git log --oneline -10 origin/HEAD" in out, "最近 commit 检视应渲染" + # 4) claims must come from just-verified state, not stale memory + assert "不得编造、不得沿用旧版本认知" in out, "不得沿用旧认知应渲染" + # 5) Step 2 feature descriptions must come from §0.4 verification + assert "任何功能/能力描述必须来自 §0.4 核实的项目最新现状" in out, "Step 2 功能描述来源应渲染" + # 6) state file records knowledge freshness + assert "last learned" in out, "状态文件 last learned 字段应渲染" + # 7) reflection Q3 records what was learned (commit range / modules) + assert "commit range / modules read via §0.4" in out, "反思 Q3 学习记录应渲染" + + # ── Evolution workspace self-heal (rant 2026-08-06T20:42:05, 方案 C) ──────