From 00185b15b9e90103408775d98dbd1a5c3964b2d9 Mon Sep 17 00:00:00 2001 From: argszero Date: Sat, 8 Aug 2026 09:35:55 +0800 Subject: [PATCH 1/2] =?UTF-8?q?emrg:=20evolution=20prompt=20Step=202.2=20u?= =?UTF-8?q?ses=20FETCH=5FHEAD=20=E2=80=94=20robust=20to=20missing=20remote?= =?UTF-8?q?-tracking=20refs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Agent.md | 2 +- README.cn.md | 2 +- README.md | 2 +- emrg/server/evolution_prompt.md | 8 ++++++-- tests/test_daemon.py | 22 ++++++++++++++++++++++ 5 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Agent.md b/Agent.md index c75557cf..bd9a8231 100644 --- a/Agent.md +++ b/Agent.md @@ -93,7 +93,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` (589) — import check: `uv run python -c "from emrg.client.app import run_client"` +Python: `uv run pytest tests/ -v` (590) — import check: `uv run python -c "from emrg.client.app import run_client"` GUI: `cd emrg/gui && npm test` (93: 22 daemon_client + 22 app-commands + 24 renderer smoke + 15 i18n + 7 integration + 3 commands) — syntax: `node --check main.js preload.js daemon_client.js renderer/js/*.js` CI: `uv run pytest` + 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/README.cn.md b/README.cn.md index 8d603926..1fbbdd90 100644 --- a/README.cn.md +++ b/README.cn.md @@ -274,7 +274,7 @@ EMRG 不只是追赶——它自己追上来。 git clone https://github.com/argszero/emrg.git cd emrg uv sync # 安装依赖 -uv run pytest tests/ -v # 跑测试(当前 589 项) +uv run pytest tests/ -v # 跑测试(当前 590 项) uv run python -m emrg # 启动 TUI # CI 含 actionlint workflow 门禁(#444):workflow 解析错误在 PR 即失败 diff --git a/README.md b/README.md index c8cae059..e956852e 100644 --- a/README.md +++ b/README.md @@ -273,7 +273,7 @@ EMRG doesn't just keep up — it catches up on its own. git clone https://github.com/argszero/emrg.git cd emrg uv sync # install deps -uv run pytest tests/ -v # run tests (currently 589 items) +uv run pytest tests/ -v # run tests (currently 590 items) uv run python -m emrg # launch TUI # CI includes actionlint workflow gate (#444): workflow parse errors fail PR CI diff --git a/emrg/server/evolution_prompt.md b/emrg/server/evolution_prompt.md index 8e945c5e..b7229eb7 100644 --- a/emrg/server/evolution_prompt.md +++ b/emrg/server/evolution_prompt.md @@ -145,7 +145,7 @@ cd {{ source_dir }} && gh pr list -R {{ owner }}/{{ repo }} --limit 20 and `gh api repos/{{ owner }}/{{ repo }}/pulls//reviews --jq '.[] | "\(.user.login) [\(.state)]: \(.body)"'` - If there are already 2 ✅, this cycle is the 3rd → approve then merge - If satisfied → `gh pr merge -R {{ owner }}/{{ repo }} --squash` - - On merge conflict → `gh pr checkout && git fetch origin master && git merge origin/master`, resolve conflicts, push, then merge + - On merge conflict → `gh pr checkout && git fetch origin master && git merge FETCH_HEAD`, resolve conflicts, push, then merge - Not satisfied → keep waiting **Issue management**: @@ -355,10 +355,14 @@ When reading rants, follow these rules: #### 2.2 Latest GitHub code changes ```bash -cd {{ source_dir }} && git fetch origin master && git log origin/master --oneline -10 +cd {{ source_dir }} && git fetch origin master && git log FETCH_HEAD --oneline -10 ``` Fetch and understand the newest commits on master (possibly from other Committers) — analyze what changed, why, and whether follow-up is needed. +> ⚡ Use `FETCH_HEAD`, not `origin/master`: `git fetch origin master` always +> writes FETCH_HEAD even when the repo has no remote-tracking refs (e.g. +> after a workspace repair that stripped `remote.origin.fetch`), where +> `git log origin/master` fails with "unknown revision". #### 2.3 EMRG memory and conversations across projects diff --git a/tests/test_daemon.py b/tests/test_daemon.py index 34b758fe..1ce0aaed 100644 --- a/tests/test_daemon.py +++ b/tests/test_daemon.py @@ -73,6 +73,28 @@ def test_build_prompt_all_variables_substituted(): assert not braces, f"Unsubstituted placeholders: {braces}" +def test_build_prompt_step22_uses_fetch_head(): + """Step 2.2 must log FETCH_HEAD, not origin/master. + + `git fetch origin master` always writes FETCH_HEAD even when the repo + has no remote-tracking refs (e.g. after a workspace repair that + stripped `remote.origin.fetch`), where `git log origin/master` fails + with "unknown revision" (observed 2026-08-08, cycles 09:15 & 09:30). + """ + handler = EvolutionHandler( + name="emrg", config={"path": "/tmp/emrg"}, interval=1800, + identity=InstanceIdentity(instance_id="test-id", host_name="testhost"), + ) + prompt = handler._build_evolution_prompt() + # The actual Step 2.2 command block must log FETCH_HEAD, not origin/master. + step22 = prompt.split("#### 2.2 Latest GitHub code changes", 1)[1].split("#### 2.3", 1)[0] + assert "git fetch origin master && git log FETCH_HEAD --oneline -10" in step22 + assert "git fetch origin master && git log origin/master" not in step22 + # Merge-conflict guidance must also merge FETCH_HEAD (line 148). + assert "git merge FETCH_HEAD" in prompt + assert "git merge origin/master" not in prompt + + # ── TaskScheduler._load_tasks ──────────────────────────────────── From 0e479b97698e4b42dbe17df5bdb7e4360191ceb7 Mon Sep 17 00:00:00 2001 From: EMRG Evolution Date: Sat, 8 Aug 2026 09:39:46 +0800 Subject: [PATCH 2/2] =?UTF-8?q?emrg:=20bump=20test=20count=20590=E2=86=925?= =?UTF-8?q?91=20after=20#566=20merge=20(doc-count=20guard=20#511)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Agent.md | 2 +- README.cn.md | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Agent.md b/Agent.md index bd9a8231..c51a06ee 100644 --- a/Agent.md +++ b/Agent.md @@ -93,7 +93,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` (590) — import check: `uv run python -c "from emrg.client.app import run_client"` +Python: `uv run pytest tests/ -v` (591) — import check: `uv run python -c "from emrg.client.app import run_client"` GUI: `cd emrg/gui && npm test` (93: 22 daemon_client + 22 app-commands + 24 renderer smoke + 15 i18n + 7 integration + 3 commands) — syntax: `node --check main.js preload.js daemon_client.js renderer/js/*.js` CI: `uv run pytest` + 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/README.cn.md b/README.cn.md index 1fbbdd90..e2612f76 100644 --- a/README.cn.md +++ b/README.cn.md @@ -274,7 +274,7 @@ EMRG 不只是追赶——它自己追上来。 git clone https://github.com/argszero/emrg.git cd emrg uv sync # 安装依赖 -uv run pytest tests/ -v # 跑测试(当前 590 项) +uv run pytest tests/ -v # 跑测试(当前 591 项) uv run python -m emrg # 启动 TUI # CI 含 actionlint workflow 门禁(#444):workflow 解析错误在 PR 即失败 diff --git a/README.md b/README.md index e956852e..b4d5eab4 100644 --- a/README.md +++ b/README.md @@ -273,7 +273,7 @@ EMRG doesn't just keep up — it catches up on its own. git clone https://github.com/argszero/emrg.git cd emrg uv sync # install deps -uv run pytest tests/ -v # run tests (currently 590 items) +uv run pytest tests/ -v # run tests (currently 591 items) uv run python -m emrg # launch TUI # CI includes actionlint workflow gate (#444): workflow parse errors fail PR CI