emrg: generalize task handler — TaskHandler rename + repo-configured self-heal + template lookup (rant 2026-08-12T18:14:46 P1) - #709
Merged
Conversation
…self-heal + template lookup (rant 2026-08-12T18:14:46 P1)
argszero
commented
Aug 12, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle
Audited the diff (192+/77-, 5 files) on top of master 01b7cfa:
- TaskHandler rename — complete: grep-verified no remaining code references to EvolutionHandler (only historical quick-ref text in evolution_prompt.md, which documents past PRs — correct to leave). daemon.py comment synced.
- Self-heal generalization — dual-state verified:
- emrg task →
_repo_configured=True(defaults argszero/emrg), existing usable dev repo → no clone (behavior unchanged for this very workspace); - non-emrg task without repo config →
_repo_configured=False→ skip self-heal (unchanged); - config owner/repo override or git remote in project path → self-heal enabled (new behavior, only clones when local repo unusable).
- evolve_dir now
~/.emrg/evolution/<repo>(repo-specific) — consistent with the repo-configured semantics.
- emrg task →
_resolve_task_template— builtin TASK_TEMPLATES priority (unchanged for the 4 builtin types), user~/.emrg/task-templates/<type>.mdfallback, then evolution_prompt.md. Pure helper; config_dir imported correctly.- Tests — full pytest 736 passed locally (730→736, +6 as claimed: repo override / emrg default / no-repo skip / user-template / missing fallback / builtin-not-overridable); CI 31587324340 green. Agent.md count synced.
No issues found.
argszero
commented
Aug 12, 2026
argszero
left a comment
Owner
Author
There was a problem hiding this comment.
✅ LGTM — cycle
Re-verified P1 (rant 2026-08-12T18:14:46, refined by 18:23:15) on head dfad63e:
- TaskHandler rename — EvolutionHandler → TaskHandler across scheduler.py (class, HANDLERS, all log strings, type hints), daemon.py comment, both test files. No behavior change (pure refactor).
- Self-heal generalization —
_repo_configuredflag: configowner/repooverride or a git remote in the project path enables clone/align self-heal into~/.emrg/evolution/<repo>/; emrg evolution task always configured (defaults argszero/emrg); no-repo tasks skip. This correctly implements the rant's "有 repo 配置就自愈" —_repo_urlalways has a default so a literalif not self._repo_urlwould never gate; the flag is the faithful form. _resolve_task_template— builtin TASK_TEMPLATES priority →~/.emrg/task-templates/<type>.md→evolution_prompt.mdfallback; pure helper unit-testable for P2.
Verification: pytest 736 (was 730, +6 new tests incl. builtin-not-overridable + user-template resolution), import + CLI OK, Agent.md count synced (doc-count guard green). CI test run 31587324340 PASS (actionlint + doc-count guard included). No issues found.
This was referenced Aug 12, 2026
argszero
added a commit
that referenced
this pull request
Aug 12, 2026
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P1 of the host rant 2026-08-12T18:14:46 (generalize scheduled tasks + GUI task management). Pure backend refactor, no UI. Three changes:
EvolutionHandler→TaskHandlerclass rename (the handler is not evolution-specific — paper/open-source/promote share it). All log strings, HANDLERS dict, type hints, and tests updated; daemon.py comment synced.Workspace self-heal generalization — the old gate
if self._project_name != "emrg" or self._repo != self.REPO: return Truehardcoded EMRG-only. New_repo_configuredflag: any task with a real repo (configowner/repooverride, or a git remote detected in its project path) gets clone/align self-heal into~/.emrg/evolution/<repo>/; the emrg evolution task always counts as configured (defaults to argszero/emrg). Tasks without any repo config skip self-heal (unchanged behavior for non-repo paper/open-source tasks).Template lookup helper
_resolve_task_template(task_type): built-inTASK_TEMPLATEStake priority; custom task types (P2) fall back to~/.emrg/task-templates/<type>.md, then toevolution_prompt.md. Pure helper so P2's CRUD can be unit-tested.Tests: +6 (config owner/repo override, emrg default-configured, no-repo skip self-heal, user-template resolution, missing-template fallback, builtin-not-overridable) → pytest 730→736; Agent.md count synced. No GUI changes.