multica/apps/web
LinYushen 09764c5f51
feat(agent): replace hard delete with archive/restore (#346)
* feat(agent): replace hard delete with archive/restore

Replace agent deletion with soft archive pattern. Archived agents
are preserved in the database with all historical references intact
but cannot be assigned, mentioned, or trigger tasks.

Backend:
- Add archived_at/archived_by columns to agent table (migration 031)
- Replace DELETE /api/agents/{id} with POST /api/agents/{id}/archive
- Add POST /api/agents/{id}/restore endpoint
- ListAgents excludes archived by default (?include_archived=true to include)
- Skip archived agents in task triggers (on_assign, on_comment, on_mention)
- Block assignment to archived agents
- Cancel pending tasks on archive
- New events: agent:archived, agent:restored (replacing agent:deleted)

Frontend:
- Agent type includes archived_at/archived_by fields
- Mention autocomplete and assignee picker filter out archived agents
- Agent list shows archived agents with muted styling
- Agent detail shows archive banner with restore button
- Delete button replaced with Archive button and updated confirmation dialog
- API client: archiveAgent/restoreAgent replace deleteAgent

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix(agent): self-review fixes for archive feature

- Fix: workspace store now fetches agents with include_archived=true
  so archived agents are actually visible in the frontend (the archived
  UI was dead code before — ListAgents excludes archived by default)
- Fix: add error logging for CancelAgentTasksByAgent in ArchiveAgent
- Fix: add idempotency guards — return 409 Conflict when archiving
  an already-archived agent or restoring a non-archived agent
- Fix: revert unnecessary extra GetAgent query in ReconcileAgentStatus
  (archived agents won't have running tasks after CancelAgentTasksByAgent)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 17:33:52 +08:00
..
app feat(agent): replace hard delete with archive/restore (#346) 2026-04-02 17:33:52 +08:00
components feat(agent): replace hard delete with archive/restore (#346) 2026-04-02 17:33:52 +08:00
features feat(agent): replace hard delete with archive/restore (#346) 2026-04-02 17:33:52 +08:00
hooks fix(upload): harden upload flow — sanitize filenames, refresh CF cookies, deduplicate handlers 2026-03-31 15:52:40 +08:00
lib refactor(web): self-contained shadcn UI with base-nova style and design tokens 2026-03-24 18:19:26 +08:00
public feat(web): add about, changelog pages and fix landing header for light backgrounds 2026-04-01 05:16:24 +08:00
shared feat(agent): replace hard delete with archive/restore (#346) 2026-04-02 17:33:52 +08:00
test feat(agent): replace hard delete with archive/restore (#346) 2026-04-02 17:33:52 +08:00
components.json chore(ui): switch shadcn menuColor from inverted-translucent to default 2026-03-31 11:01:54 +08:00
next-env.d.ts chore(web): update next-env.d.ts routes path 2026-04-01 05:51:28 +08:00
next.config.ts feat(web): SEO optimization and auth flow improvements for landing pages 2026-04-01 16:54:11 +08:00
package.json feat(ui): editor UX improvements — lowlight, upload, emoji, comment editing 2026-03-31 18:37:53 +08:00
postcss.config.mjs refactor(web): self-contained shadcn UI with base-nova style and design tokens 2026-03-24 18:19:26 +08:00
proxy.ts feat(web): redirect logged-in users from / to /issues via server-side proxy 2026-04-01 18:20:57 +08:00
tsconfig.json refactor: remove unused monorepo tooling 2026-03-26 17:57:11 +08:00
vitest.config.ts feat: resizable sidebar, issue detail rewrite, package consolidation 2026-03-26 16:47:04 +08:00