diff --git a/CHANGELOG.md b/CHANGELOG.md index 12e73c3d9..097e806b0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ release's per-component sections are labelled beneath its heading. - A model provider that refuses a task's credential or has run out of credit now blocks the task with a fix to follow, instead of leaving a raw API error, and the task is flagged for retry once the provider settings change. - New Google providers added from the catalogue work without setting a base URL. +- Archiving a task now records that its execution history is kept deliberately and which child tables hold it, so its audit event explains what happened to the task after its row was removed. ### archie-ui diff --git a/internal/domain/taskactions/service.go b/internal/domain/taskactions/service.go index 4d7fb932e..e44d8b6f5 100644 --- a/internal/domain/taskactions/service.go +++ b/internal/domain/taskactions/service.go @@ -598,6 +598,20 @@ func (s Service) applyMerge(ctx context.Context, task *Task, actor Actor, o outc func (s Service) applyArchive(ctx context.Context, task *Task, actor Actor, o outcome) (outcome, error) { o.event.Kind, o.event.Detail = events.KindTaskArchiveRequested, actor.describe("archive requested") + // Archiving removes the task row but deliberately keeps its child rows: + // execution history, usage and the dispatch ledger are records about the + // work, not attachments to the row. This event is their provenance and says + // what was kept; audit retention never prunes it. Events are named apart + // because the instance's per-kind retention, not this decision, owns their + // lifetime, and run credentials are not listed because they expire and the + // sweep removes them. + o.event.Data = map[string]any{ + "retention": "kept", + "children": []string{ + "transitions", "step_executions", "model_usage", "tool_calls", "binding_dispatches", + }, + "events": "audit_retention", + } id, err := s.Store.ArchiveTask(ctx, task.ID, task.Status, o.event) if err != nil { return o, err