# Workflow readiness audit — 2026-10-08

## Scope and conclusion

This audit compares the owner's three supplied flowcharts with the current code and
the isolated `peta_zs_dev` database on `dev-shawn`. It covers Preview funnel
`07ef866f-3b68-4c26-8e77-abd69c707df5`, Project funnel
`e28d76d4-008c-45a9-be38-1ad5c9ee5724`, their ten Slots, and My Work responsibilities.

**The full workflow is not ready.** At the initial audit, My Work was not an exact
projection of human touchpoints. The follow-up section records the subsequent code
corrections; the later findings preserve the original audit snapshot. Some registration and reminder rules are configured, and the underlying
handoff/outcome machinery exists. These facts do not prove end-to-end operation.

Database inspection used SELECTs inside a read-only transaction, fake integrations and
array cache/session. No customer messages, calls, configuration changes, historical
journey backfills, or Production operations were performed. Provider credentials were
checked only for presence. Template approval and channel status below are cached database
values, not a new provider health check.

The chart's three time periods are not identical to the current business-stage labels:
after-Preview follow-up belongs to the Preview journey, while a paid Project enters
business Stage 3 immediately. Stage 1 attendance still makes a customer eligible for
Stage 2 without Membership payment. Eligibility must coexist with unfinished human work.

## Follow-up implementation after the owner confirmed mandatory human contact

The owner confirmed that successful AI calls must also be followed by human contact, and that
customers can repeatedly attend both business stages. The following code changes supersede the
original human-work findings below; the per-Slot configuration audit remains unchanged:

- Every answered AI call requires human contact. AI answers remain evidence, never a human relationship.
- `lead_action_items.handoff_context` freezes the Session, Slot, registration and question phase.
  Different visits retain different obligations; repeated callbacks and safety checks reuse a task.
- New landing registrations queue `EnsureFunnelHumanContact` for the configured handoff deadline,
  so a newer Session or paid aggregate cannot hide the earlier registration's human work.
  This queued job does not depend on the periodic scheduler; isolated development workers can
  create its internal tasks while provider access and the periodic scanner remain disabled.
- Attendance, payment and another registration do not close unfinished Call tasks. A missed
  pre-webinar deadline is recorded without pretending a colleague completed the task.
- My Work projects actual open human tasks by their actual assignees, alongside historical suggestions.
  Before/after webinar work is separated; task forms and AI summaries use the original Session/phase.
- Callback links and WhatsApp quick replies identify the original send and Slot/Session. Old callbacks
  cannot move a newer Session or another Funnel. Missing/moved registrations are not guessed.
- The owner chose human confirmation for AI appointment requests. A structured requested time/type
  updates the existing contact task; a request after completed contact creates a separate confirmation
  task. AI-reported `appointment_booked` is never treated as a real booking. No Calendar/Zoom row is created.
- The two current registration profiles expose `wants_followup`, but no appointment time/type fields.
  This legacy flag now creates a clarification instruction (information, Human Call or Zoom), without
  inventing a time. To capture an actual proposed time/type automatically, the profile needs the shared
  appointment extraction fields. Provider profiles were not edited or synchronized.

The aggregate chart still counts unique leads and cumulative readiness. My Work counts actionable
responsibilities/tasks, so the numbers may overlap: a Ready customer can owe several human contacts.
No existing historical registration was bulk-replayed, no missing Slot rule was enabled, and no
customer was contacted. Validation: the selected PHP suite passed 82 tests / 685 assertions.
The final targeted run passed 8 tests / 67 assertions, including the additional legacy
`wants_followup` case and delayed AI answer after webinar start, bringing unique PHP coverage
to 84 tests. Frontend checks passed 5 tests.
The existing PHPUnit XML produces one configuration deprecation. The new migration was verified
through the empty scratch-database rebuild, then applied only to `peta_zs_dev` with database/account
assertions. Authenticated read-only development page checks returned HTTP 200 for My Work, tasks,
support and unassigned work. Desktop and mobile browser checks using those read-only server
snapshots with current Vite assets found no JavaScript errors or horizontal overflow.
No history backfill or outbound integration was run.

## Per-Slot configuration

All ten Slots are scheduled-session Slots; nine are active. None has the complete
configuration shown in the flowcharts. Times below are minutes before the session,
unless explicitly marked after-start.

