Skip to content

[FEATURE]: Add DELETE /project/:id endpoint to remove stale projects #25004

Closed as not planned

Description

@georgernstgraf

Problem

OpenCode has CRUD for sessions but only CRU for projects:

  • GET /project — list
  • GET /project/current — get current
  • PATCH /project/:id — update
  • DELETE — missing

This causes:

  1. Stale project entries that cannot be removed — users report in:

  2. No API-driven cleanup — users resort to manual SQLite manipulation or community tools like opencode-project-manager

  3. Blocks downstream features — Telegram bots, workspace management, and storage reclamation ([FEATURE]: Session Lifecycle Management — unified storage reclamation, auto-archival, and child session cleanup #16101) cannot programmatically remove projects

  4. Orphaned sessions — Sessions become orphaned when project directory is renamed #23248 shows sessions become invisible when directories are renamed/moved; [FEATURE]: Add session migration dialog to recover orphaned or misplaced sessions #23249 proposes migration, but deleting the dead project is often the simpler fix

Proposal

Add DELETE /project/:projectID:

  • Deletes the project row from the project table
  • Foreign key cascade (ON DELETE CASCADE) automatically removes all associated sessions, messages, parts, todos, and permissions
  • Response: { deleted: true, sessionsRemoved: <count> }
  • Returns 404 for non-existent project IDs

Scope

  • Project.remove(id) — Effect service method
  • DELETE /project/:projectID — Hono route (server)
  • DELETE /project/:projectID — HttpApi endpoint (for SDK generation)
  • SDK client regenerates from OpenAPI annotations automatically
  • No TUI/Desktop UI changes in this PR

Related

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Apr 29, 2026
  2. github-actions commented on Apr 29, 2026

    @github-actions
    Contributor

    This issue doesn't fully meet our contributing guidelines.

    What needs to be fixed:

    • The feature request template requires a verification checkbox confirming the feature hasn't been suggested before (I have verified this feature I'm about to request hasn't been suggested before.). This checkbox is missing from the issue.

    Please edit this issue to address the above within 2 hours, or it will be automatically closed.


    This issue might be a duplicate of existing issues. Please check:

    If you believe this was flagged incorrectly, please let a maintainer know.

  3. github-actions commented on Apr 29, 2026

    @github-actions
    Contributor

    This issue has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window.

    Feel free to open a new issue that follows our issue templates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

coreAnything pertaining to core functionality of the application (opencode server stuff)

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions