# Task 018: Observability, Retry, Cancel, And Audit Trail Development description: Build the operational layer for workflow history, job logs, redaction, retry/cancel actions, failure UI, and audit events across the full pipeline. ## Implementation Details - Workflow history records: - Article created. - Boundary questions generated. - Boundary answers submitted. - Plan generated/edited/approved. - Research started. - Evidence added/approved/rejected. - Draft assembled. - SEO/language review completed. - Asset approved/rejected/replaced. - Final approval granted. - Publishing dry run completed. - Publish commit created. - Delayed publish verification failed. - Site publishing config/script changed. - Job failed/retried/cancelled. - Failure UI shows: - Job type. - Status. - Error category. - Error message. - Last successful step. - Retry button when allowed. - Admin logs. - Sensitive values are redacted from logs before display. - Retry rules: - Plan generation manually only. - Research allowed. - Section scaffold per section. - SEO/language review allowed. - Publish commit allowed only if no publish commit exists. ## Public Interface - Admin and Editor see workflow timeline. - Admin can inspect redacted logs. - Allowed retry/cancel actions are available in UI. ## Acceptance Criteria - [ ] TDD pre-requirement: before implementation, write one failing behavior test showing a failed job appears in article workflow history with retry eligibility; proceed one operational behavior at a time and record evidence in `Result`. - [ ] Article detail page shows user, system, and agent events in order. - [ ] Job logs are stored and displayed with sensitive values redacted. - [ ] Retry buttons appear only where retry is allowed. - [ ] Cancelling queued/running jobs prevents article state mutation. - [ ] Publish commit retry is blocked once a publish commit exists. - [ ] Admin can see detailed logs; Editor sees safe failure summary. - [ ] All Admin script/config changes are audit-visible with diff and rollback target. ## Verification - Run audit/workflow API tests. - Run log redaction tests. - Run frontend timeline/failure UI tests. - Run smoke flow that forces a failed fake job and retries it. ## Result - Status: Pending execution. - TDD plan: To be filled during execution. - Red evidence: To be filled during execution. - Green evidence: To be filled during execution. - Refactor notes: To be filled during execution. - Verification output: To be filled during execution.