[AI-122] - escalate a conversation to a human#63
Conversation
Design for /fiona escalate (AI-122) plus the downstream proactive escalation path that reuses the shared postEscalation helper. Folds in AI-122 acceptance criteria and resolves the open items: channel-by-ID config, user-group ping enhancement, and DM-escalation channel posting. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
TDD task-by-task plan for the /fiona escalate slash command: the summarizeForEscalation helper, optional interactionType on feedback records, the shared postEscalation helper, the slash sub-command, and config/docs wiring. Covers all AI-122 acceptance criteria. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Non-streaming Perplexity call that summarizes a conversation transcript for escalation posts. Returns null on empty input, missing client, or error so callers can degrade to transcript-only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Lets escalation events be recorded to the feedback container tagged with interactionType (e.g. slash_escalate) without changing normal feedback rows. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Builds a summarized escalation message with transcript, posts it to the configured channel (pinging an optional user group), and records the event to both the interactions and feedback containers. Reused by the proactive escalation story. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lush) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Routes /fiona escalate through rate limiting and DM detection, delegates the channel post to postEscalation, and returns the AC-mandated ephemeral confirmations and error message. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Adds ESCALATION_CHANNEL / ESCALATION_USERGROUP_ID to .env.sample and the container Bicep, updates the /fiona usage hint, and documents the vars. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Escalation events are written to the feedback container with value:'escalation'; scope the response-rate feedback count to actual thumbs feedback so escalations don't inflate the weekly metric. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds the /fiona escalate capability and supporting infrastructure so Slack users can escalate a conversation to a human support channel, including optional on-call user-group mention and best-effort analytics persistence.
Changes:
- Wires new escalation configuration (
ESCALATION_CHANNEL,ESCALATION_USERGROUP_ID) through Bicep,.env.sample, manifest usage hint, and PRD docs. - Introduces escalation flow building blocks: a non-streaming
summarizeForEscalation()helper and a sharedpostEscalation()helper that posts summary + transcript and records to Cosmos. - Updates usage reporting to exclude escalation rows from feedback response-rate calculations, with unit test coverage.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| infra/fiona-slack-container/main.bicep | Adds parameters and container env vars for escalation channel + user group. |
| docs/superpowers/plans/2026-06-22-escalate-to-human-slash-command.md | Detailed implementation plan for the escalation slash command and helpers. |
| docs/superpowers/plans/2026-06-22-escalate-to-human-design.md | Design doc for escalate-to-human flow and future proactive escalation. |
| docs/fiona-skills-prd.md | Updates environment variable table to include escalation vars (ID-based). |
| apps/usage-report-function/lib/cosmos-queries.js | Filters feedback response-rate query to exclude escalation rows. |
| apps/usage-report-function/test/unit/cosmos-queries.test.js | Adds unit test asserting feedback allow-list filter is applied. |
| apps/fiona-slack/src/agent/llm-caller.js | Adds summarizeForEscalation() helper (non-streaming) for escalation summaries. |
| apps/fiona-slack/src/agent/feedback-store.js | Adds optional interactionType field to feedback docs. |
| apps/fiona-slack/src/agent/escalation.js | New postEscalation() helper: transcript fetch, summary, Slack posting, Cosmos recording. |
| apps/fiona-slack/src/agent/interaction-store.js | Updates JSDoc to include escalation interaction types. |
| apps/fiona-slack/src/listeners/commands/fiona.js | Adds escalate sub-command with rate limiting + DM detection + delegation. |
| apps/fiona-slack/manifest.json | Updates /fiona usage hint to include escalate. |
| apps/fiona-slack/.env.sample | Documents escalation-related env vars. |
| apps/fiona-slack/tests/agent/llm-caller.summarize.test.js | New unit tests for summarizeForEscalation() success/empty/error paths. |
| apps/fiona-slack/tests/agent/llm-caller.summarize-noclient.test.js | New unit test for summarize helper when LLM client is unconfigured. |
| apps/fiona-slack/tests/agent/feedback-store-cosmos.test.js | Adds tests for optional interactionType persistence behavior. |
| apps/fiona-slack/tests/agent/escalation.test.js | New tests for postEscalation() behavior (posting, pinging, recording, DM behavior). |
| apps/fiona-slack/tests/listeners/commands/fiona.test.js | Mocks escalation helper and adds /fiona escalate command tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let permalink = null; | ||
| if (!isDm) { | ||
| try { | ||
| const res = await client.chat.getPermalink({ channel: channelId, message_ts: threadTs ?? messageTs }); | ||
| permalink = res?.permalink ?? null; | ||
| } catch (err) { | ||
| logger?.warn?.(`Failed to get permalink for escalation: ${err.message}`); | ||
| } | ||
| } |
Team PR Review — AI-122 escalate a conversation to a human
🔴 Critical
🟠 High
🟡 Medium
🔵 Low
⚪ Nit
Specialist Verdicts
SummaryThe escalation infrastructure (shared 🤖 This review was substantially AI-generated (team-pr-review fleet). Please have a human reviewer confirm the findings — especially the data-egress decision — before acting on them. |
Reframes escalation around the Fiona thread where conversation context actually exists. Three entry points (slash command without transcript, always-present thread button, async LLM-suggested button) feed one shared postEscalation core with an optional transcript built from buildThreadHistory. Removes channel-history scraping and the broken trigger_id permalink. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…flag [AI-122] - Classifier signal + button/CTA use the user-facing phrase "Get Live Help" (first line "Get Live Help: yes|no", parsed defensively). - Proactive suggestions gated solely on ESCALATION_CHANNEL; no separate flag. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
12 TDD tasks implementing the redesign spec: shared rate-limit helper, transcript renderer + broadcast neutralizer, escalation constants, Get Live Help blocks, classifyForEscalation, refactored postEscalation (thread-only transcript + permalink guard), maybeSuggestEscalation, button action handler, slash polish, response-handler wiring, and taxonomy cleanup. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: stevenarnold-ed-fi <48261255+stevenarnold-ed-fi@users.noreply.github.com>
Co-authored-by: stevenarnold-ed-fi <48261255+stevenarnold-ed-fi@users.noreply.github.com>
No description provided.