Cascade-delete task runs and add task templates#243
Merged
Conversation
Six bundled templates (RSS feed digest, GitHub release notes, GitHub issue roundup, Reddit topic monitor, Competitor watch, Link research) surface in three places: a card grid in the Tasks screen empty state, a compact list in the project sidebar Tasks tab empty state, and a chip row inside the Create Task modal. Selecting a template pre-fills name, description, instructions (with placeholder tokens), and schedule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files written to the project root don't get file cards in the task detail transcript because withCreatedFileCards only recognizes writes inside sources/, drafts/, or done/. Updating every template instruction to target sources/ fixes this and is semantically correct — these are external research materials, not drafts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Deleting a task left orphaned run records and transcript files on disk. Now `deleteDefinition` aborts any live runs for the definition, removes persisted run index entries, and deletes their `.jsonl` transcripts. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three paths now prune runs that lost their parent definition: 1. Project removal — `deleteAllRuns` wipes the run index and transcripts when the project is unlinked (`removeProject` now takes the project path so it can reach the disk after the store entry is gone). 2. Definition deletion — `deleteRunsByDefinition` (previous commit). 3. Startup hydration — `deleteOrphanedRuns` catches runs whose definition was removed in an older session before the cascade existed. The three store helpers share a `deleteRunsWhere` predicate helper to avoid duplicating the filter-write-unlink loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a definition or project is deleted while a run is in-flight, the abort triggers the runner's finally block which calls `persist(run)` — re-writing the run we just removed. Add a `deleted` flag to `LiveRun`; `persistRun` and `runOne`'s post-run bookkeeping (prune, lastRunAt patch) skip when the flag is set. The live-map entry is left for `runOne` to clean up so active-count bookkeeping stays correct. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The renderer re-fetched definitions on a `definitions-changed` event but not runs, so deleted runs stayed visible until the next app restart. Now both lists are refreshed together. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sources/folder..jsonltranscripts). Covers three paths:deleteRunsByDefinitionremoves matching runs immediately.deleteAllRunswipes all runs when a project is unlinked.deleteOrphanedRunscatches runs orphaned by deletions in older sessions.deletedflag onLiveRunprevents the runner'sfinallyblock from writing the run back after the store has been cleaned.definitions-changedevents so deleted runs disappear immediately.Test plan
npm run test:unitpasses (534/534)🤖 Generated with Claude Code