# Upwork Memo — Agent Nova

**Date:** 2 Sep 2026  
**Time:** 4 hours  
**Project:** Agent Nova — Salesforce AI development pipeline  

---

## Summary

Phase 4 (Code Reviewer + QA Engineer + orchestrator wiring) is implemented locally. Today’s 4-hour block focuses on finalizing that work, adding human-in-the-loop review escalation, and validating the full pipeline end-to-end.

---

## Planned work (4 hours)

### 1. Phase 4 finalization (~30 min)

- Run full test suite (`pytest`) and fix any regressions
- Commit Phase 4 deliverables: Code Reviewer, QA Engineer, static analysis (PMD/mock), Apex test runner, review/fix loop in orchestrator
- Update README and handoff docs if anything changed during verification

**Deliverables:** Clean commit, green tests, updated docs

---

### 2. HUMAN_REVIEW webhook escalation (~2 hr)

When the review/fix loop hits `MAX_REVIEW_CYCLES` (default 3), the run currently goes straight to `FAILED`. Today we will wire the existing `HUMAN_REVIEW` workflow state instead:

- Orchestrator transitions to `HUMAN_REVIEW` when max cycles are exceeded (instead of hard fail)
- Jira comment posted with review findings summary and a link/instructions to resume
- Webhook or API endpoint to accept human decision: **approve & continue** → proceed to QA/PR, or **reject** → `FAILED`
- Audit trail: persist review-cycle artifacts already written; add resume event to audit log

**Deliverables:** Escalation path live in orchestrator + resume webhook + tests for approve/reject paths

---

### 3. Configurable review severity threshold (~30 min)

- Add env setting (e.g. `REVIEW_BLOCK_SEVERITIES=critical,high`) so blocking severity is configurable
- Default remains `critical` + `high` (unchanged behavior)
- Document in `.env.example` and Phase 4 handoff

**Deliverables:** Config-driven pass/fail rule + unit test

---

### 4. Live smoke test (~1 hr)

Run the full pipeline against real integrations (where credentials are available):

1. Trigger a sample Jira story through intake → design approve → implement → review → QA → draft PR
2. Confirm artifacts: `review.json`, `qa-report.json`, `deploy.json`, draft PR URL
3. Optional live providers: `GIT_PROVIDER=github`, `SALESFORCE_PROVIDER=cli`, `STATIC_ANALYSIS_PROVIDER=pmd`
4. Document results, blockers, and any env gaps in session notes

**Deliverables:** Smoke test checklist completed (or documented blockers if creds unavailable)

---

## End-of-day expected state

```text
Jira trigger → … → implement → review (fix loop, max 3) 
                              ├─ pass → QA → draft PR
                              ├─ max cycles → HUMAN_REVIEW → resume → QA/PR or FAILED
                              └─ unfixable fail → FAILED
```

- Phase 4 code committed and tested
- Human review escalation replaces hard fail at max cycles
- Configurable severity threshold for review blocking
- Live smoke test run or blockers documented

---

## Out of scope today

- Custom PMD / Code Analyzer ruleset
- Real Apex test class generation (beyond current stubs)
- GitHub Actions CI pipeline
- Non-dry-run Salesforce deploy to lower org

These remain on the post–Phase 4 backlog for a follow-up session.

---

## Dependencies / blockers

| Item | Needed for |
|------|------------|
| `GITHUB_TOKEN` + `GIT_REPO_URL` | Live GitHub smoke test |
| `sf` CLI auth + `SALESFORCE_ORG_ALIAS` | Live deploy validate + Apex tests |
| Jira webhook URL (if testing resume externally) | HUMAN_REVIEW resume from Jira comment |

Mock providers remain the default; all new work is testable locally without live credentials.