| Business stage / Slot | Active private WhatsApp rules | Registration AI | Selling mapping | Complete flow |
|---|---|---|---|---|
| Stage 1 — AI买房训练营 | Welcome, 1440m, 30m | Profile 2, 20-second delay | One Membership offer with active Payment Link | No |
| Stage 1 — AI Prompt Class | None | Profile 2, 20-second delay | No offer | No |
| Stage 1 — HK 數據講座 · 五個數字決定買不買 | Welcome, 120m, 45m | None | No offer | No |
| Stage 2 — TRX vs KLCC vs Bandar Sunway | None; Slot inactive | None | No offer | No; inactive archive |
| Stage 2 — Binastra Cochrane | None; existing reminder paused | None | No offer | No |
| Stage 2 — Bangsar South | 1275m, 300m, 30m; no welcome | None | No offer | No |
| Stage 2 — ViiA residence | 150m, 40m; no welcome | None | No offer | No |
| Stage 2 — Peel Lane | None | None | No offer | No |
| Stage 2 — Johor Shoplot | None | None | No offer | No |
| Stage 2 — Cochrane 新盘线上讲座 | Welcome, 300m, 30m | Profile 3, 20-second delay | No offer | No |

ViiA has SMS rules five minutes before start and fifteen minutes after start for
no-shows. The latter is **SMS**, not the flowchart's fifteen-minute AI call.

Common gaps and qualifications:

- **Every Slot has `whatsapp_group_id = null`; no active group reminder rules exist.**
  Four Slots retain invite links. An invite link permits joining a group; it does not
  bind the Bridge group/channel required for sending. Old multi-group/session-specific
  rules remain paused for review. The resolver can attempt invite-link discovery, but
  no provider request was made to verify that fallback or membership in those groups.
- **No Slot has an after-ended WhatsApp or AI rule.** The pictured no-show and unpaid
  follow-up branches are therefore not configured.
- **No Slot has the fifteen-minute no-show AI rule.** None matches the complete R1
  schedule of WhatsApp PM at 24h, group at 5h, PM at 3h, and SMS at 30m.
- Active private rules use Cloud channel 6; their templates are recorded as approved.
  The shared M2/M3/thanks templates are approved in Mandarin and Cantonese on that
  channel. This does not supply missing Slot rules or an after-webinar M4 configuration.
- AI profile 2 lacks extraction fields for `buying_timeline`, `current_problem`,
  `help_needed`, and `must_haves`. Human fallback questions add those fields, but this
  does not update the AI profile or its provider-side agent.
- Cochrane's AI profile 3 lacks `buy_intent`, which the existing useful-answer rule
  requires. Its answers cannot satisfy that rule as configured.
- No Slot has a custom human question set. Slots without a registration AI profile
  may have no default questions; Stage 1 receives its Needs fallback questions.
- All seven Stage 2 Slots lack `EventSeriesOffer` mappings. Setting `selling_kind` to
  Project fee is not the same as naming the Project and payment item. Payments do not
  necessarily stop: `sessionSells()` returns unknown for an empty offer set and the
  payment hook accepts that as a possible match, making attribution too broad.
- Reusable ViiA reminder rule 38 contains a literal October 4 date. Bangsar reminders
  contain fixed times and historical wording. Reusing them for a new Session can send
  incorrect details even when the rule is technically enabled.
- Stage 2's `candidate_source_funnel_id` correctly points to Stage 1.

Session automation reads the Slot's current rules; it is not an independently completed
copy. Session-specific old rules retain their scope. Creating another Session does not
fill any missing rule, group, offer, or profile automatically.

## Flowchart-to-code findings

