Skip to content

feat: add selective message inclusion when committing prompt sessions to versions#2132

Merged
akshaydeo merged 2 commits intov1.5.0from
03-17-feat_allow_message_selection_while_committing_a_prompt_version
Apr 6, 2026
Merged

feat: add selective message inclusion when committing prompt sessions to versions#2132
akshaydeo merged 2 commits intov1.5.0from
03-17-feat_allow_message_selection_while_committing_a_prompt_version

Conversation

@impoiler
Copy link
Copy Markdown
Contributor

@impoiler impoiler commented Mar 17, 2026

Summary

Add selective message inclusion when committing prompt sessions as versions. Users can now choose which specific messages from a session to include in the committed version instead of always including all messages.

Changes

  • Added message_indices optional field to CommitSessionRequest to specify which messages to include (0-based indices)
  • Enhanced backend handler to validate message indices and filter session messages accordingly
  • Redesigned the commit version UI with a scrollable message selection interface
  • Added message preview components with checkboxes for individual selection
  • Implemented select all/deselect all functionality
  • Added validation to prevent committing with no messages selected
  • Fixed edge case where committing without changes now properly handles existing sessions

Type of change

  • Feature

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • UI (Next.js)

How to test

  1. Create a prompt session with multiple messages
  2. Click "Commit Version" to open the commit sheet
  3. Verify you can select/deselect individual messages
  4. Test the "Select all"/"Deselect all" toggle
  5. Verify validation prevents committing with invalid indices
  6. Confirm the committed version only contains selected messages
# Core/Transports
go version
go test ./...

# UI
cd ui
pnpm i || npm i
pnpm test || npm test
pnpm build || npm run build

Screenshots/Recordings

The commit version sheet now displays a scrollable list of messages with checkboxes, allowing users to selectively include messages in the version.

Breaking changes

  • Yes
  • No

The message_indices field is optional, maintaining backward compatibility.

Related issues

Enables more granular version control for prompt engineering workflows.

Security considerations

Added validation to ensure message indices are within valid bounds to prevent out-of-range access.

Checklist

  • I read docs/contributing/README.md and followed the guidelines
  • I added/updated tests where appropriate
  • I updated documentation where needed
  • I verified builds succeed (Go and UI)
  • I verified the CI pipeline passes locally if applicable

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 17, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Select specific messages to include when committing a session (instead of always including all).
    • Per-message preview with type/content indicators and checkboxes for selection.
    • Default-selects first message when opening the sheet; supports select-all toggle.
  • Bug Fixes / Validation

    • Prevents commits with no messages selected; validates and rejects invalid message indices.
    • Submit button disabled when no messages are selected; commit description trimmed.

Walkthrough

Selective committing of session messages was added: the frontend lets users pick message indices to include, and the backend accepts an optional message_indices array, validates indices, rejects out-of-range or empty selections with 400 responses, and builds versions from the selected messages.

Changes

Cohort / File(s) Summary
Backend Handler
transports/bifrost-http/handlers/prompts.go
Added MessageIndices *[]int \json:"message_indices,omitempty"`` to request type. Commit logic now builds deduplicated messages from provided indices when present, validates index bounds (returns 400 with index and valid range on error), and returns 400 if the resulting messages slice is empty.
Frontend Types
ui/lib/types/prompts.ts
Added optional message_indices?: number[] to CommitSessionRequest to match backend payload.
Frontend UI — Header
ui/components/prompts/components/promptsViewHeader.tsx
handleCommitVersion short-circuits when hasChanges is false by finding the selected session and calling onSessionSaved(selectedSession) instead of creating a new session; added hasChanges to dependencies.
Frontend UI — Commit Sheet
ui/components/prompts/sheets/commitVersionSheet.tsx
Added per-message selection UI (MessagePreview), selectedIndices state with select-all behavior, default-first-message selection, disabled submit and toast when none selected, trims commit message, includes message_indices only when not all messages selected, and layout changes to keep commit controls visible.

Sequence Diagram

