feat(engine): implement job lifecycle execution #93
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/kronai!93
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/0030-implement-job-lifecycle"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Implement the full job lifecycle: read prompt, connect MCP servers, call LLM with tools, log results, and handle ephemeral vs recurring cleanup.
Why
Completes the Phase 2 job execution engine — kronai can now run jobs end-to-end.
Testing
Breaking Changes
None.
Notes
Ephemeral jobs are deleted after successful execution. Recurring jobs persist. Results written to
{job_path}/results/{timestamp}/output.md.Closes #0027
Closes #0028
Closes #0029
Closes #0030
Automated Review — PR #93
Result: APPROVED
The capstone of Phase 2 — wires config, discovery, prompt reader, LLM client, and MCP integration into a working job lifecycle. Clean orchestration.
JobError,LLMError,MCPErrorall caught per-job with logging and graceful return (False). MCP connections cleaned up on error paths._write_resultand_cleanup_mcpsextracted as helpers. Clear flow inrun_job().Suggestions (non-blocking)
src/kronai/engine.py:68,133—load_config()is called in bothrun_job()andrun_interval(). For an interval with N jobs, config is loaded N+1 times. Consider loading once inrun_interval()and passing the config torun_job().src/kronai/engine.py:98-104— When the LLM responds with tool calls (function/tool_use),_extract_contentinllm.pywould return"None"(sincecontentis null). The engine should eventually handle tool call execution rather than writing"None"as the result.src/kronai/engine.py:113—shutil.rmtree(..., ignore_errors=True)could fail silently. Consider adding a logged warning or checking success:src/kronai/engine.py:166—server._nameaccessed via private attribute. Consider adding anameproperty toMCPServeror usingserver._namewith a public accessor. (Already suppressed withnoqa: SLF001.)src/kronai/engine.py:140— Timestamp in_write_resultuses local time viatime.strftime. Consider using UTC (time.gmtime) for reproducible timestamps across environments.