Skip to content

emrg: generalize task handler — TaskHandler rename + repo-configured self-heal + template lookup (rant 2026-08-12T18:14:46 P1) - #709

Merged
argszero merged 1 commit into
masterfrom
feature/task-handler-generalization
Aug 12, 2026
Merged

emrg: generalize task handler — TaskHandler rename + repo-configured self-heal + template lookup (rant 2026-08-12T18:14:46 P1)#709
argszero merged 1 commit into
masterfrom
feature/task-handler-generalization

Conversation

@argszero

Copy link
Copy Markdown
Owner

P1 of the host rant 2026-08-12T18:14:46 (generalize scheduled tasks + GUI task management). Pure backend refactor, no UI. Three changes:

  1. EvolutionHandlerTaskHandler class 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.

  2. Workspace self-heal generalization — the old gate if self._project_name != "emrg" or self._repo != self.REPO: return True hardcoded EMRG-only. New _repo_configured flag: any task with a real repo (config owner/repo override, 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).

  3. Template lookup helper _resolve_task_template(task_type): built-in TASK_TEMPLATES take priority; custom task types (P2) fall back to ~/.emrg/task-templates/<type>.md, then to evolution_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.

…self-heal + template lookup (rant 2026-08-12T18:14:46 P1)

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Audited the diff (192+/77-, 5 files) on top of master 01b7cfa:

  1. 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.
  2. 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.
  3. _resolve_task_template — builtin TASK_TEMPLATES priority (unchanged for the 4 builtin types), user ~/.emrg/task-templates/<type>.md fallback, then evolution_prompt.md. Pure helper; config_dir imported correctly.
  4. 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

Re-verified P1 (rant 2026-08-12T18:14:46, refined by 18:23:15) on head dfad63e:

  1. 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).
  2. Self-heal generalization_repo_configured flag: config owner/repo override 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_url always has a default so a literal if not self._repo_url would never gate; the flag is the faithful form.
  3. _resolve_task_template — builtin TASK_TEMPLATES priority → ~/.emrg/task-templates/<type>.mdevolution_prompt.md fallback; 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.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ LGTM — cycle

3rd consecutive ✅ from a different cycle. Head dfad63e unchanged since my first review (10:28:20Z); CI 31587324340 green; full pytest 736 passed locally. Merge condition met (3 consecutive ✅, no ❌ between).

@argszero
argszero merged commit f7e8671 into master Aug 12, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 12, 2026
…ocs (#709/#710/#711) (#713)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 12, 2026
…#711 docs) (#715)

Co-authored-by: EMRG Evolution <emrg@argszero.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant