Ad Actum
Verified Change
Back to Ad Actum

Ad Actum War Room — Redacted Real Example

Extracted from a real Ad Actum War Room run against a private monorepo. Repo identity is redacted; the finding, urgency, and remediation scope are real.

Ad Actum War Room

Redacted Real Extract

P0 · Active bug
Executive synthesis

Both resetProject() and purgeProject() bypassed the canonical teardown seam, duplicating ad-hoc cleanup that skipped job cancellation, agent process termination, workspace cleanup, event emission, and CodeStudy unlinking. That left 19 entity types orphaned after reset, let running jobs operate against deleted change requests, and preserved stale project cost data on two user-facing paths.

Immediate recommendation

Consolidate project lifecycle cleanup through canonical CR teardown: route both resetProject() and purgeProject() through CrTeardownService.remove(), then run one project-scoped sweep for the remaining project-owned data.

Findings
Project reset and delete bypass canonical teardown

Both lifecycle paths duplicated cleanup instead of routing through CrTeardownService.remove(), so they skipped job cancellation, process kill, workspace cleanup, event emission, and unlinking.

Critical
apps/backend/src/projects/project-lifecycle.service.ts apps/backend/src/change-requests/cr-teardown.service.ts
Reset left 19 entity types behind

The UI promised an initial-state reset, but Features, Ideas, Initiatives, CodeStudies, BusinessRules, and KnowledgeDocuments survived and polluted future planning runs.

High
apps/backend/src/projects/project-lifecycle.service.ts apps/backend/src/projects/project-cleanup.service.ts apps/frontend/src/components/ProjectApp.tsx
Running jobs and agent processes survived deletion paths

Bypassing teardown allowed BullMQ jobs and long-running agent processes to continue operating against deleted change requests on two live user-facing flows.

High
apps/backend/src/projects/project-lifecycle.service.ts apps/backend/src/jobs/handlers/cleanup-jobs.handler.ts
Why this was prioritized

This was the highest-leverage fix because it replaced two hand-curated cleanup matrices with one canonical seam. A point fix on resetProject() alone would have left the same orphan and process-residue bug alive on the delete-project path.

Implementation scope
apps/backend/src/projects/projects.module.ts apps/backend/src/projects/project-lifecycle.service.ts apps/backend/src/projects/project.dto.ts apps/frontend/src/components/ProjectApp.tsx apps/backend/src/change-requests/cr-core.module.ts apps/backend/src/projects/project-reset.coverage.spec.ts
Follow-up specs generated
  1. Harden RuntimeSession/Event projectId ownership for orphan prevention
  2. Add CodeStudy {status, updatedAt} indexes for stuck-study scanning
  3. Add Spec dependency indexes for graph maintenance