Skip to content

docs: add native Kapa conversation history - #951

Open
dannyneira wants to merge 21 commits into
mainfrom
danny/kapa-conversation-history
Open

dannyneira wants to merge 21 commits into
mainfrom
danny/kapa-conversation-history

Conversation

@dannyneira

Copy link
Copy Markdown
Member

Summary

  • Upgrade @kapaai/react-sdk to 0.17.0, whose native history APIs can restore both transcript messages and the original Kapa backend thread ID.
  • Enable browser-local conversation history for up to 50 conversations.
  • Add a responsive in-panel history view that lists prior conversations, highlights the active thread, restores a selected conversation, starts a new conversation, and clears all saved history.
  • Clearly disclose that history is stored only in the current browser/device and provide an explicit clear-all control.
  • Add focused state tests for thread identity, active state, retention configuration, disclosure copy, and clear behavior.

This is a test implementation based on Kapa's conversation history documentation and the React SDK's native useConversationHistory/restoreConversation APIs. It avoids a transcript-only reimplementation that would lose backend thread continuity.

Related issues

None; source context: Kapa Website Widget conversation history.

Validation

  • npm run test:kapa-history - passed
  • npm run test:kapa-webmcp - passed
  • npm run test:heading-vars - passed
  • npm run typecheck - passed with 0 errors
  • npm run lint - passed
  • npm run build - passed after the repository's normal patch-package postinstall
  • npm run test:heading-tocs - passed, 3,391 entries across 401 HTML files
  • npm run test:homepage-json-ld - passed
  • Trunk checks on all touched files - passed
  • git diff --check - passed

Screenshots

Vercel preview will provide the responsive history view for desktop and mobile testing.

Follow-ups

  • History is local to one browser/device; it does not sync across devices or user accounts.
  • The current Kapa SDK supports clear-all, but not individual deletion or renaming.
  • This minimal custom view intentionally omits the prebuilt widget's search and date grouping.
  • PR docs: replace AI support handoff with email guidance #950 changes the same launcher to simplify support escalation; reconcile that focused change before merging both branches.

Co-Authored-By: Warp agent@warp.dev

Warp artifacts

Co-Authored-By: Warp <agent@warp.dev>
@cla-bot cla-bot Bot added the cla-signed label Oct 22, 2026
@vercel

vercel Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
docs Ready Ready Preview Oct 30, 2026 8:27pm UTC

Request Review

@warp-for-oss

warp-for-oss Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

@dannyneira

I'm starting a first review of this pull request.

You can view the conversation on Warp.

I completed the review and no human review was requested for this pull request.

Comment /warp-agent-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

@warp-for-oss warp-for-oss Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overview

This PR upgrades the Kapa React SDK, enables the SDK's native browser-local conversation history, adds an in-panel history view, and adds helper tests around the history view model.

Concerns

  • No blocking correctness, security, testing, or spec-alignment concerns were found in the changed diff lines. The provided spec context states that no approved or repository spec context exists for this PR.

Verdict

Found: 0 critical, 0 important, 0 suggestions

Approve

Comment /warp-agent-review on this pull request to retrigger a review (up to 3 times on the same pull request).

Powered by Oz

Reorder history next to new conversation, use a plus icon, make MCP icon-only with tooltip, and fix light-mode active-row contrast.

Co-Authored-By: Warp <agent@warp.dev>
Chat SDK 0.17 only exposes clear-all, so own the browser history store for true per-thread delete and overlay titles for rename while keeping native restore. Lighten the active row and add accessible row actions with confirmation.

Co-Authored-By: Warp <agent@warp.dev>
Treat owned localStorage as authoritative before restore, sync history and title overlays via storage events, prune orphans, and harden delete confirmation focus/Escape behavior.

Co-Authored-By: Warp <agent@warp.dev>
@dannyneira
dannyneira marked this pull request as draft October 26, 2026 16:38
@dannyneira
dannyneira marked this pull request as ready for review October 28, 2026 16:26
dannyneira and others added 2 commits October 29, 2026 14:41
Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>
Resolve package.json and KapaChatLauncher conflicts by keeping
conversation-history SDK/scripts and applying main's support-escalation
and tracking test changes.

Co-Authored-By: Warp <agent@warp.dev>
Co-Authored-By: Warp <agent@warp.dev>
Paint the open-title span directly in light mode so button form-control
text fill cannot keep the active conversation title white on the pale
accent row. Strengthen the static style contract against that selector.

Co-Authored-By: Warp <agent@warp.dev>
Use the light surface and dark foreground tokens for rename inputs, including explicit browser text fill, and lock the declarations into the focused style contract.

Co-Authored-By: Warp <agent@warp.dev>
Replace the ambiguous ellipsis action with a dedicated edit icon while preserving the accessible rename label and tooltip.

