Skip to content

Add human handoff, CSAT capture, and escalation-aware chat state - #11

Merged
nedasvi merged 7 commits into
mainfrom
feature/human-handoff-csat
Jul 27, 2026
Merged

Add human handoff, CSAT capture, and escalation-aware chat state#11
nedasvi merged 7 commits into
mainfrom
feature/human-handoff-csat

Conversation

@nedasvi

@nedasvi nedasvi commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Client-side support for the backend's new human-handoff/CSAT features:

  • New SSE event handling: session_escalated, human_message, feedback_requested (with an immediate flag distinguishing an AI-turn-triggered CSAT prompt from a definitive human-resolve trigger).
  • CSAT prompt debounces 15s after an AI turn (cancels if the user keeps chatting), shows immediately when a human resolves the session, and is suppressed entirely while an escalation/handoff is in progress.
  • Role.humanAgent message bubble, escalated-state banner, ResolveKitRuntime.submitFeedback/dismissFeedbackRequest.
  • Sample app: added a "New chat" button (existing reloadWithNewSession() API was never wired up in the sample's toolbar).

Test plan

  • swift build — clean
  • swift test — 94/94 passed
  • Manually verified end-to-end against staging: escalation banner, human-agent messages, CSAT prompt (both triggers), suppression during handoff — via the iOS Simulator sample app

nedasvi and others added 7 commits July 21, 2026 10:05
Handles the three new backend SSE event types (session_escalated,
human_message, feedback_requested) and the new human_agent message role:
renders an escalated-state banner, a distinct human-agent message bubble,
and a post-turn CSAT prompt. Adds ResolveKitAPIClient.submitFeedback for
POST /v1/sessions/{id}/feedback.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
feedback_requested fired the rating prompt the moment the event arrived,
even mid-conversation (e.g. right after "Hi" -> a generic greeting). Wait
a few seconds before showing it, and cancel if the user sends another
message in the meantime.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
session_escalated now cancels any CSAT prompt still pending from the
AI's last reply -- it shouldn't surface while the user is waiting on a
human handoff. feedback_requested's new "immediate" flag (true only for
the human-resolve trigger) skips the debounce and shows the prompt
right away, since that signal means the conversation is definitively
over.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ResolveKitRuntime.reloadWithNewSession() already existed, and the
Android sample already exposes it, but the iOS sample's toolbar only
had "Done" -- there was no way to start a fresh session without force-
quitting the app.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Give the user more room to keep chatting before the rating prompt
interrupts.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
scripts/check_agent_docs.sh requires AGENTS.md to reference both
docs/INDEX.md and docs/agent-first/README.md -- neither was linked,
which was failing the required build-and-test check on main itself,
independent of this branch's actual changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
swiftlint was never installed on the macOS runner (no setup step), so
the required build-and-test check has been failing with "command not
found" on every run, including main -- independent of any code changes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@nedasvi
nedasvi merged commit 4bfa576 into main Jul 27, 2026
1 check failed
@nedasvi
nedasvi deleted the feature/human-handoff-csat branch July 27, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant