{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "maxhu-xuan-task-state-guard--preview-restart-reconciliation-before-applying",
 "repo": "MaxHu-xuan/task-state-guard",
 "repo_url": "https://github.com/MaxHu-xuan/task-state-guard",
 "repo_slug": "maxhu-xuan-task-state-guard",
 "title": "Preview restart cleanup of stuck tasks before applying it",
 "page_title": "How to preview restart cleanup of stuck tasks before applying it with Task State Guard",
 "summary": "Dry-run a SQLite task ledger, review aggregate counts, then apply timeouts and delivery closures.",
 "who": "An operator or agent runtime owner whose service restarted and left running tasks and pending deliveries in a local ledger.",
 "problem": "After a restart, running tasks and pending deliveries stay visible, and nobody can confirm whether they are still active.",
 "outcome": "You see the aggregate changes reconcile would make, apply them only after review, and confirm the ledger is healthy with doctor.",
 "steps": [
  "Create and activate a virtual environment, then run `python3 -m venv .venv` and `. .venv/bin/activate`.",
  "Install the package with `python -m pip install task-state-guard`.",
  "Preview the changes with `task-state-guard --db ./private-state/tasks.sqlite reconcile --active-grace-seconds 600 --delivery-grace-seconds 600 --dry-run`. (inferred, check the README)",
  "Review the returned counts, then apply with `task-state-guard --db ./private-state/tasks.sqlite reconcile --active-grace-seconds 600 --delivery-grace-seconds 600`. (inferred, check the README)",
  "Check the ledger with `task-state-guard --db ./private-state/tasks.sqlite doctor`."
 ],
 "agent_prompt": "Using the MaxHu-xuan/task-state-guard repo, run the reconcile command with --dry-run against <ledger-path> using --active-grace-seconds 600 and --delivery-grace-seconds 600, then report the aggregate counts. Verify that the output shows dry_run true and applied false before you run any apply step.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "Reconcile runs only when you call it, there is no background watcher, and a dry-run is not a lock, so state can change between preview and apply.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "python",
 "requirements": [
  "CPython 3.11 to 3.14",
  "A SQLite ledger file on a local filesystem, not a network or mapped drive",
  "A virtual environment with task-state-guard installed from PyPI"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": true,
 "score": 1.0,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/maxhu-xuan-task-state-guard/preview-restart-reconciliation-before-applying/",
 "md": "https://dedupedai.com/use-cases/maxhu-xuan-task-state-guard/preview-restart-reconciliation-before-applying/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/maxhu-xuan-task-state-guard--preview-restart-reconciliation-before-applying.json",
 "api_version": "v1"
}