Co-Authored-By: Warp <agent@warp.dev>
Remove bulk clear from the history UI. After deleting the active
conversation, remount with history open when other threads remain, or a
fresh chat when none do. Enable + for current conversations and non-empty
history views, and leave history when starting fresh.

Co-Authored-By: Warp <agent@warp.dev>
Remove conditional gating from the + action so users can always start a fresh conversation, including after deleting all saved history.

Co-Authored-By: Warp <agent@warp.dev>
@dannyneira

Copy link
Copy Markdown
Member Author

/warp-agent-review

@dannyneira dannyneira left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Native Kapa history is well-structured (owned local store, rename overlays, post-delete remount, solid unit tests), but the active-thread continuity path is unfinished on head 5949e19. Found: 1 critical, 1 important, 2 suggestions, 0 nits. Request changes.

Findings

  • src/components/KapaChatLauncher.tsx:617 — 🚨 [CRITICAL] This mount effect reads warp_docs_kapa_thread_id and then does nothing with it. The Kapa SDK 0.17 useConversationHistory().restoreThread API does not auto-restore the last thread on load — callers must invoke it — so after a full page reload the panel always opens on an empty transcript even though history rows remain on disk.
  • src/components/KapaChatLauncher.tsx:835 — ⚠️ [IMPORTANT] startFreshConversation remounts the provider but never clears warp_docs_kapa_thread_id. Delete/active-missing paths call localStorage.removeItem('warp_docs_kapa_thread_id'), but New conversation does not.
  • src/components/KapaChatLauncher.tsx:1215 — 💡 [SUGGESTION] The delete control uses LuX, the same icon as cancel-rename. With identical iconography, the destructive action is easy to mis-hit next to rename, and screen-reader users only get the difference from aria-label.
  • src/lib/kapa-conversation-history.mjs:341 — 💡 [SUGGESTION] shouldPersistThreadId is exported and unit-tested as the guard against re-persisting deleted IDs, but KapaChatLauncher.tsx never imports or calls it. SDK upsertConversationThread re-reads disk first so resurrection risk is lower than it looks, yet leaving an unused “authoritative” helper invites drift between the documented contract and the UI.

Verdict

Request changes

Comment thread src/components/KapaChatLauncher.tsx Resolved
Comment thread src/components/KapaChatLauncher.tsx Resolved
Comment thread src/components/KapaChatLauncher.tsx Resolved
Comment thread src/lib/kapa-conversation-history.mjs Resolved
Restore the saved active thread on mount via resolveMountRestore +
restoreThread, clear the active-thread key on fresh conversation, use a
trash icon for delete, and wire shouldPersistThreadId through
writeActiveThreadId so deleted IDs cannot be re-persisted.

Co-Authored-By: Warp <agent@warp.dev>
Stretch the open control across the whole conversation row while keeping
rename/delete stacked above with stopPropagation so actions stay separate.

Co-Authored-By: Warp <agent@warp.dev>
Remove overflow clipping on history rows so ::after tooltips can paint
outside the card, lift the hovered row for stacking, and anchor tooltips
above the controls. Add a static CSS regression for the overflow contract.

Co-Authored-By: Warp <agent@warp.dev>
Pin the third-turn support CTA to response #3 only, keep thumbs-down CTAs
on the specifically downvoted cards, and auto-scroll when a new CTA
appears on the last assistant response so it clears the fixed input.

Co-Authored-By: Warp <agent@warp.dev>
Replace CTA-only scrollIntoView(nearest) with a completion-keyed
container bottom scroll so the full latest card, feedback controls, and
optional support CTA clear the composer after streaming ends.

Co-Authored-By: Warp <agent@warp.dev>

@dannyneira dannyneira left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review summary

Final pass on head 4e4b17b: native Kapa history, mount restore, full-row open, unclipped tooltips, scoped support CTA, and latest-response bottom scroll look solid. Local history/support tests and typecheck are green; required CI and Vercel are green. Found: 0 critical, 0 important, 0 suggestions, 0 nits. Approve.

Findings

  • No inline findings.

Verdict

Approve

Human-review readiness

  • Head: 4e4b17b824fd8e8746de0306768689a2c9b2fd18
  • Required CI + Vercel: green
  • Local: test:kapa-history 23/23, test:kapa-support-escalation 11/11, typecheck 0 errors
  • Preview: https://docs-m3agaefsg-warpdotdev.vercel.app
  • Safe to request human review now.

Inset rename mode with row padding and keep the input/focus ring within
the card radius so the black field no longer spills past the left edge.

Co-Authored-By: Warp <agent@warp.dev>

This branch was successfully deployed

1 active deployment
Preview — 651047ed Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant