Skip to content

feat(workflows): add thread workflow delete RPC and enable TUI Delete action#143

Open
andrei-hasna wants to merge 2 commits into
mainfrom
openloops/f16bb0bc-92e8-4db9-aaa5-323ce2c091e8-7b39e7fd/a2c7c69a-a392-45cf-a3f3-8f325fd07f22-e5f281c0
Open

feat(workflows): add thread workflow delete RPC and enable TUI Delete action#143
andrei-hasna wants to merge 2 commits into
mainfrom
openloops/f16bb0bc-92e8-4db9-aaa5-323ce2c091e8-7b39e7fd/a2c7c69a-a392-45cf-a3f3-8f325fd07f22-e5f281c0

Conversation

@andrei-hasna

Copy link
Copy Markdown
Contributor

Summary

Adds first-class workflow spec deletion so the /workflows manager can enable its previously-disabled Delete action.

  • Protocol (codex-app-server-protocol): new experimental thread/workflow/delete RPC with ThreadWorkflowDeleteParams { thread_id, workflow_record_id }ThreadWorkflowDeleteResponse { deleted: bool }, registered next to create/get/list. The bool response preserves raw YAML / prompt redaction (never re-serializes the spec body).
  • State (codex-state): WorkflowStore::delete_thread_workflow_spec returns WorkflowSpecDeleteOutcome (Deleted / NotFound / BlockedByActiveRun). It is thread-scoped, refuses specs that still own a non-terminal run (so an in-flight run is never yanked), and cascades terminal runs by enabling PRAGMA foreign_keys for the delete connection then restoring the default so the pooled connection is not left enforcing FKs.
  • App-server: thread_workflow_delete processor mirrors get; Deleteddeleted:true, NotFounddeleted:false (no error), BlockedByActiveRuninvalid_request.
  • TUI (codex-tui): the Delete spec action is enabled with a Yes/No confirmation step; on success the manager refreshes so the deleted spec disappears.

Design notes

  • Missing workflow returns deleted:false rather than erroring (idempotent delete).
  • Active-run guard chosen as the smallest-safe behavior over silently cascading a running workflow's rows.
  • No JSON/TS schema-fixture changes: the delete RPC is experimental and filtered out of the vendored fixtures (confirmed by schema_fixtures tests).

Testing

  • cargo test -p codex-app-server-protocol (incl. schema fixtures) — pass
  • cargo test -p codex-state workflows (success / missing / thread-scoped / active-run guard) — pass
  • cargo test -p codex-app-server --test all v2::workflow (delete success + missing, no-leak) — pass
  • cargo test -p codex-tui workflow (delete dispatch + confirm/cancel) — pass
  • cargo clippy + cargo fmt --check on touched crates — clean

🤖 Generated with Claude Code

andrei-hasna and others added 2 commits July 6, 2026 14:02
… action

Add a thread/workflow/delete app-server RPC and wire the /workflows manager
Delete action to it.

- Protocol: ThreadWorkflowDeleteParams/Response, registered as the experimental
  thread/workflow/delete method alongside create/get/list; extend the
  experimental-marker test.
- State: WorkflowStore::delete_thread_workflow_spec returns a
  WorkflowSpecDeleteOutcome (Deleted/NotFound/BlockedByActiveRun). Deletion is
  thread-scoped, refuses specs with a non-terminal run, and cascades terminal
  runs by enabling foreign_keys for the delete connection then restoring the
  default so the pooled connection is not left enforcing FKs.
- App-server: thread_workflow_delete processor maps the outcome to
  { deleted: bool }; active-run conflicts become invalid_request. The bool
  response preserves raw YAML/prompt redaction.
- TUI: enable the previously-disabled Delete item with a Yes/No confirmation
  step; on success refresh the manager so the spec disappears.
- Tests: state (success/missing/thread-scoped/active-run guard), app-server
  (success + missing, no-leak), and codex-tui (delete dispatch + confirm/cancel).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

1 participant