Skip to content

Prompt History and PR Pane -> Primary - #1070

Merged
arul28 merged 4 commits into
mainfrom
ade/prompt-history-pr-pane
Aug 10, 2026
Merged

Prompt History and PR Pane -> Primary#1070
arul28 merged 4 commits into
mainfrom
ade/prompt-history-pr-pane

Conversation

@arul28

@arul28 arul28 commented Aug 10, 2026

Copy link
Copy Markdown
Owner

ADE   Open in ADE  ·  ade/prompt-history-pr-pane branch  ·  PR #1070

Summary by CodeRabbit

  • New Features

    • Added prompt-history navigation with ArrowUp/ArrowDown, draft preservation, multiline caret support, and session-aware history.
    • Added prompt-history jumps from the minimap to matching chat messages, with temporary highlighting and preview cards.
    • Improved prompt stashing and restoration during history navigation.
  • Bug Fixes

    • Simplified floating-pane layout so it no longer shifts the chat transcript or minimap positioning.
    • Improved minimap visibility and keyboard navigation behavior.

Greptile Summary

The PR adds session-scoped prompt-history navigation and transcript synchronization while making floating PR panes independent of transcript and minimap layout.

  • Preserves and automatically cleans up unsent drafts while navigating prompt history.
  • Re-anchors history selection when transcript entries are prepended or appended.
  • Connects composer history selection to transcript scrolling and minimap highlighting.
  • Removes floating-pane offsets from the primary chat layout.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx Implements prompt-history navigation, stable event-key re-anchoring, draft preservation, and cleanup for interrupted or unmounted navigation.
apps/desktop/src/renderer/components/chat/AgentChatPane.tsx Derives session prompt history, coordinates transcript jump requests, and removes floating PR-pane layout reservation.
apps/desktop/src/renderer/components/chat/AgentChatMessageList.tsx Resolves prompt event keys to transcript rows and forwards keyboard focus state to the minimap.
apps/desktop/src/renderer/components/chat/ChatUserMinimap.tsx Adds temporary keyboard-history focus and preview behavior while keeping the rail fixed independently of floating panes.
apps/desktop/src/renderer/components/chat/ComposerPromptStash.tsx Exposes the stash-consumption operation needed to remove temporary history-navigation stashes.
apps/desktop/src/renderer/components/chat/chatPromptHistory.ts Collects chronological user prompts and assigns stable event identities for navigation.
apps/desktop/src/renderer/components/chat/chatUserMinimap.logic.ts Updates minimap geometry and focus calculations for the fixed transcript anchor.
apps/desktop/src/renderer/components/chat/chatPrPaneInset.ts Removes the obsolete floating PR-pane inset mechanism.
docs/features/chat/composer-and-ui.md Documents prompt-history controls, draft preservation, transcript jumps, and pane-overlay behavior.

Sequence Diagram

sequenceDiagram
  participant User
  participant Composer
  participant Stash
  participant Pane
  participant Transcript
  participant Minimap
  User->>Composer: ArrowUp
  Composer->>Stash: Preserve unsent draft
  Composer->>Pane: Select prompt event key
  Pane->>Transcript: Request matching message
  Transcript->>Transcript: Scroll row near top
  Transcript->>Minimap: Highlight matching marker
  User->>Composer: ArrowDown past latest
  Composer->>Stash: Consume temporary stash
  Composer->>Composer: Restore unsent draft
Loading

Reviews (4): Last reviewed commit: "fix: honor multiline prompt navigation b..." | Re-trigger Greptile

Context used:

@vercel

vercel Bot commented Aug 10, 2026

Copy link
Copy Markdown

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

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
ade Ignored Ignored Preview Aug 10, 2026 9:46pm

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The chat UI now supports session-scoped prompt history. Users can navigate and restore drafts, jump to matching transcript prompts, and preview selections in the minimap. Floating PR-pane inset measurement and left-side transcript reservation were removed.

Changes

Chat prompt history

Layer / File(s) Summary
Prompt history and composer navigation
apps/desktop/src/renderer/components/chat/chatPromptHistory.*, apps/desktop/src/renderer/components/chat/AgentChatComposer.*, apps/desktop/src/renderer/components/chat/ComposerPromptStash.tsx, apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
Collects visible prompt history, supports timed ArrowUp/ArrowDown navigation, preserves multiline caret behavior, and restores or consumes unsent drafts.
Transcript prompt jumps
apps/desktop/src/renderer/components/chat/AgentChatMessageList.*, apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
Converts selected prompts into keyed requests and scrolls matching user messages into view.
Keyboard minimap preview and pane layout
apps/desktop/src/renderer/components/chat/ChatUserMinimap.*, apps/desktop/src/renderer/components/chat/chatUserMinimap.logic.*, apps/desktop/src/renderer/components/chat/AgentChatPane.*, apps/desktop/src/renderer/components/chat/chatPrPaneInset.ts
Adds temporary keyboard minimap previews and full-list rail sizing. Removes PR-pane inset tracking and left transcript reservation.

Estimated code review effort: 4 (Complex) | ~60 minutes

Possibly related PRs

  • arul28/ADE#928: Both modify AgentChatComposer and ComposerPromptStash for prompt navigation and draft stash behavior.
  • arul28/ADE#926: Both modify AgentChatPane, AgentChatMessageList, and ChatUserMinimap for transcript history navigation.
  • arul28/ADE#896: Both extend chat transcript history behavior across the pane and message list.

