emrg: open-source task must never stash/reset host's uncommitted work — dirty tree runs read-only (rant 2026-08-20T11:58:27) - #881
Conversation
… — dirty tree runs read-only (rant 2026-08-20T11:58:27)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (1/3)
Host data-loss fix (rant 2026-08-20T11:58:27): the open-source task's source-sync phase used to git stash the host's uncommitted work in the live working directory — silently losing edits (no reflog trace). Rewritten:
- dirty working tree → read-only cycle (never stash/checkout ./restore ./reset --hard; no branch/commit/push/PR while dirty)
git pull --rebasegated on a clean tree; dirty + behind → skip- pull conflicts →
git rebase --abort(tree was clean pre-pull) instead of stashing - regression test asserts the rendered prompt contains the safety rules
CI: test + test-windows PASS (32330596704). pytest 987 passed + 1 skipped locally.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (2/3)
Fresh-cycle re-review of the full diff (head 25f4785, 3 files +58/−5):
open_source_prompt.md§0.3 rewritten: dirty working tree is now explicitly NORMAL (source dir = host's working dir, not a dedicated clone) → cycle runs read-only. Prohibitions cover stash/checkout ./restore ./clean/reset --hard; no branch/commit/push/PR while dirty. pull --rebase gated on clean tree; dirty+behind → skip.- Error-handling table: pull conflicts →
git rebase --abort(tree was clean pre-pull, abort restores it) — never stashes host work. - Regression test
test_open_source_template_never_stashes_host_workasserts the rendered prompt contains the safety rules and no longer instructs stash; Agent.md count synced (987→988) for the doc-count guard.
CI: test + test-windows PASS (32330596704). Local pytest 987 passed + 1 skipped.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle (3/3)
Fresh-cycle re-verification: head 25f4785 unchanged since 2/3; mergeState CLEAN; test + test-windows SUCCESS (32330596704). The safety fix is complete and correct — open-source task now treats the host's dirty working tree as normal and runs read-only instead of stashing/resetting host work. Merging.
open-source task must never stash/reset the host's uncommitted work (rant 2026-08-20T11:58:27)
Bug (host data-loss report)
The
open-sourcetask type (emrg/server/open_source_prompt.md) ran on the host's live working directory (e.g.aitokenpool-opensource-taskon the aitokenpool repo) and its §0.3 "Source sync" phase instructed agents togit stashthe host's uncommitted local changes. This silently hid — and effectively lost — the host's live edits twice on 2026-08-20 11:15-11:20 (files reset to HEAD with no reflog trace). The host had to disable the task (~/.emrg/tasks.yml enabled: false) to protect their work.Fix
git stash/git checkout ./git restore ./git clean/git reset --hardor anything that hides/discards uncommitted changesgit pull --rebaseonly when the tree is clean; if dirty + behind → skip the pullgit pullconflicts now usegit rebase --abort(the tree was clean before the pull, so abort restores it) instead of stashing host worktest_open_source_template_never_stashes_host_workasserts the rendered prompt contains the safety rules and no longer instructsgit stashFiles
emrg/server/open_source_prompt.md— §0.3 + error-handling rowtests/test_scheduler.py— new regression testAgent.md— test count 987 → 988 (doc-count guard)Verification
uv run pytest tests/ -q→ 987 passed, 1 skipped