sequenceDiagram
    participant User
    participant ViewHeader as "View Header"
    participant CommitSheet as "Commit Sheet UI"
    participant Backend as "Backend Handler"

    User->>ViewHeader: Click "Commit Version"
    ViewHeader->>CommitSheet: Open commit sheet (init selection)
    User->>CommitSheet: Toggle message checkboxes
    alt No changes (hasChanges == false)
        ViewHeader->>ViewHeader: Find selected session
        ViewHeader-->>User: Call onSessionSaved(selectedSession) (no backend request)
    else Has changes
        User->>CommitSheet: Submit commit
        CommitSheet->>CommitSheet: Build payload (trim message)
        CommitSheet->>CommitSheet: Include message_indices only if not all selected
        CommitSheet->>Backend: POST /commit with payload
        Backend->>Backend: Validate message_indices (if present)
        alt Invalid indices or empty selection
            Backend-->>CommitSheet: 400 BadRequest (error)
            CommitSheet->>User: Show error toast
        else Valid
            Backend->>Backend: Construct versions from selected/all messages
            Backend-->>CommitSheet: 200 OK (success)
            CommitSheet->>ViewHeader: onSessionSaved(result.session)
            ViewHeader->>User: Update UI state
        end
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I nibbled choices from the message hay,
Checkboxes gleamed to show the way,
Indices counted, outliers tossed,
Only what matters gets safely crossed,
A tidy commit — carrot-sweet, hooray! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main feature: adding selective message inclusion when committing prompt sessions to versions.
Description check ✅ Passed The description comprehensively covers all required template sections: Summary, Changes, Type of change, Affected areas, How to test, and Breaking changes, with appropriate checkmarks and detailed explanations throughout.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 03-17-feat_allow_message_selection_while_committing_a_prompt_version

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

Copy link
Copy Markdown
Contributor Author

impoiler commented Mar 17, 2026

@impoiler impoiler changed the title feat/allow message selection while committing a prompt version feat: add selective message inclusion when committing prompt sessions to versions Mar 17, 2026
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from f89f479 to 9367bf9 Compare March 17, 2026 12:23
@akshaydeo akshaydeo changed the base branch from 03-17-prompt_playground_style_fixes to graphite-base/2132 March 17, 2026 12:55
@akshaydeo akshaydeo force-pushed the graphite-base/2132 branch from f49ca80 to 5013139 Compare March 17, 2026 12:58
@akshaydeo akshaydeo force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from 9367bf9 to 8d5d81d Compare March 17, 2026 12:58
@graphite-app graphite-app Bot changed the base branch from graphite-base/2132 to main March 17, 2026 12:59
@akshaydeo akshaydeo force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from 8d5d81d to 7735ceb Compare March 17, 2026 12:59
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch 4 times, most recently from 37a9003 to c41876d Compare March 18, 2026 08:11
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch 3 times, most recently from 6947a3d to a2340f6 Compare March 23, 2026 05:02
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch 7 times, most recently from 35c9daf to 37bf719 Compare March 26, 2026 10:47
Comment thread ui/components/prompts/sheets/commitVersionSheet.tsx
Comment thread transports/bifrost-http/handlers/prompts.go Outdated
Comment thread ui/components/prompts/sheets/commitVersionSheet.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
ui/components/prompts/components/promptsViewHeader.tsx (1)

111-136: ⚠️ Potential issue | 🟠 Major

Missing dependencies in useCallback cause stale closure.

The callback references sessions and selectedSessionId (lines 114-115) but they're missing from the dependency array. This can cause the callback to reference stale values when these change.

🐛 Proposed fix
-	}, [selectedPrompt?.id, messages, buildSaveParams, provider, model, createSession, setUrlState, onSessionSaved, hasChanges]);
+	}, [selectedPrompt?.id, messages, buildSaveParams, provider, model, createSession, setUrlState, onSessionSaved, hasChanges, sessions, selectedSessionId]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/components/promptsViewHeader.tsx` around lines 111 -
136, The handleCommitVersion callback closes over sessions and selectedSessionId
but they are not listed in the useCallback dependency array, which can lead to
stale values; update the dependency array for useCallback that defines
handleCommitVersion to include sessions and selectedSessionId (in addition to
the existing dependencies like selectedPrompt?.id, messages, buildSaveParams,
provider, model, createSession, setUrlState, onSessionSaved, hasChanges) so the
closure always sees the latest session list and selected session id.
ui/components/prompts/sheets/commitVersionSheet.tsx (1)

111-135: ⚠️ Potential issue | 🟡 Minor

Empty selection would commit a version with no messages.

If the user deselects all messages and submits, message_indices would be [] and allSelected would be false, sending an empty array. The backend would create a version with zero messages. Consider disabling submit when no messages are selected.

🛡️ Proposed fix - disable submit button when no messages selected
-              <Button type="submit" data-testid="commit-version-submit" disabled={isLoading}>
+              <Button type="submit" data-testid="commit-version-submit" disabled={isLoading || selectedIndices.size === 0}>
                 {isLoading ? 'Committing...' : 'Commit Version'}
               </Button>
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx` around lines 111 - 135,
Prevent submitting an empty selection by adding a selection check in onSubmit
and disabling the form submit control: inside onSubmit (function onSubmit)
early-return with a toast.error if neither allSelected is true nor
selectedIndices has any entries (e.g., selectedIndices.size === 0), and also
update the submit button in the CommitVersionSheet UI to be disabled when there
are no selected messages (use the same condition: !allSelected &&
selectedIndices.size === 0) so the user cannot submit a commit with zero
messages.
🧹 Nitpick comments (4)
ui/components/prompts/sheets/commitVersionSheet.tsx (3)

