[Bug] Routine deletion blocked for agent sessions when created_via != agent session
Bug Description
<h1><span style="color:#B33A3A">Bug: Routine deletion fails for agent-created routines when created_via != agent session</span></h1>
<span style="color:#555555"><strong>Reported by:</strong> Todd McCaffrey · <strong>Date:</strong> 2026-07-01 · <strong>Component:</strong> Claude Code Routines (research preview)</span>
<span style="color:#2A6FB3">Summary</span>
A Claude Code agent session cannot delete a routine in the user's own account if that routine's created_via metadata is http_api rather than an interactive agent session. The agent's delete attempt is rejected, and the routine can currently only be removed via the web UI at claude.ai/code/routines.
This is a CRUD-symmetry bug: routine ownership is documented as account-scoped, not transport-scoped, so any surface with the account's authority should be able to modify or delete anything created into that account by any other surface.
<span style="color:#2A6FB3">Expected behavior</span>
Routines belong to the user's individual claude.ai account regardless of which surface created them (web UI, Desktop app, CLI /schedule, or the routine-management path underlying http_api creation). Since all surfaces write to the same account and are documented as showing up identically across web, Desktop, and CLI, delete authorization should be checked against account ownership, not created_via.
Concretely: if an agent session acting on behalf of account X can create a routine, an agent session acting on behalf of account X should also be able to delete or modify any routine owned by account X — including ones with created_via: "http_api".
<span style="color:#2A6FB3">Actual behavior</span>
An agent session attempted to delete the routine mnemos-qdrant-parity-soak. The delete was rejected, with the agent reporting the rejection reason as the routine having been created_via: "http_api" rather than created by an agent session. The routine is currently only removable through the web UI delete icon.
Separately worth flagging: it's unclear whether Claude Code agent sessions currently expose a delete tool for routines at all, since the only documented HTTP surface for routines is the fire trigger endpoint (POST /v1/claude_code/routines/{routine_id}/fire). If no delete tool exists, the agent's stated rejection reason (created_via mismatch) may not correspond to a real API response — worth checking against the actual tool call/response in the session transcript rather than the agent's paraphrase.
<span style="color:#2A6FB3">Impact</span>
- Orphaned or unwanted routines created via the API trigger /
http_apipath cannot be cleaned up by the agent that would normally manage them, forcing a manual UI step. - The affected routine continues to fire on its schedule and 404 daily until manually deleted, consuming part of the account's daily routine-run cap in the interim.
- More generally: any automation that programmatically creates routines (CI, alerting systems, internal tools per the documented
http_apiuse case) has no corresponding programmatic teardown path if agent-initiated deletes are blocked oncreated_via.
<span style="color:#2A6FB3">Suggested fix</span>
Authorize routine delete/modify solely on account ownership. If created_via is used anywhere in the authorization path for mutating operations, remove it from that check — it should be provenance metadata only, not an access-control input.
<span style="color:#2A6FB3">Repro</span>
- Create a routine via the
http_apicreation path (or with an API trigger configured) under account X. - Start an interactive Claude Code agent session under account X.
- Ask the agent to delete that routine.
- Observe the delete is rejected on the basis of
created_via, while the same routine can be deleted successfully from the web UI under the same account.
Environment Info
- Platform: linux
- Terminal: gnome-terminal
- Version: 2.1.195
- Feedback ID: a7c9ecf8-cd1d-42c6-870a-9968efb9dbf6
Errors
[]