Skip to content

emrg: task CRUD + template CRUD + hot reload (rant 2026-08-12T18:23:15 P2) - #710

Merged
argszero merged 1 commit into
masterfrom
feature/task-crud-hot-reload
Aug 12, 2026
Merged

emrg: task CRUD + template CRUD + hot reload (rant 2026-08-12T18:23:15 P2)#710
argszero merged 1 commit into
masterfrom
feature/task-crud-hot-reload

Conversation

@argszero

Copy link
Copy Markdown
Owner

P2 of the host rant 2026-08-12T18:23:15 (task generalization full design — 6 host-confirmed decision points). Backend capabilities only; GUI follows in P3.

Task CRUD (daemon commands)

  • task_create {name, type, project, interval?, enabled?, repo?, description?}
  • task_update {name, ...} / task_delete {name} — respond task_result {ok, task|error, summary}

Template CRUD (daemon commands)

  • task_template_create {name, prompt} → writes ~/.emrg/task-templates/<name>.md (atomic tmp+replace)
  • task_template_list → builtin (read-only flag) + custom (with prompt preview)
  • task_template_update / task_template_delete — respond templates_list / template_result

Validation (per host decisions)

  • name: ^[a-z0-9][a-z0-9-]*$, ≤32 chars
  • type: builtin OR existing custom template
  • project: must be registered in projects.yml
  • interval: integer ≥ 60 (default 1800)
  • builtin types/templates read-only (create/update/delete refused)
  • delete of a referenced custom type refused with N task(s) use it (...)

Hot reload (TaskScheduler.apply_tasks)

  • Atomic write tasks.yml → diff against running handlers → add/remove/restart (stop+cancel old coro, start new) — no daemon restart
  • Idempotent (same config → no-op); _task_cfg_signature diffs name/type/config/interval/enabled
  • Custom types now start as TaskHandler with ~/.emrg/task-templates/<type>.md (fallback evolution_prompt.md + warning) — unknown-type tasks are no longer silently skipped (P2 semantics)

Tests

+8 (validation 4-cases / create+duplicate / update+delete / hot-reload add-remove / restart-on-change / idempotent / template guards incl. delete-refused / custom-type task) → pytest 736→744; Agent.md count synced. Daemon dispatch covered via existing e2e harness.

@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 P2 (rant 2026-08-12T18:23:15) on head 4517b81 (4 files, 617+/17-):

  1. Task CRUD — daemon task_create/update/delete → task_result; validation matches all 6 host decisions: name regex ^[a-z0-9][a-z0-9-]*$ ≤32, type builtin-or-custom, project must be registered in projects.yml, interval ≥60. task_update merges fields (type/project/interval/enabled/repo/description) without clobbering config.
  2. Template CRUD — task_template_create/list/update/delete; custom templates in ~/.emrg/task-templates/.md (atomic tmp+replace); builtin types/templates read-only; delete of a referenced custom type refused with task count (host decision).
  3. Hot reload — TaskScheduler.apply_tasks: atomic write → diff via _task_cfg_signature (name/type/config/interval/enabled) → add/remove/restart handlers; idempotent (same config → no-op). _start_handler_for/_stop_handler extracted; _handler_cfgs bookkeeping keeps old cfg for diffing.
  4. Custom types runnable — load_and_start falls back to TaskHandler for unknown types (was: silently skipped) with _resolve_task_template (user template → evolution_prompt.md + warning) — matches P2's "custom type tasks execute".

Verification: pytest 744 (was 736, +8: validation 4-cases / create+duplicate / update+delete / hot-reload add-remove / restart-on-change / idempotent / template guards incl. delete-refused / custom-type task), import + CLI OK, Agent.md synced (doc-count guard green). CI test run 31588216240 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

Independent re-verification on head 4517b81 (4 files, 617+/17-):

  1. Task CRUD — task_create/update/delete with full validation (name regex ^[a-z0-9][a-z0-9-]*$ ≤32, builtin-or-custom type, project must be in projects.yml, interval ≥60 int). task_update merges fields without clobbering config; delete is idempotent-safe (not-found error).
  2. Template CRUD — custom templates in config_dir()/task-templates/*.md with atomic tmp+replace writes; builtin read-only; delete refused while tasks reference the type (host decision honored).
  3. Hot reload — apply_tasks: atomic save → _task_cfg_signature diff → add/remove/restart handlers without daemon restart; idempotent (same config = no-op). _start_handler_for/_stop_handler extraction keeps bookkeeping (_handler_cfgs) consistent.
  4. Custom types runnable — unknown types now fall back to TaskHandler instead of being silently skipped, with _resolve_task_template user-template lookup → evolution_prompt.md fallback + warning.
  5. Regression — re-ran locally: pytest 744 passed (was 736, +8 new), import check + CLI OK, GUI 225 passed, Agent.md count synced (744). 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 post-submit chain: ✅ (10:40:21Z) → ✅ (10:42:00Z) → ✅ (this cycle). Head 4517b81 unchanged, mergeable=CLEAN.

Final verification on head 4517b81 (4 files, 617+/17-):

  1. Task CRUD — task_create/update/delete; validation per all 6 host decisions (name ^[a-z0-9][a-z0-9-]*$ ≤32, type builtin-or-custom, project registered in projects.yml, interval ≥60); update merges fields without clobbering config.
  2. Template CRUD — custom templates in ~/.emrg/task-templates/.md (atomic tmp+replace); builtin read-only; delete refused while tasks reference the type (host decision).
  3. Hot reload — apply_tasks: atomic write → _task_cfg_signature diff → add/remove/restart, no daemon restart; idempotent.
  4. Custom types runnable — unknown types fall back to TaskHandler (was: silently skipped) with _resolve_task_template lookup → evolution_prompt.md fallback.

Verification: pytest 744 local (736→+8), import + CLI OK, GUI 225 passed, Agent.md synced. CI 31588216240 PASS (actionlint + doc-count guard). No issues — merging per merge policy (3 consecutive ✅, no ❌).

@argszero
argszero merged commit be574d5 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