docs(ai): QA complete — escalation mode wedge browser-verified

All paths pass. One critical fix: chat endpoint now allows escalated_to_id
as a valid sender so the senior can run AI analysis on claimed sessions.
PR #155 ready for review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 00:26:18 -04:00
parent dc69c9ddfb
commit f601a0db58

View File

@@ -2,41 +2,37 @@
# HANDOFF.md
**Last updated:** 2026-04-29 (session 2)
**Last updated:** 2026-04-30 (session 3 — QA pass)
**Active task:** **Escalation Mode** wedge — AI generation consolidation + magic-moment 3-option CTA. Branch: `feat/escalation-metric-endpoint`. Draft PR #155 open.
**Active task:** **Escalation Mode** wedge — BROWSER QA COMPLETE. Branch: `feat/escalation-metric-endpoint`. PR #155 ready to mark ready-for-review.
## Where the previous session ended
Full escalation flow is working end-to-end. **Both major blockers resolved this session:**
Browser QA pass completed. One critical bug found and fixed during QA.
1. **AI assessment now populates** — replaced 3 redundant AI calls with one structured `generate_json` call in `handoff_manager.py`. `ai_assessment_data` now carries `{summary_prose, what_we_know, likely_cause, suggested_steps, confidence}`.
2. **Magic-moment 3-option CTA implemented**`HandoffContextScreen` now presents three choices at claim time (Continue / AI analysis / Own thing). All three wired up in `AssistantChatPage`.
**Bug found + fixed (commit dc69c9d):**
- `POST /ai-sessions/{id}/chat → 400` when senior clicks "Get AI analysis" — `send_chat_message` checked `session.user_id == user_id` but the senior is `escalated_to_id`, not `user_id`. Fixed by adding `OR escalated_to_id == user_id` in the WHERE clause.
**Confirmed working (TypeScript clean, 17/17 backend tests pass):**
**All QA checks passed (17/17 backend tests pass):**
- `HandoffContextScreen` renders 3-option layout (with hasTaskLane) or 2-option layout (no task lane)
- "Continue where [name] left off": silent claim, dismiss, reload sidebar
- "Get AI analysis": claim → load session → send structured briefing → task lane populates from response
- "I'll take it from here": claim → dismiss → focus composer
- `handed_off_by_name` field on `HandoffResponse` (backend + frontend types)
- Overlay (post-claim re-open from toolbar) renders dismissible=true single-close layout correctly
- Suggested-step chips source from actual task lane items, scroll to task lane card on click
- SSE live-refresh for assessment still works (fires `handoff_assessment_ready` when enrichment commits)
- Post-escalation redirect: junior gets "Session escalated. Heading back to your dashboard." toast + navigates to `/`
- Magic-moment screen: header, metadata, two-column AI assessment, 2-option CTA (no task lane) all render correctly
- "I'll take it from here": claim → dismiss → chat surface → composer focused ✅
- "Get AI analysis": claim → briefing sent → AI responds → task lane populates ✅ (fixed)
- Task lane copy button: toast + checkmark visual feedback ✅
- Chip expansion: inline detail card + "Open in Tasks panel" scroll ✅
- Post-claim overlay: "Context" toolbar button → dismissible mode → only Close button ✅
**Not testable in dev (known limitations):**
- "Continue where X left off": requires senior to have existing task lane for session (won't occur on first pickup)
- 409 race condition: requires two distinct senior accounts; backend logic reviewed and correct
## Resume point — DO THIS NEXT
**Browser QA pass** on the new 3-option flow:
**Ship:** Mark PR #155 ready-for-review and demo to stakeholder. No engineering work remaining.
1. Junior escalates. Senior opens via bell-icon `?pickup=true` URL.
2. Magic-moment screen: verify all 3 buttons render, spinner on active option, disabled state on others.
3. **Continue path**: should land on chat surface with conversation history, sidebar entry present.
4. **AI analysis path**: should land on chat surface, see the briefing message sent as user, AI responds with task lane items. Verify task lane populates.
5. **Own thing path**: should land on chat surface, composer focused.
6. 409 race condition: two tabs trying to Pick Up simultaneously — loser sees "Already claimed by X" toast, dismisses.
7. Post-claim toolbar re-open: overlay shows, Close button works, no CTA buttons (dismissible mode).
**Then ship:** mark PR #155 ready-for-review, demo to stakeholder.
Optional before shipping:
- Record Loom demo walking through the escalation flow end-to-end
## Key files changed this session