| Flowchart point | Current implementation | Gap or qualification |
|---|---|---|
| Registration → M1 on both opt-in paths | `DispatchFunnelWelcomeAction` selects the registering Slot's rules | Only three Slots have a welcome WhatsApp rule |
| Opted in → AI; opted out → M2 after two minutes | Registration AI rule controls this split and delay | Only three Slots have that AI rule; M2 follows registration scheduling, not confirmed M1 delivery |
| Missed AI → M3/M4 → callback | Follow-up job and callback endpoint exist | Callback token lacks Funnel/Slot/Session identity and callback event is broadcast across the lead's journeys |
| AI answered → DATA → Human Call/Zoom | AI notes and answers are recorded | Useful AI answers currently skip human work completely |
| AI books Human Call/Zoom | Ordinary Funnel aftermath records notes/answers | Automatic booking consumer exists for Appointment Engine leads, not ordinary Funnel leads |
| No response → human handoff | Six-hour wait, pre-session cutoff and near-start grace; scanner creates task | Requires Journey history and a running scanner |
| R1 reminders | Configurable WhatsApp/SMS rules and delivery ledgers | Current Slot schedules are incomplete and differ from the supplied chart |
| Customer says next time → stop this Session's reminders | Outcome sets `reminders_muted_at`; scanners filter it | Already queued sending jobs do not recheck mute |
| R2 +15m AI call to no-shows | Engine supports the rule, checks attendance before calling | No such AI rules configured; unmatched attendance remains an identification limitation |
| R2 +1h screenshot to WhatsApp group | Staff notification to take/post a screenshot | No automatic screenshot, My Work task, or completion proof; notification still reads old Funnel group |
| After webinar → attended/no-show, paid/unpaid follow-up | Conditions and after-ended rules are supported | No such WhatsApp/AI rules configured on these Slots; absent AI dispatch does not guarantee a fallback human task |
| Payment → REP → Zoom | Payment/scanner/handoff/meeting hooks exist | Needs tracked journey, matching offer, running scanner and actual meeting records |
| Closing → Won / Not closed with reason | Project booking/lost hooks and reason validation exist | My Work and charts must read actual linked outcomes, not infer completion from elapsed time |

Additional routing details:

- `SendAiCallFollowUp` picks the first connected Cloud channel rather than the Slot's
  channel. This happens to be channel 6 for the audited rules; independence is not
  guaranteed if a Slot changes channel.
- Missed-call WhatsApp is capped once per lead per day, across Slots and M3/M4. A
  morning M3 can suppress an evening M4; the diagram does not expose this rule.
- `SessionNudges` uses `funnel.whatsapp_group_link`: the HK Slot has a different invite
  from its parent, while the Cochrane Slot has an invite and its parent has none.

## Human responsibilities and actual running history

> **Status 2026-10-13 (code study + fixes, see [10](10-code-study-and-fixes-2026-10-13.md)):** item 1 is resolved by A25
> (every answered AI call becomes a human task); item 2 — Ready still wins the Preview node, but `contexts()` adds the
> before-webinar obligation and every open task is its own item; only a member's Ready context is replaced, Project
> buyers are not suppressed; item 3 — fixed for facts: a managed customer keeps every obligation on the account
> manager's board except the one a colleague's open hand-off covers; item 4 — tasks carry their own state, due label,
> priority, assignee and `outcome_url`; item 5 — member consultation states come from `MyWorkConsultations`
> (scheduled → Waiting, held → Done).

| Target Funnel | Board population | Recorded `funnel_journeys` | Open linked handoff tasks |
|---|---:|---:|---:|
| Stage 1 Preview | 12,985 | 0 | 0 |
| Stage 2 Project | 4,551 | 0 | 0 |

The Stage 1 population includes 13 staff records in its staff node; My Work excludes
staff. The remaining counts are reconstructed from business records, not fabricated
automation history. A zero `preview_call` count therefore does not prove human follow-up
has been completed.

The actual task chain exists: create `LeadActionItem`, assign an eligible person, record
`human_pending`, collect DATA answers through Log the call, and retain/reschedule a task
on no answer. Recorded human contact can contribute Relationship evidence; AI cannot.
The gaps are in both creation rules and how responsibility lists consume the task chain:

1. `HandOffAfterAiCall` deliberately skips the human when answers are useful. Existing
   tests assert zero tasks. The owner has been asked whether the latest diagram changes
   this rule to mandatory human contact even after successful AI.
2. Preview lifetime attendance resolves to Ready before current `human_pending`.
   My Work also suppresses Preview rows for members, Project buyers and people in the
   Project population. These rules can hide unfinished after-Preview human work.
3. My Work first limits customers to the selected account manager, then compares journey
   owner. A task reassigned to another colleague can consequently disappear from both
   responsibility lists, although Assigned tasks still follows the real assignee.
4. Actionable responsibility rows are labeled `suggested`; human queues do not reuse
   the actual task/deadline/assignee mapping already available in `JourneyWorkQueue`.
5. Member consultation checks paid Membership plus completed FPA only; it does not
   remove already scheduled or completed member meetings.

Items 2 and 3 are code-path defects, not counts of observed customer incidents: the
two target Funnels currently have no recorded journeys to reproduce them against.

## Development runtime