81-87: Consider using session.messages.length in dependency instead of the array reference.

The session.messages array reference may change even if the content is the same, potentially causing unnecessary resets. Using session.messages.length would be more stable while still reacting to actual message count changes.

💡 Proposed fix
   useEffect(() => {
     if (open) {
       reset({ commitMessage: '' })
       setSelectedIndices(new Set(session.messages.length > 0 ? [0] : []))
     }
-  }, [open, reset, session.messages])
+  }, [open, reset, session.messages.length])
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx` around lines 81 - 87,
The effect that resets the form and selection uses session.messages in its
dependency array which can change by reference and trigger unnecessary runs;
update the dependency to session.messages.length and keep the body using
session.messages (i.e., in the useEffect that calls reset and
setSelectedIndices) so the effect only reruns when the number of messages
actually changes.

28-66: Add data-testid to MessagePreview checkbox for testability.

Per coding guidelines, new interactive UI elements should have data-testid attributes following the <entity>-<element>-<qualifier> pattern.

💡 Proposed fix
       <Checkbox
         checked={selected}
         onCheckedChange={onToggle}
         className="mt-1 shrink-0"
+        data-testid={`message-preview-checkbox-${sessionMessage.order_index}`}
       />

As per coding guidelines: ui/**/*.{tsx,ts}: Add new interactive UI elements with data-testid attributes following the pattern: data-testid="<entity>-<element>-<qualifier>".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx` around lines 28 - 66,
Add a data-testid to the interactive Checkbox inside the MessagePreview
component so tests can target it; specifically, update the Checkbox in
MessagePreview to include a data-testid attribute using the prescribed pattern
(e.g., "messagepreview-checkbox-selected" or similar that follows
<entity>-<element>-<qualifier>), ensuring the attribute stays on the Checkbox
element that uses checked={selected} and onCheckedChange={onToggle} so test
authors can reliably locate and toggle it.

152-159: Add data-testid to the toggle all button.

💡 Proposed fix
               <button
                 type="button"
                 onClick={toggleAll}
                 className="text-xs text-muted-foreground hover:text-foreground transition-colors"
+                data-testid="commit-version-toggle-all"
               >
                 {allSelected ? 'Deselect all' : 'Select all'}
               </button>

As per coding guidelines: ui/**/*.{tsx,ts}: Add new interactive UI elements with data-testid attributes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx` around lines 152 - 159,
The toggle-all button rendered in the CommitVersionSheet component (the button
using onClick={toggleAll} and label derived from allSelected) needs a
data-testid attribute for testing; update that button element to include a
descriptive test id such as data-testid="commit-version-toggle-all" (or similar
consistent naming) so automated tests can target it.
transports/bifrost-http/handlers/prompts.go (1)

1013-1016: Error message is confusing when session has no messages.

When session.Messages is empty, the error becomes "message index X out of range (0--1)". Consider a clearer message for this edge case.

💡 Proposed improvement
 		for _, idx := range req.MessageIndices {
-			if idx < 0 || idx >= len(session.Messages) {
-				SendError(ctx, fasthttp.StatusBadRequest, fmt.Sprintf("message index %d out of range (0-%d)", idx, len(session.Messages)-1))
+			if len(session.Messages) == 0 {
+				SendError(ctx, fasthttp.StatusBadRequest, "session has no messages")
+				return
+			}
+			if idx < 0 || idx >= len(session.Messages) {
+				SendError(ctx, fasthttp.StatusBadRequest, fmt.Sprintf("message index %d out of range (0-%d)", idx, len(session.Messages)-1))
 				return
 			}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@transports/bifrost-http/handlers/prompts.go` around lines 1013 - 1016, The
