Delete a run/session completely (#23) - #25
Merged
Conversation
DeleteRun on the store removes a run's events, sessions rows, and the run row itself in one transaction; the new POST /runs/:id/delete handler cancels an in-flight run first (best-effort, async) then deletes the DB rows and the on-disk transcript. The runs list and run detail pages gain Stop/Delete buttons, with a native confirm() dialog gating the delete. Closes #23 Co-Authored-By: Claude Sonnet 5 <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.
Closes #23
What the agent did
Summary
Implemented issue #23 following the approved plan:
Backend
internal/store/store.go: addedDeleteRun(ctx, runID)— deletesevents,sessions, and therunsrow in one transaction, returningErrNotFoundif the run didn't exist.internal/server/server.go: addeddeleteRunhandler and registeredPOST /runs/:id/delete. It fetches the run, cancels it first via the controller if not yet terminal (fire-and-forget, since cancellation is async), deletes the DB rows, then best-effort removes the transcript file (os.Remove, ignoring not-exist).TestDeleteRun/TestDeleteRunNotFoundininternal/store/store_test.go;TestDeleteRun/TestDeleteRunStopsInFlightRunFirstininternal/server/server_test.go(using the existingfakeControllerto assertCancelis/isn't called appropriately).Frontend (
internal/web/assets/app.js,app.css)runActionButtons(run, onDeleted)shared by the runs list and run detail page: a "Stop" button (shown only for in-flight statuses) and a "Delete" button gated bywindow.confirm(...), which stops-then-deletes via the API.#/runsafter a successful delete..row-actionsflex-wrapper CSS rule.Verification
go build ./...succeeds.go test ./internal/store/... ./internal/server/...passes, including the new tests.go test ./...shows only pre-existing, unrelated failures ininternal/git(git-identity assertions failing due to this sandbox's environment, not touched by this change).config.json/toolchain workaround to rungo testin this sandbox (read-only Go sumdb cache blocked the pinnedgo1.26.5toolchain fetch) — worked around locally withGOPATH=/tmp/gopath GOTOOLCHAIN=autoand a temporaryconfig.jsoncopied fromconfig.example.json, both cleaned up before committing; nothing environment-specific was committed.Reviewer should double check the route verb choice (
POST /runs/:id/delete, matching existingPOST /runs/:id/cancelconvention) and the nativewindow.confirm()choice for the confirmation dialog — both were flagged as judgment calls in the plan and I followed the plan's recommendation for each.Verification
Tests failed (
make test). This PR is a draft — the failure is reported rather than hidden, so you can judge whether the change is salvageable.Test output (tail)
Changes
Opened automatically by coding-agent-loop (run
f858df05-637d-4f9b-8dbf-c9200f2c67aa, attempt 2, modelclaude-sonnet-5, cost $0.8746, session58eccd94-bd40-4302-b92c-5d89f902ea28). Nothing here has been reviewed by a human yet.