The isolated development services are active, but their live systemd configuration uses
`SafeConsoleKernel`, which schedules only the heartbeat. It does not execute
`funnel-journey:advance`, `whatsapp:run-funnel-reminders` or
`funnel:run-automation-reminders`. Queue workers have `PrivateNetwork=yes` and
`RestrictAddressFamilies=AF_UNIX`; they cannot contact external WhatsApp/Retell providers.
This is the intentional development isolation in `CLAUDE.local.md`.

Consequently, cached connected status, present credentials, passing unit tests and
visible diagrams cannot certify real delivery here. Keep isolation intact and use
fake integrations or explicitly designated test recipients for later acceptance.
Production runtime has not been audited in this review.

## Concrete correction order

1. Settle the successful-AI human-touch rule against the latest owner instruction.
2. Make My Work mirror actual open human tasks by assignee and before/after-webinar
   phase. Preserve Stage 2 eligibility alongside unfinished Stage 1 tasks. Add real
   appointment/completion transitions for paid member consultation.
3. Carry Funnel/Slot/Session identity through every callback and follow-up; recheck
   current mute and Slot ownership immediately before executing queued sends.
4. Complete each active Slot's approved messages, AI profiles/questions, one Bridge
   group, exact payment item and recurring reminder schedule. Correct literal dates.
5. Wire the chosen human appointment behavior and session screenshot responsibility.
6. Test the complete fake-provider paths: opt-in/out, useful AI, missed/no-click,
   next-time mute, no-show, attended/unpaid, Membership payment, Project fee, scheduled
   and held Zoom, reassignment, and Won/Lost. Prove retry/deduplication and multi-Slot
   separation. Then perform a controlled end-to-end acceptance with test recipients.

Do not backfill all historical leads into active automation or invent earlier AI events
to populate the human lists. Historical invitations and no-show suggestions remain
separate from genuinely created operational tasks.

## Validation and the correction made during this audit

The five existing feature-test files ran against the isolated local
`peta_zs_slot_testing` database, with provider calls mocked. Its current migration
snapshot was reused; the development database was not used for fixtures.

The first run produced 54 passes and one failure out of 55 tests (361 assertions).
The failure exposed an undefined `$funnel` in
`FunnelAutomation/StoreRequest::validateConditions()`: non-default payment or Preview
cohort conditions could cause an HTTP 500. This audit corrected the request to resolve
the submitted Funnel instead of assigning an unused `$videoSlot` variable. The existing
regression test now passes; the entire affected `FunnelAutomationReminderTest` file
passed on rerun (9 tests, 37 assertions). The other 46 feature tests passed in the first
run. The existing PHPUnit configuration deprecation remains.

Two pure Journey readiness tests also passed. Five isolated SQLite Slot operations
tests could not execute because the CLI lacks the SQLite PDO driver; their setup
errors are not evidence that Slot operations passed or failed. No packages were installed.
No external end-to-end customer delivery was attempted.

That initial validation correction did not fill missing Slot configuration or change the
human-touch business rule. The later mandatory-human implementation is recorded in the
follow-up section above; the per-Slot configuration gaps and runtime limitations remain.

## Evidence

- `src/Lead/Services/MyWorkResponsibilities.php`
- `src/Lead/Journey/{PreviewJourneyBoard,ProjectJourneyBoard,JourneyWorkQueue}.php`
- `src/Lead/Journey/{FunnelJourneyHooks,FunnelJourneyHandoff,HandoffOutcome,SessionNudges}.php`
- `src/Lead/Journey/Rules/{HandOffAfterAiCall,HandOffWhenAiNeverReached,UnpaidAfterWebinar,AssignRepWhenPaid}.php`
- `app/Actions/DispatchFunnelWelcomeAction.php`
- `app/Jobs/Automation/{SendFunnelAiCall,SendAiCallFollowUp}.php`
- `app/Http/Controllers/Main/AiCallbackController.php`
- `src/VoiceAgent/{AiCallProfile,Services/AiCallAftermath}.php`
- `src/Event/Support/FunnelRuleAudience.php`, `src/Fpa/Support/FpaProgress.php`
- `app/Console/Kernel.php`, `config/funnel_journey.php`
- [Slot operations](/docs/modules_handbook/manage/events/funnels/slot-operations.md)
- [My Work](/docs/modules_handbook/manage/my-work/readMe.md)
- [Funnel Journey](/docs/modules_handbook/manage/leads/funnel-journey/readMe.md)

Machine-local aggregate/configuration audit artifacts are under
`/home/zs/.local/state/peta-workflow-audit/` and
`/home/zs/.local/state/peta-mywork-responsibilities/audit-slot-config.json`.
They are not deployment inputs.