current range error builds "(0-%d)" using len(session.Messages)-1 which yields
"(0--1)" when session.Messages is empty; update the error handling in the block
around session.Messages, idx and SendError so you check len(session.Messages) ==
0 first and return a clear message like "no messages in session" (or "message
index %d out of range: session has no messages"), otherwise keep the existing
fmt.Sprintf path that prints the valid range 0-(len(session.Messages)-1);
reference session.Messages, idx, SendError and fmt.Sprintf in your change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@transports/bifrost-http/handlers/prompts.go`:
- Around line 1010-1030: The code builds version messages from
req.MessageIndices but does not check for duplicate indices so repeated indices
produce duplicate TablePromptVersionMessage entries; update the handler to
deduplicate indices before appending by tracking seen indices (map[int]bool)
when iterating req.MessageIndices, validate bounds with the same checks using
SendError, skip any index already seen, and only append messages for the first
occurrence (use req.MessageIndices, session.Messages, SendError, and
tables.TablePromptVersionMessage to locate the relevant code).

---

Outside diff comments:
In `@ui/components/prompts/components/promptsViewHeader.tsx`:
- Around line 111-136: The handleCommitVersion callback closes over sessions and
selectedSessionId but they are not listed in the useCallback dependency array,
which can lead to stale values; update the dependency array for useCallback that
defines handleCommitVersion to include sessions and selectedSessionId (in
addition to the existing dependencies like selectedPrompt?.id, messages,
buildSaveParams, provider, model, createSession, setUrlState, onSessionSaved,
hasChanges) so the closure always sees the latest session list and selected
session id.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx`:
- Around line 111-135: Prevent submitting an empty selection by adding a
selection check in onSubmit and disabling the form submit control: inside
onSubmit (function onSubmit) early-return with a toast.error if neither
allSelected is true nor selectedIndices has any entries (e.g.,
selectedIndices.size === 0), and also update the submit button in the
CommitVersionSheet UI to be disabled when there are no selected messages (use
the same condition: !allSelected && selectedIndices.size === 0) so the user
cannot submit a commit with zero messages.

---

Nitpick comments:
In `@transports/bifrost-http/handlers/prompts.go`:
- Around line 1013-1016: The current range error builds "(0-%d)" using
len(session.Messages)-1 which yields "(0--1)" when session.Messages is empty;
update the error handling in the block around session.Messages, idx and
SendError so you check len(session.Messages) == 0 first and return a clear
message like "no messages in session" (or "message index %d out of range:
session has no messages"), otherwise keep the existing fmt.Sprintf path that
prints the valid range 0-(len(session.Messages)-1); reference session.Messages,
idx, SendError and fmt.Sprintf in your change.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx`:
- Around line 81-87: The effect that resets the form and selection uses
session.messages in its dependency array which can change by reference and
trigger unnecessary runs; update the dependency to session.messages.length and
keep the body using session.messages (i.e., in the useEffect that calls reset
and setSelectedIndices) so the effect only reruns when the number of messages
actually changes.
- Around line 28-66: Add a data-testid to the interactive Checkbox inside the
MessagePreview component so tests can target it; specifically, update the
Checkbox in MessagePreview to include a data-testid attribute using the
prescribed pattern (e.g., "messagepreview-checkbox-selected" or similar that
follows <entity>-<element>-<qualifier>), ensuring the attribute stays on the
Checkbox element that uses checked={selected} and onCheckedChange={onToggle} so
test authors can reliably locate and toggle it.
- Around line 152-159: The toggle-all button rendered in the CommitVersionSheet
component (the button using onClick={toggleAll} and label derived from
allSelected) needs a data-testid attribute for testing; update that button
element to include a descriptive test id such as
data-testid="commit-version-toggle-all" (or similar consistent naming) so
automated tests can target it.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5a553f81-bad1-4a0a-a933-9296cbbc4c3d

📥 Commits

Reviewing files that changed from the base of the PR and between dd314d0 and b3e7ea8.

📒 Files selected for processing (4)
  • transports/bifrost-http/handlers/prompts.go
  • ui/components/prompts/components/promptsViewHeader.tsx
  • ui/components/prompts/sheets/commitVersionSheet.tsx
  • ui/lib/types/prompts.ts

Comment thread transports/bifrost-http/handlers/prompts.go Outdated
@impoiler impoiler changed the base branch from main to graphite-base/2132 March 30, 2026 11:11
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from b3e7ea8 to a426c21 Compare March 30, 2026 11:11
@impoiler impoiler force-pushed the graphite-base/2132 branch from dd314d0 to 9ef5b72 Compare March 30, 2026 11:11
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from a426c21 to c7ddf8c Compare March 30, 2026 11:22
@impoiler impoiler changed the base branch from graphite-base/2132 to 03-30-feat_adds-prompts-plugin-with-direct-key-header-resolver March 30, 2026 11:22
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from c7ddf8c to 3732c49 Compare March 30, 2026 11:23
@impoiler impoiler force-pushed the 03-30-feat_adds-prompts-plugin-with-direct-key-header-resolver branch from 9ef5b72 to ae921da Compare March 30, 2026 11:23
@roroghost17 roroghost17 changed the base branch from 03-30-feat_adds-prompts-plugin-with-direct-key-header-resolver to graphite-base/2132 March 30, 2026 11:24
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
ui/components/prompts/components/promptsViewHeader.tsx (1)

111-136: ⚠️ Potential issue | 🟡 Minor

Missing dependencies in useCallback may cause stale closure bugs.

The handleCommitVersion callback references sessions and selectedSessionId in the !hasChanges branch, but these are not included in the dependency array. This can cause the callback to use stale values.

🛡️ Proposed fix to add missing dependencies
-	}, [selectedPrompt?.id, messages, buildSaveParams, provider, model, createSession, setUrlState, onSessionSaved, hasChanges]);
+	}, [selectedPrompt?.id, messages, buildSaveParams, provider, model, createSession, setUrlState, onSessionSaved, hasChanges, sessions, selectedSessionId]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/components/promptsViewHeader.tsx` around lines 111 -
136, The useCallback for handleCommitVersion captures sessions and
selectedSessionId in the early-return branch but they are missing from the
dependency array, which can produce stale closures; update the dependency list
for handleCommitVersion to include sessions and selectedSessionId (in addition
to the existing selectedPrompt?.id, messages, buildSaveParams, provider, model,
createSession, setUrlState, onSessionSaved, hasChanges) so the callback rebinds
when those values change.
🧹 Nitpick comments (2)
ui/components/prompts/sheets/commitVersionSheet.tsx (2)

44-49: Add data-testid to the Checkbox for test discoverability.

Per coding guidelines, new interactive UI elements should have data-testid attributes following the <entity>-<element>-<qualifier> pattern.

🧪 Proposed fix
       <Checkbox
         checked={selected}
         onCheckedChange={onToggle}
         className="mt-1 shrink-0"
+        data-testid="message-preview-checkbox"
       />

As per coding guidelines: ui/**/*.{tsx,ts}: Add new interactive UI elements with data-testid attributes following the pattern: data-testid="<entity>-<element>-<qualifier>".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx` around lines 44 - 49,
The Checkbox component instance in commitVersionSheet.tsx (the JSX element with
props checked, onCheckedChange and className) needs a data-testid attribute for
test discoverability; add a data-testid following the pattern
"<entity>-<element>-<qualifier>" (e.g., "commit-version-sheet-checkbox-selected"
or similar) to the Checkbox JSX so tests can reliably query it.

156-162: Add data-testid to the toggle all button.

The "Select all / Deselect all" button is an interactive element that should have a data-testid for E2E testing.

🧪 Proposed fix
               <button
                 type="button"
                 onClick={toggleAll}
                 className="text-xs text-muted-foreground hover:text-foreground transition-colors"
+                data-testid="commit-version-toggle-all"
               >

As per coding guidelines: ui/**/*.{tsx,ts}: Add new interactive UI elements with data-testid attributes following the pattern: data-testid="<entity>-<element>-<qualifier>".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@ui/components/prompts/sheets/commitVersionSheet.tsx` around lines 156 - 162,
Add a data-testid attribute to the "Select all / Deselect all" toggle button so
E2E tests can target it: update the button in the CommitVersionSheet component
(the button that calls toggleAll and reads allSelected) to include data-testid
following the project pattern, e.g. data-testid="commit-version-toggle-all"
(replace with exact entity-element-qualifier if your naming conventions require
a different entity).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@ui/components/prompts/sheets/commitVersionSheet.tsx`:
- Line 101: The computed allSelected is true when session.messages.length is 0
because selectedIndices.size === 0; update the logic in CommitVersionSheet to
check that there are messages first (e.g., make allSelected depend on
session.messages.length > 0) so it becomes false for empty sessions; locate the
expression using allSelected (and the symbols selectedIndices and
session.messages) and change it to require a non-zero message count before
treating all items as selected.

---

Outside diff comments:
In `@ui/components/prompts/components/promptsViewHeader.tsx`:
- Around line 111-136: The useCallback for handleCommitVersion captures sessions
and selectedSessionId in the early-return branch but they are missing from the
dependency array, which can produce stale closures; update the dependency list
for handleCommitVersion to include sessions and selectedSessionId (in addition
to the existing selectedPrompt?.id, messages, buildSaveParams, provider, model,
createSession, setUrlState, onSessionSaved, hasChanges) so the callback rebinds
when those values change.

---

Nitpick comments:
In `@ui/components/prompts/sheets/commitVersionSheet.tsx`:
- Around line 44-49: The Checkbox component instance in commitVersionSheet.tsx
(the JSX element with props checked, onCheckedChange and className) needs a
data-testid attribute for test discoverability; add a data-testid following the
pattern "<entity>-<element>-<qualifier>" (e.g.,
"commit-version-sheet-checkbox-selected" or similar) to the Checkbox JSX so
tests can reliably query it.
- Around line 156-162: Add a data-testid attribute to the "Select all / Deselect
all" toggle button so E2E tests can target it: update the button in the
CommitVersionSheet component (the button that calls toggleAll and reads
allSelected) to include data-testid following the project pattern, e.g.
data-testid="commit-version-toggle-all" (replace with exact
entity-element-qualifier if your naming conventions require a different entity).
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0f85e2c5-cb62-4557-a884-05815d6996cc

📥 Commits

Reviewing files that changed from the base of the PR and between b3e7ea8 and 3732c49.

📒 Files selected for processing (3)
  • transports/bifrost-http/handlers/prompts.go
  • ui/components/prompts/components/promptsViewHeader.tsx
  • ui/components/prompts/sheets/commitVersionSheet.tsx

Comment thread ui/components/prompts/sheets/commitVersionSheet.tsx
@impoiler impoiler force-pushed the graphite-base/2132 branch from ae921da to 54c7bb4 Compare March 30, 2026 13:56
@impoiler impoiler force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from 3732c49 to a5c5d4a Compare March 30, 2026 13:56
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@transports/bifrost-http/handlers/prompts.go`:
- Around line 1037-1054: The current branch iterates client-supplied
req.MessageIndices and appends messages in that order, which reorders the
session; instead build a set from req.MessageIndices (deduplicating and
validating indices) and then iterate session.Messages in their original order,
appending any message whose index is present in the set into messages (use the
same validation logic and SendError on out-of-range indices); update the code
paths using session.Messages, tables.TablePromptVersionMessage, and
req.MessageIndices accordingly so output preserves original session order while
filtering.
🪄 Autofix (Beta)

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8cd6dca8-2b4e-41d0-9f7d-b3722b5f9ea4

📥 Commits

Reviewing files that changed from the base of the PR and between 3732c49 and a5c5d4a.

📒 Files selected for processing (4)
  • transports/bifrost-http/handlers/prompts.go
  • ui/components/prompts/components/promptsViewHeader.tsx
  • ui/components/prompts/sheets/commitVersionSheet.tsx
  • ui/lib/types/prompts.ts
✅ Files skipped from review due to trivial changes (2)
  • ui/lib/types/prompts.ts
  • ui/components/prompts/sheets/commitVersionSheet.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • ui/components/prompts/components/promptsViewHeader.tsx

Comment thread transports/bifrost-http/handlers/prompts.go
coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 1, 2026
Copy link
Copy Markdown
Contributor

akshaydeo commented Apr 6, 2026

Merge activity

@roroghost17 roroghost17 force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from a5c5d4a to 075f66e Compare April 6, 2026 09:29
@roroghost17 roroghost17 force-pushed the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch from 075f66e to 1fa8785 Compare April 6, 2026 09:31
@akshaydeo akshaydeo changed the base branch from graphite-base/2132 to v1.5.0 April 6, 2026 10:42
@akshaydeo akshaydeo dismissed coderabbitai[bot]’s stale review April 6, 2026 10:42

The base branch was changed.

@akshaydeo akshaydeo merged commit a55b566 into v1.5.0 Apr 6, 2026
17 of 18 checks passed
@akshaydeo akshaydeo deleted the 03-17-feat_allow_message_selection_while_committing_a_prompt_version branch April 6, 2026 10:43
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.

3 participants