Skip to content

feat(jobs): persist lastResult and lastRanAt per job in state #175

@TerrysPOV

Description

@TerrysPOV

Problem

After a daemon crash or restart, jobs lose all context of what they were doing. The next run starts cold with no knowledge of whether the previous run succeeded, what it produced, or when it last ran.

Proposed solution

Add lastResult and lastRanAt fields per job in state.json:

{
  "jobs": [{
    "name": "morning-brief",
    "nextAt": 1234567890,
    "lastResult": "ok",
    "lastRanAt": 1234567000
  }]
}
  • lastResult: "ok" | "error" | "skipped"
  • lastRanAt: Unix timestamp of last completion

The heartbeat prompt can reference lastResult to avoid re-doing completed work after a restart. No breaking changes — fields are additive.

Source

Requested by @Nibbler1250 in #14 (Mega-Post).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions