Admin /reset endpoint — manual escape hatch #9

Closed
opened 2026-04-16 22:45:09 +00:00 by claude-desktop · 0 comments
Collaborator

User story

As ops, I want a POST /reset endpoint that drops the worktree and session for a given (agent, repo, issue) triple, so that I can force a fresh start without rummaging through ~/.cache/ and ~/.local/state/ by hand.

Acceptance criteria

Endpoint (src/main.ts)

  • POST /reset with JSON body { "agent": "boss", "repo": "charles/peon", "issue": 4 }
  • Validates all three fields are present; returns 400 with a clear message if not
  • Calls releaseWorktree({ keep: false }) for the matching (agent, repo, branch-derived-from-issue)
  • Calls dropSession(sessionKey(agent, repo, issue))
  • Returns { "dropped": { "worktree": <bool>, "session": <bool> } } indicating which existed and were removed
  • No-op (returns { dropped: { worktree: false, session: false } }) if nothing existed — not a 404

Auth

  • Same auth scheme as the other admin-style endpoints (/cancel, /task) — currently unauthenticated; if that changes during this work, update consistently
  • If the service eventually grows real auth, this endpoint joins it; do not invent a one-off scheme here

Tests (src/main.test.ts)

  • POST with valid body for an existing entry → both flags true
  • POST with valid body for a non-existing entry → both flags false, status 200
  • POST with missing field → 400

Out of scope

  • A dashboard button calling this endpoint (manual curl is fine for v1)
  • Reset of just the worktree without the session (or vice-versa) — single composite reset is enough

References

  • Discussion: chat history, "Phase 3 — housekeeping"

Dependencies

  • Blocked by: #6 (needs both worktree and session APIs)
  • Blocks: none (housekeeping leaf)
  • Branch off: issue-6-sessions-store
  • Full graph: #10
## User story As **ops**, I want a `POST /reset` endpoint that drops the worktree and session for a given `(agent, repo, issue)` triple, so that I can force a fresh start without rummaging through `~/.cache/` and `~/.local/state/` by hand. ## Acceptance criteria ### Endpoint (`src/main.ts`) - [ ] `POST /reset` with JSON body `{ "agent": "boss", "repo": "charles/peon", "issue": 4 }` - [ ] Validates all three fields are present; returns `400` with a clear message if not - [ ] Calls `releaseWorktree({ keep: false })` for the matching `(agent, repo, branch-derived-from-issue)` - [ ] Calls `dropSession(sessionKey(agent, repo, issue))` - [ ] Returns `{ "dropped": { "worktree": <bool>, "session": <bool> } }` indicating which existed and were removed - [ ] No-op (returns `{ dropped: { worktree: false, session: false } }`) if nothing existed — not a `404` ### Auth - [ ] Same auth scheme as the other admin-style endpoints (`/cancel`, `/task`) — currently unauthenticated; if that changes during this work, update consistently - [ ] If the service eventually grows real auth, this endpoint joins it; do not invent a one-off scheme here ### Tests (`src/main.test.ts`) - [ ] POST with valid body for an existing entry → both flags `true` - [ ] POST with valid body for a non-existing entry → both flags `false`, status `200` - [ ] POST with missing field → `400` ## Out of scope - A dashboard button calling this endpoint (manual `curl` is fine for v1) - Reset of just the worktree without the session (or vice-versa) — single composite reset is enough ## References - Discussion: chat history, "Phase 3 — housekeeping" ## Dependencies - **Blocked by:** #6 (needs both worktree and session APIs) - **Blocks:** none (housekeeping leaf) - **Branch off:** `issue-6-sessions-store` - **Full graph:** #10
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#9
No description provided.