Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` (804) — import check: `uv run python -c "from emrg.client.app import run_client"`
Python: `uv run pytest tests/ -v` (805) — import check: `uv run python -c "from emrg.client.app import run_client"`
GUI: `cd emrg/gui && npm test` (245: 44 daemon_client + 19 conn-manager + 22 app-commands + 120 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 路径不受影响)
Expand Down
5 changes: 4 additions & 1 deletion emrg/server/open_source_prompt.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ This task's role is configured in tasks.yml as: **{{ task.role }}**

- **Committer**: may review, merge, close
- **Contributor**: may fork + PR, test, participate in discussion — **gatekeeping forbidden**
- **allow_self_merge** (tasks.yml, optional, default `false`): when `true`, a Committer may also review and merge **their own** PRs. When `false`/absent (the default), the existing rule stands — never merge your own PRs, wait for other Committers to review. This setting only affects self-PR handling; review/merge of other people's PRs always follows the role (Committer yes / Contributor no).

No need to run `git push --dry-run` detection.

Expand Down Expand Up @@ -92,6 +93,8 @@ Write the identity to `{{ evolution_cwd }}/memory/identity-github-role.md` (crea
| `gh repo fork` | ✅ | ✅ |
| `gh pr create` | ✅ | ✅ |

> **Self-merge opt-in**: `allow_self_merge` (tasks.yml, default `false`) lifts the "own PR" restriction only — when `true`, a Committer may review and merge their **own** PRs. Reviewing/merging **other people's** PRs always follows the ROLE LOCK table above. When `false`/absent (default), the existing rule stands: never merge your own PRs.

**Legitimate contribution paths for Contributors**:
- Found a fixable bug/feature in an Issue → fork the repo → implement → test → open a PR
- Participate in issue discussions
Expand Down Expand Up @@ -521,7 +524,7 @@ Other platforms (Gitee/Gitea/Gerrit, etc.): prefer the platform's official CLI (

- 🛑 No destructive refactoring of the target repository
- 🛑 Do not modify `~/.emrg/config.toml`
- 🛑 Do not merge your own PRs (wait for other Committers to review)
- 🛑 Do not merge your own PRs (wait for other Committers to review){% if task.get('allow_self_merge', false) %} — **overridden**: this task configures `allow_self_merge: true`, so a Committer may review and merge their own PRs{% endif %}
- 🛑 Contributors are forbidden from executing `gh pr review`, `gh pr merge`, `gh issue close` and other write operations
- 🛑 Do not do multiple unrelated things in one cycle
- 🛑 Do not skip the preparation step (even when "everything looks fine")
40 changes: 40 additions & 0 deletions tests/test_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -606,6 +606,46 @@ def test_open_source_template_renders_with_context():
assert "json.dumps(..., ensure_ascii=False)" in out, "rant 状态写入要求应渲染"


def test_open_source_template_allow_self_merge_conditional():
"""open_source_prompt.md renders allow_self_merge conditional (rant 2026-08-14T12:47:25)."""
import jinja2

template_path = (
Path(__file__).resolve().parent.parent
/ "emrg" / "server" / "open_source_prompt.md"
)
env = jinja2.Environment(undefined=jinja2.Undefined)
template = env.from_string(template_path.read_text(encoding="utf-8"))

base = dict(
instance_id="test", host_name="host", uptime="0h 0m",
repo_url="https://github.com/x/y.git", owner="x", repo="y",
local_source="/tmp/os", source_dir="/tmp/os", session_id="s1",
evolution_cwd="/tmp/evo", timestamp="20260814",
project={}, evolution_count=0, git_path="git", gh_path="gh",
)

# default (allow_self_merge absent) → rule stands, no override
out_default = template.render(task={"role": "committer", "project": "aitokenpool"}, **base)
assert "Do not merge your own PRs (wait for other Committers to review)" in out_default
assert "allow_self_merge: true" not in out_default

# explicit true → override text appears + opt-in note in role section
out_true = template.render(
task={"role": "committer", "project": "aitokenpool", "allow_self_merge": True}, **base
)
assert "allow_self_merge" in out_true, "allow_self_merge 说明应渲染"
assert "may review and merge their own PRs" in out_true, "self-merge 允许说明应渲染"
assert "**overridden**: this task configures" in out_true, "Forbidden 条件化覆盖应渲染"

# explicit false → same as default
out_false = template.render(
task={"role": "committer", "project": "aitokenpool", "allow_self_merge": False}, **base
)
assert "Do not merge your own PRs (wait for other Committers to review)" in out_false
assert "**overridden**" not in out_false


# ── Evolution workspace self-heal (rant 2026-08-06T20:42:05, 方案 C) ──────


Expand Down
Loading