Codex review pass on the escalation wedge. Reworks claim_session from read-then-write to a conditional UPDATE so two seniors racing can't both win, blocks the original engineer from claiming their own handoff, and filters self-escalated sessions out of the dashboard escalation queue. Also preassigns the handoff UUID before flush so the compatibility escalation_package payload carries it. Removes legacy frontend pickup state (claiming, handleStartHere) that broke tsc --noEmit. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4.9 KiB
CURRENT_TASK.md
Task: Build Escalation Mode — the wedge for ResolutionFlow's GTM (first paying-customer push). When a junior tech escalates a FlowPilot session, the senior tech sees structured handoff context in seconds instead of running a 5-minute verbal "tell me what you tried" call.
Status: ✅ Engineering complete. Browser QA passed (2026-04-30). Branch feat/escalation-metric-endpoint; PR #155 ready to mark ready-for-review.
Plan: docs/plans/2026-04-27-escalation-mode-wedge-design.md. Reviewed by /office-hours, /plan-eng-review, /plan-design-review, /codex review. Eng + Design CLEARED.
Test plan artifact: docs/plans/2026-04-27-escalation-mode-wedge-test-plan.md.
What's done (all sessions combined)
All plan items complete. Key commits on feat/escalation-metric-endpoint:
| Commit | What it ships |
|---|---|
d51e95c |
Plan + test-plan artifacts |
52f6d03 |
GET /analytics/flowpilot/escalations — time-to-first-action metric |
7a5b853 |
Role-gate claim to engineer-or-admin |
07d0db9 |
Email notifications on escalation |
9f0bfd4 |
EscalationMetricCard on /escalations |
b8627f4 |
SSE live-arrival animations in EscalationQueue |
8e9d22e |
Magic-moment handoff-context screen |
641853a |
Bell-icon opens pickup flow |
029680a |
Unify /escalate through HandoffManager |
0f00ee5 |
Plan-locked polish: chips, unread dot, race toast, AI refresh |
665530f |
Structural task-lane race fix |
db717b0 |
3-option CTA, copy button fix, post-escalation redirect, claim 500 fix |
dc69c9d |
Allow escalated_to_id to send chat (GET AI analysis fix) |
Browser QA results (2026-04-30):
- ✅ Post-escalation redirect (dashboard + toast)
- ✅ Magic-moment screen: header, AI assessment, 2-option CTA
- ✅ "I'll take it from here": claim → dismiss → composer focused
- ✅ "Get AI analysis": claim → briefing → AI responds → task lane populates
- ✅ Task lane copy button: toast + checkmark
- ✅ Chip expansion: inline detail + "Open in Tasks panel"
- ✅ Post-claim overlay: dismissible mode, Close only
Done on feat/escalation-metric-endpoint (branched from main @ c0ed6d9)
| Commit | What it ships |
|---|---|
d51e95c |
Plan + test-plan artifacts |
52f6d03 |
GET /analytics/flowpilot/escalations — in-product time-to-first-action |
7a5b853 |
Role-gate POST /handoffs/{id}/claim to engineer-or-admin |
07d0db9 |
HandoffManager.dispatch_escalation_notifications — emails engineer/admin teammates |
9f0bfd4 |
EscalationMetricCard mounted above the queue list |
bc15952 |
Codex: stabilize SSE backend tests |
9bdd995 |
Bound escalation assessment latency (ORIGINAL: 5s) |
b8627f4 |
Frontend SSE subscription in EscalationQueue.tsx — live-arrival animations |
8e9d22e |
Magic-moment handoff-context screen on pickup |
641853a |
Bell-icon notification opens the pickup flow |
029680a |
Unify /escalate through HandoffManager |
8914391 |
First task-lane race fix (insufficient — see 665530f) |
0f00ee5 |
Four plan-locked items: live AI refresh, suggested-step chips, unread dot, race-condition toast |
665530f |
Structural task-lane fix — taskLaneOwnerChatId tagging |
b7d7ff0 |
docs(ai): refresh handoff for compute swap |
0d1b305 |
Live-test fixes: selectChat-gating bug (loadedChatIdsRef), 45s timeout bump, Enter-to-submit on escalate forms, dashboard expand-to-preview |
Live-test results (2026-04-29 morning)
After the structural task-lane fix and the four polish items, end-to-end test confirmed:
- ✅ Junior escalates → senior gets bell-icon notification.
- ✅ Magic-moment screen renders with handoff data on Pick Up.
- ✅ Senior's chat surface loads with conversation history (after
0d1b305's selectChat fix — was completely broken before). - ✅ Sidebar shows the picked-up session with the "Escalated" pill (after
0d1b305'sloadChats()call). - ✅ Suggested-step chips render below the composer.
- ✅ Unread 6px dot on queue cards.
- ✅ Task-lane regression is gone — no stale flash on new sessions.
- ❌ AI assessment placeholder never clears. Drives the consolidation work above.
Untested live (low priority, can verify post-consolidation): race-condition toast (needs second user in same account).
Two-metric framing — read this before quoting numbers to anyone
The in-product endpoint measures post-claim time-to-first-action. The "minutes recovered" sales claim is manual_baseline − in_product_metric. Manual baseline comes from the founder's stopwatch on the next 5 escalations. Don't roll the in-product number alone into "minutes recovered" — that's the apples-to-oranges miscount Codex caught.
Kill-switch
Week 8: if 0 of 3 pilots produce a verifiable hours-saved-per-week number above 1.0, revisit the wedge.