# AGY-004: Subagents not reliably following deploy.sh for Symphony changes

**Status:** open
**Priority:** P1
**Type:** process / reliability
**Reporter:** @antonio.telimban (2026-02-20)
**Assignee:** aria
**Product:** agency (symph-agency)
**Created:** 2026-02-20
**Updated:** 2026-02-20

## Description

Users are experiencing 502 errors and stuck loading screens (static loader image) when accessing Symphony (`symphony.symph.co`). Root cause: subagents spawned to work on `symph-agency` are not guaranteed to follow `deploy.sh` — they may run `npm run build` or `pm2 reload` directly, which:

1. Overwrites the production `.next/` folder while the app is actively serving from it
2. Causes the live process to pick up a half-baked build → stuck loader
3. Removes all safety checks (smoke test, health check, auto-rollback)

## Evidence

- `symph-agency` had **73 PM2 restarts in 90 minutes** (2026-02-20 session)
- Deploy history shows many rapid-succession deploys — each reload = brief 502 window
- `CLAUDE.md` in the project root has the rules, but spawned subagents only read it if explicitly told to
- `spawn-code-task.sh` enforces worktree rules for product apps, but has **no equivalent for symph-agency**

## Root Cause

The spawn task for symph-agency subagents does not embed the deploy.sh requirement. Subagents default to the most obvious commands (`npm run build`, `pm2 reload`) without knowing these are forbidden.

## Fix Applied (2026-02-20)

- Added **"Spawning Symphony Tasks" section** to `AGENTS.md` with:
  - Mandatory deploy rules block to embed in every symph-agency spawn task
  - Explicit "NEVER do this" pattern
  - Copy-paste spawn template

## Acceptance Criteria

- [ ] All symph-agency subagent spawns include the deploy.sh rules block
- [ ] No more direct `npm run build` or `pm2 reload` calls from subagents
- [ ] 502 errors and stuck loaders eliminated during deployments
- [ ] PM2 restart count stays proportional to actual deploy.sh runs (not random crashes)

## Updates

### 2026-02-20 — ARIA
Issue created from Antonio's report. Root cause identified and AGENTS.md updated with mandatory spawn template. Going forward, all symph-agency subagent spawns must embed the deploy rules block explicitly.
