Skip to content

fix: enforceable Agent writes plus non-blocking save bubbles - #75

Merged
venkateshsakamuri-lab merged 6 commits into
mainfrom
cursor/agent-enforceable-recs-c497
Aug 22, 2026
Merged

fix: enforceable Agent writes plus non-blocking save bubbles#75
venkateshsakamuri-lab merged 6 commits into
mainfrom
cursor/agent-enforceable-recs-c497

Conversation

@venkateshsakamuri-lab

@venkateshsakamuri-lab venkateshsakamuri-lab commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

Problem

Agent chat answered a metric, then offered “Should I save this as a shared DeepSQL brain note?” A user without canManageContent clicked Yes and got a 403. The offer itself is the bug.

Admins still need a way to persist a useful definition — without the Agent asking, without blocking chat, and without creating a second note that overlaps an existing brain note or business rule. Chips must stay quiet when the Agent already got it right.

Fix

Capability gating

  • Stamp callerCapabilities (including doNotOffer and canWriteSharedBrainNotes) on get_brain_context, list_connections, list_brain_recommendations, and get_current_user.
  • save_brain_note fail-closes before POST /brain/notes when canManageContent is false.
  • SOUL.md / bi-query skill: never volunteer a write listed in doNotOffer.

Suggestion bubbles — only after correction or teaching

  • A clean first-turn answer never gets a chip, even if it looks like a definition.
  • “Thanks, that’s right” after a good answer also stays quiet.
  • A chip appears only when the user follows up with a correction/teaching phrase (that's wrong, always filter, remember this, …) after a prior Agent reply.
  • Clicking the chip opens an excerpt of the shared brain note that would be created, plus Save to brain / Merge and save.
  • Propose/accept never blocks the composer.
  • One unsaved chip at a time; dismissed/saved targets stay suppressed for the session.
  • Overlaps with existing notes or business rules merge into one intent.
  • schema.table extraction is a linear scan (no ReDoS regex).

Verify

  • cd backend && ./mvnw test -Dtest=BrainNoteIntentServiceTest,BrainControllerAuthorizationSafetyTest
  • node --test src/components/AgentChat/shouldOfferBrainSuggestion.test.js src/components/AgentChat/AgentRecommendationBubbles.test.js
  • Live POST /brain/notes/propose: first-turn and thanks → 204; correction with priorAnswer200 NEW / MERGE

Suggestion chip opens an excerpt of the brain note
After save the chip is gone and the composer stays usable
brain_note_suggestion_bubble.mp4

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

The Agent volunteered "save this as a shared DeepSQL brain note" after
answering a metric, then 403'd for users without manage-content. Stamp
callerCapabilities on get_brain_context / list_connections, fail-close
save_brain_note before the POST, and stop SOUL.md from asking whether
to persist a definition the current account cannot write.

Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
@venkateshsakamuri-lab
venkateshsakamuri-lab marked this pull request as ready for review August 22, 2026 07:48
@venkateshsakamuri-lab
venkateshsakamuri-lab removed the request for review from geekypunk August 22, 2026 08:52
After an Agent turn, admins see a chip they can open for the excerpt of
the shared note that would be created. Overlaps with existing notes or
business rules merge into one intent; identical intent is not offered.
Propose/accept never blocks the composer.

Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
@cursor cursor Bot changed the title fix: do not offer Agent writes the caller cannot enforce fix: enforceable Agent writes plus non-blocking save bubbles Aug 22, 2026
cursoragent and others added 3 commits August 22, 2026 10:08
CodeQL flagged QUALIFIED_TABLE as polynomial ReDoS on Agent Q&A
(long runs of 'A'). Walk the string once instead.

Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
Clean first-turn answers stay quiet. A chip appears only when the user
corrects or teaches after a prior Agent reply. One unsaved chip at a
time; dismissed targets stay suppressed for the session.

Co-authored-by: Venkat SF <venkatesh.sakamuri@stayflexi.com>
@venkateshsakamuri-lab
venkateshsakamuri-lab merged commit f28cc95 into main Aug 22, 2026
9 checks passed
@venkateshsakamuri-lab
venkateshsakamuri-lab deleted the cursor/agent-enforceable-recs-c497 branch August 22, 2026 16:40
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