Skip to content

Delete a run/session completely (#23) - #25

Merged
ableinc merged 1 commit into
mainfrom
agent/issue-23-delete-a-run-session-completely
Sep 6, 2026
Merged

Delete a run/session completely (#23)#25
ableinc merged 1 commit into
mainfrom
agent/issue-23-delete-a-run-session-completely

Conversation

@ableinc

@ableinc ableinc commented Sep 6, 2026

Copy link
Copy Markdown
Owner

Closes #23

What the agent did

Summary

Implemented issue #23 following the approved plan:

Backend

  • internal/store/store.go: added DeleteRun(ctx, runID) — deletes events, sessions, and the runs row in one transaction, returning ErrNotFound if the run didn't exist.
  • internal/server/server.go: added deleteRun handler and registered POST /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).
  • Tests: TestDeleteRun/TestDeleteRunNotFound in internal/store/store_test.go; TestDeleteRun/TestDeleteRunStopsInFlightRunFirst in internal/server/server_test.go (using the existing fakeController to assert Cancel is/isn't called appropriately).

Frontend (internal/web/assets/app.js, app.css)

  • Added 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 by window.confirm(...), which stops-then-deletes via the API.
  • Runs list table gained an "Actions" column; run detail page gained an action row under the title, navigating back to #/runs after a successful delete.
  • Added a minor .row-actions flex-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 in internal/git (git-identity assertions failing due to this sandbox's environment, not touched by this change).
  • Note: this repo requires a local, gitignored config.json/toolchain workaround to run go test in this sandbox (read-only Go sumdb cache blocked the pinned go1.26.5 toolchain fetch) — worked around locally with GOPATH=/tmp/gopath GOTOOLCHAIN=auto and a temporary config.json copied from config.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 existing POST /runs/:id/cancel convention) and the native window.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)
go test -race ./...
go: golang.org/toolchain@v0.0.1-go1.26.5.linux-arm64: verifying module: golang.org/toolchain@v0.0.1-go1.26.5.linux-arm64: open /home/node1/go/pkg/sumdb/sum.golang.org/latest: read-only file system
make: *** [Makefile:131: test] Error 1

Changes

internal/server/server.go      | 32 +++++++++++++++++++++++
 internal/server/server_test.go | 58 ++++++++++++++++++++++++++++++++++++++++++
 internal/store/store.go        | 35 +++++++++++++++++++++++++
 internal/store/store_test.go   | 43 +++++++++++++++++++++++++++++++
 internal/web/assets/app.css    |  5 ++++
 internal/web/assets/app.js     | 52 ++++++++++++++++++++++++++++++++++++-
 6 files changed, 224 insertions(+), 1 deletion(-)

Opened automatically by coding-agent-loop (run f858df05-637d-4f9b-8dbf-c9200f2c67aa, attempt 2, model claude-sonnet-5, cost $0.8746, session 58eccd94-bd40-4302-b92c-5d89f902ea28). Nothing here has been reviewed by a human yet.

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>
@ableinc
ableinc marked this pull request as ready for review September 6, 2026 11:09
@ableinc
ableinc merged commit f89b841 into main Sep 6, 2026
8 checks passed
@ableinc
ableinc deleted the agent/issue-23-delete-a-run-session-completely branch September 6, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Delete a run/session completely

1 participant