# KAN-10: Add archive and delete actions for workflows

## Ticket

https://danubii.atlassian.net/browse/KAN-10

## Branches

- Source: `ai/KAN-10-add-archive-and-delete-actions-for-workflows`
- Target: `main`

## Repositories

- `danubii/openclaw-orchestrator`: `ai/KAN-10-add-archive-and-delete-actions-for-workflows` -> `main` (Completed)

## Summary

https://danubii.atlassian.net/browse/KAN-10
Add workflow lifecycle actions to the workflow overview so users can archive workflows they no longer need and delete workflows when it is safe to remove them.
Scope
- Add archive action from the workflow overview and workflow detail page.
- Add delete action from the workflow overview and workflow detail page, with confirmation before destructive removal.
- Update backend workflow APIs and persistence model to support archived workflows and safe deletion semantics.
- Hide archived workflows from the default overview, with a way to view or restore archived workflows if restore is chosen as part of implementation.
- Prevent deletion of workflows that are actively running, or require cancellation/terminal state before deletion.

## Approved Plan

KAN-10 adds workflow lifecycle actions so users can archive workflows without losing audit history and delete eligible workflows only after explicit confirmation. Archived workflows should be hidden from the default overview but remain viewable and restorable.
- Archive is available from workflow overview and detail.
- Archived workflows are excluded from the default active workflow list.
- Archived workflows keep detail URLs, artifacts, logs, approvals, PR records, and audit history.
- Archived workflows can be viewed in an archived view and restored.
- Delete is available from overview and detail with confirmation.
- Delete is blocked for running workflows and workflows with queued/running worker jobs.
- Delete eligibility is limited to terminal/safe states.

## Test Summary

Running repository test profile `openclaw-local` for `KAN-10`.
danubii/openclaw-orchestrator
- Target: `main`
- Working: `ai/KAN-10-add-archive-and-delete-actions-for-workflows`
Required: `True`
Exit code: `0`
Timed out: `False`
Blocked: `False`

## Cross-Repository Integration Summary

Single-repository workflow; cross-repository integration was not required.

## Smoke Test Summary

Running repository smoke profiles for `KAN-10` after implementation, tests, and cross-repository integration.
- `danubii/openclaw-orchestrator` in `repo-10-danubii-openclaw-orchestrator`: `ai/KAN-10-add-archive-and-delete-actions-for-workflows` -> `main`
Required: `True`
Exit code: `0`
Timed out: `False`
Blocked: `False`
```bash
GIT_TERMINAL_PROMPT=0 GIT_ASKPASS=/workspace/git-askpass.sh git clone --branch 'main' 'https://github.com/Danubii/openclaw-orchestrator.git' 'repo-10-danubii-openclaw-orchestrator' && git -C 'repo-10-danubii-openclaw-orchestrator' checkout --detach 'de4fb9747ea15e234aa6fbc7987126be16412c84'

## Review Summary

KAN-10 implements workflow lifecycle management — archive, restore, and soft-delete — across the full stack: a nullable metadata migration on `WorkflowRun`, three new orchestrator methods with guard checks, three new API endpoints, an active/archived/all list-view filter, and a new client component (`WorkflowLifecycleActions`) surfaced on both the overview and detail pages. Worker job claiming was patched to skip archived/deleted workflows defensively.
All tests pass: 44 application tests, 13 API integration tests, and 2 Playwright smoke tests. The migration, model snapshot, and DTO mappings are internally consistent. Every Jira acceptance criterion is met.
---
**APPROVE_WITH_NOTES**
No blocking or high-severity defects were found. The medium-priority issues are architectural concerns and minor coverage gaps that should be tracked as follow-up rather than blocking the merge.
---
None.
---

## Manual QA

KAN-10: Add archive and delete actions for workflows
Automated flow completed through test deploy. Medium review findings accepted for this run; no blocker/high findings remain.

## Guardrails

- OpenClaw created this PR handoff record, but does not merge automatically.
- Human review is required before merge.