DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to preview restart cleanup of stuck tasks before applying it with Task State Guard

Dry-run a SQLite task ledger, review aggregate counts, then apply timeouts and delivery closures.

Short answer: Create and activate a virtual environment, then run python3 -m venv .venv and . .venv/bin/activate; then 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. All steps.

Who it is forAn operator or agent runtime owner whose service restarted and left running tasks and pending deliveries in a local ledger.

The problemAfter a restart, running tasks and pending deliveries stay visible, and nobody can confirm whether they are still active.

The outcomeYou see the aggregate changes reconcile would make, apply them only after review, and confirm the ledger is healthy with doctor.

What you need first

  • 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

Steps

  1. Create and activate a virtual environment, then run python3 -m venv .venv and . .venv/bin/activate.
  2. Install the package with python -m pip install task-state-guard.
  3. 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)
  4. 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)
  5. Check the ledger with task-state-guard --db ./private-state/tasks.sqlite doctor.

Prompt for your agent

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.

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.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for MaxHu-xuan/task-state-guard and "Preview restart cleanup of stuck tasks before applying it"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer