Skip to content

[dev] [Marfuen] mariano/ai-policy-editor#2291

Open
github-actions[bot] wants to merge 4 commits intomainfrom
mariano/ai-policy-editor
Open

[dev] [Marfuen] mariano/ai-policy-editor#2291
github-actions[bot] wants to merge 4 commits intomainfrom
mariano/ai-policy-editor

Conversation

@github-actions
Copy link
Contributor

This is an automated pull request to merge mariano/ai-policy-editor into dev.
It was created by the [Auto Pull Request] action.

Marfuen and others added 3 commits March 12, 2026 11:55
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add pencil icon button to the accept/reject pill that opens an inline
text input for per-hunk AI feedback. Submitting sends contextual
feedback through the existing chat, shows a shimmer loading state for
the targeted hunk, and remaps decisions when the proposal changes.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…dates

- Refactor `getLatestProposedPolicy` to `getLatestCompletedProposal` for better tracking of proposals across the entire conversation.
- Update `PolicyContentManager` to utilize the new proposal fetching logic and manage proposal states more effectively.
- Revamp `PolicyAiAssistant` UI to improve user interaction and feedback display.
- Introduce confirmation for applying all changes in `ProposedChangesCard`, ensuring user intent is clear before executing bulk actions.
- Update `.gitignore` to exclude new directories related to superpowers documentation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@cursor
Copy link

cursor bot commented Mar 12, 2026

PR Summary

Medium Risk
Touches the policy editor’s AI suggestion application flow (including selective patch application) and swaps the LLM provider/model, so incorrect diff/hunk handling or prompt/model differences could lead to wrong policy content updates.

Overview
Adds an in-editor “Suggested Changes” card that replaces the old diff section, letting reviewers accept/reject individual diff hunks, apply only selected hunks, and optionally send per-hunk feedback to regenerate just that section while preserving other decisions.

Improves proposal state handling so the latest completed proposePolicy result persists during new streaming responses, hides internal per-hunk feedback messages from the visible chat, and adjusts the AI assistant layout responsively (inline on smaller screens, side panel on wide desktop).

Updates the policy chat backend to use Anthropic (claude-sonnet-4-6) and strengthens the system prompt to preserve unchanged text exactly and honor targeted per-section feedback.

Written by Cursor Bugbot for commit 4ea9b82. This will update automatically on new commits. Configure here.

@vercel
Copy link

vercel bot commented Mar 12, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Mar 12, 2026 7:59pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Mar 12, 2026 7:59pm

Request Review

<div className="flex-[3] min-w-0 self-stretch">
{/* Wide desktop (1536px+): AI assistant side panel */}
{aiAssistantEnabled && showAiAssistant && !isVersionReadOnly && activeTab === 'EDITOR' && isWideDesktop && (
<div className="flex-[3] min-w-[320px] self-stretch">
Copy link

Choose a reason for hiding this comment

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

Wide desktop chat shows unfiltered hunk feedback messages

High Severity

The mobile/tablet PolicyAiAssistant receives displayMessages (which filters out internal per-hunk feedback messages containing the ___hunk_feedback___ marker), but the wide desktop PolicyAiAssistant receives raw messages. This means on wide desktop screens, users will see the raw internal feedback messages — including the ___hunk_feedback___ marker text — in the chat panel.

Additional Locations (1)
Fix in Cursor Fix in Web

}

// Re-create the patch using structuredPatch to get raw hunks with line-level data
const rawPatch = structuredPatch('f', 'f', originalText, '', '', '', { context: 1 });
Copy link

Choose a reason for hiding this comment

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

Unused rawPatch variable wastes computation in applySelectedHunks

Low Severity

rawPatch is assigned from structuredPatch('f', 'f', originalText, '', '', '', { context: 1 }) but never referenced anywhere. It also incorrectly diffs originalText against an empty string, suggesting this is leftover code from an abandoned approach. This dead code runs an unnecessary diff computation on every call to applySelectedHunks.

Fix in Cursor Fix in Web

- Filter out hunks with only whitespace-only changes from the diff view
- Merge adjacent skip blocks and no-change hunks into a single
  "Show N unchanged lines" section
- Count changes by reviewable sections (hunks) instead of individual lines
- Reject All now marks all hunks as rejected instead of clearing to pending
- Strengthen system prompt to preserve unchanged text verbatim

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel vercel bot temporarily deployed to Preview – portal March 12, 2026 19:57 Inactive
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

There are 4 total unresolved issues (including 2 from previous reviews).

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.


const [showAiAssistant, setShowAiAssistant] = useState(false);
const isWideDesktop = useMediaQuery('(min-width: 1536px)');
const isDesktop = useMediaQuery('(min-width: 1024px)');
Copy link

Choose a reason for hiding this comment

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

Unused isDesktop variable from useMediaQuery hook call

Low Severity

isDesktop is declared via useMediaQuery('(min-width: 1024px)') but never referenced anywhere in the component. This is dead code that also triggers an unnecessary media query listener on every render.

Fix in Cursor Fix in Web

const range = skipRanges.get(hunkIndex);
if (!range) return '';
return originalLines.slice(range.start - 1, range.end).join('\n');
}
Copy link

Choose a reason for hiding this comment

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

Unused getSkipLines function defined but never called

Low Severity

The getSkipLines function is defined but never called anywhere in the codebase. The skip section rendering in displayItems inline-computes originalLines.slice(...) directly instead of using this helper.

Fix in Cursor Fix in Web

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