Suggested labels: desktop, docs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 55.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the two main changes: prompt history support and moving the PR pane to a primary overlay.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ade/prompt-history-pr-pane

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx
Comment thread apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 5

🧹 Nitpick comments (2)
apps/desktop/src/renderer/components/chat/chatPromptHistory.test.ts (1)

49-70: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Consider adding key-precedence coverage.

The current test only exercises the steerId branch of promptHistoryEventKey. The messageId precedence and the turnId/text fallbacks carry the jump identity for older transcripts and are untested. Add one table-driven case per branch to lock the precedence order.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/chat/chatPromptHistory.test.ts` around
lines 49 - 70, Extend the tests for promptHistoryEventKey with table-driven
cases covering each identity branch: messageId precedence, turnId fallback, and
text fallback. Keep the existing metadata-decoration assertion, and verify the
expected key for each branch so the precedence order is locked down.
apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx (1)

1991-2000: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Prefer useEffect for the history re-anchor.

This effect only writes refs and calls clearPromptHistory. It reads no layout and produces no synchronous visual result, so it does not need to block paint. useEffect is the cheaper choice on a hot input path.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx` around lines
1991 - 2000, Replace useLayoutEffect with useEffect for the prompt history
re-anchor around promptHistorySelectedKeyRef and promptHistoryIndexRef,
preserving the existing dependencies and callback behavior while allowing paint
before this non-layout synchronization runs.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx`:
- Around line 1326-1334: Update the three prompt-stash tests around the
window.ade stub to preserve test isolation: capture the existing window.ade
value before each test and restore it in afterEach, or use a shared
stubPromptStashes helper that retains the other agentChat and app namespaces.
Replace the inline assignments with the helper while keeping each test’s list,
create, and delete behavior unchanged.
- Around line 1219-1251: Extend the AgentChatComposer tests with a named
regression case for a multiline new draft while promptHistoryIndexRef is null.
Render a draft containing multiple lines, place the caret on the last line,
press ArrowUp, and assert onDraftChange is not called, preserving native caret
movement instead of entering prompt history.

In `@apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx`:
- Around line 3937-3963: The prompt-history entry handling in
AgentChatComposer’s currentIndex === null branch must respect line boundaries:
update atFirstLine so cursorOffset === 0 counts as the first line, and return
false when !atFirstLine before applying history. In
apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx lines 3937-3963,
make these behavior changes; in
apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx lines
1219-1251, add a named test rendering a multiline draft with the caret on the
last line, pressing ArrowUp, and asserting onDraftChange was not called.
- Around line 1954-1966: Update the window listeners in the useEffect containing
cancelIfActive to use passive capture options for wheel and touchstart,
including matching options in cleanup; preserve pointerdown behavior and ensure
cancelIfActive remains free of preventDefault calls.

In `@apps/desktop/src/renderer/components/chat/AgentChatPane.tsx`:
- Around line 12740-12747: Update the prFloating overlay container to be
rendered only at sufficiently wide viewport widths, or reserve layout space
below that minimum width so it cannot overlap the transcript. Preserve the
existing positioning, sizing, and animation behavior when the width threshold is
met.

---

Nitpick comments:
In `@apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx`:
- Around line 1991-2000: Replace useLayoutEffect with useEffect for the prompt
history re-anchor around promptHistorySelectedKeyRef and promptHistoryIndexRef,
preserving the existing dependencies and callback behavior while allowing paint
before this non-layout synchronization runs.

In `@apps/desktop/src/renderer/components/chat/chatPromptHistory.test.ts`:
- Around line 49-70: Extend the tests for promptHistoryEventKey with
table-driven cases covering each identity branch: messageId precedence, turnId
fallback, and text fallback. Keep the existing metadata-decoration assertion,
and verify the expected key for each branch so the precedence order is locked
down.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9ffadfc1-104d-4341-b7ce-1135c6d5a0ae

📥 Commits

Reviewing files that changed from the base of the PR and between 9137a0c and 34b96f2.

⛔ Files ignored due to path filters (1)
  • docs/features/chat/composer-and-ui.md is excluded by !docs/**
📒 Files selected for processing (14)
  • apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatMessageList.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatMessageList.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.test.tsx
  • apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
  • apps/desktop/src/renderer/components/chat/ChatUserMinimap.test.tsx
  • apps/desktop/src/renderer/components/chat/ChatUserMinimap.tsx
  • apps/desktop/src/renderer/components/chat/ComposerPromptStash.tsx
  • apps/desktop/src/renderer/components/chat/chatPrPaneInset.ts
  • apps/desktop/src/renderer/components/chat/chatPromptHistory.test.ts
  • apps/desktop/src/renderer/components/chat/chatPromptHistory.ts
  • apps/desktop/src/renderer/components/chat/chatUserMinimap.logic.test.ts
  • apps/desktop/src/renderer/components/chat/chatUserMinimap.logic.ts
💤 Files with no reviewable changes (1)
  • apps/desktop/src/renderer/components/chat/chatPrPaneInset.ts

Comment thread apps/desktop/src/renderer/components/chat/AgentChatComposer.test.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx
Comment thread apps/desktop/src/renderer/components/chat/AgentChatComposer.tsx Outdated
Comment thread apps/desktop/src/renderer/components/chat/AgentChatPane.tsx
@arul28
arul28 merged commit e8d8616 into main Aug 10, 2026
37 checks passed
@arul28
arul28 deleted the ade/prompt-history-pr-pane branch August 10, 2026 23:37
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