fix(taskactions): record the retention rule for archived task children (#1859)

Archiving deletes 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. Nothing recorded that rule, so the kept rows had no
parent row to explain them and no query could say what happened to an archived
task.

Record the rule in the archive event's data. The kind is protected from audit
retention and already projects into the audit feed, so that event is the
archived-task record: it names the kept child sets and leaves event rows to the
instance's per-kind retention.
This commit is contained in:
sam committed 2026-11-11 02:59:20 +11:00
1 parent 0033933a58
commit c155bb24ba
2 files changed
+15

No files matched your search

+1
View File
@@ -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. - 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. - 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 ### archie-ui
+14
View File
@@ -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) { 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") 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) id, err := s.Store.ArchiveTask(ctx, task.ID, task.Status, o.event)
if err != nil { if err != nil {
return o, err return o, err