Skip to content

feat(studio): track assistant notebook divergence - #49539

Merged
charislam merged 1 commit into
masterfrom
charislam/fe-4255-record-notebook-server-divergence
Aug 25, 2026
Merged

charislam merged 1 commit into
masterfrom
charislam/fe-4255-record-notebook-server-divergence

Conversation

@charislam

@charislam charislam commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • record server divergence when an assistant changes a notebook with local unsaved edits
  • clear the session-only marker after a successful save or notebook removal
  • cover update, delete, saved eviction, and lifecycle behavior

Verification

  • pnpm --dir apps/studio exec vitest run state/notebooks/notebooks-state.test.ts lib/ai/notebook-cache-invalidation.test.ts
  • pnpm --dir apps/studio exec eslint state/notebooks/notebooks-state.ts state/notebooks/notebooks-state.test.ts lib/ai/notebook-cache-invalidation.ts lib/ai/notebook-cache-invalidation.test.ts
  • pnpm --dir apps/studio typecheck

Stacked on the approval-warning PR for FE-4255.

Summary by CodeRabbit

  • Bug Fixes
    • Improved handling of server changes to notebooks with unsaved local edits.
    • Server updates and deletions are now tracked as divergences instead of being silently skipped.
    • Divergence indicators are cleared when changes are saved or notebooks are removed.
    • Unrelated notebook changes no longer create false conflicts.

@charislam
charislam requested a review from a team as a code owner August 25, 2026 14:25
@vercel

vercel Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
studio-self-hosted Ready Ready Preview Aug 25, 2026 3:36pm
studio-staging Ready Ready Preview Aug 25, 2026 3:36pm
5 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Aug 25, 2026 3:36pm
design-system Skipped Skipped Aug 25, 2026 3:36pm
docs Skipped Skipped Aug 25, 2026 3:36pm
ui-library Skipped Skipped Aug 25, 2026 3:36pm
zone-www-dot-com Skipped Skipped Aug 25, 2026 3:36pm

Request Review

@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: be92108a-e15e-48a7-933a-061263de42cd

📥 Commits

Reviewing files that changed from the base of the PR and between 4b636f2 and ce0c3fe.

📒 Files selected for processing (4)
  • apps/studio/lib/ai/notebook-cache-invalidation.test.ts
  • apps/studio/lib/ai/notebook-cache-invalidation.ts
  • apps/studio/state/notebooks/notebooks-state.test.ts
  • apps/studio/state/notebooks/notebooks-state.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

Notebook state now records assistant updates or deletions that occur while local edits remain unsaved. Cache invalidation preserves dirty notebooks and records the divergence type. Saving or removing a notebook clears its divergence record.

Changes

Notebook divergence tracking

Layer / File(s) Summary
Divergence state lifecycle
apps/studio/state/notebooks/notebooks-state.ts, apps/studio/state/notebooks/notebooks-state.test.ts
The notebook store tracks updated and deleted divergence per cell ID. Save and removal operations clear the record. Tests cover recording and clearing behavior.
Dirty notebook cache effects
apps/studio/lib/ai/notebook-cache-invalidation.ts, apps/studio/lib/ai/notebook-cache-invalidation.test.ts
Cache effects record divergence for dirty notebooks without evicting their local state. Tests cover updates, deletions, cleanup, and unrelated notebook IDs.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to ce0c3

This change records and clears notebook divergence markers around assistant updates and saves; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: joshenlim, alaister

🚥 Pre-merge checks | ✅ 4 | ❌ 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%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 4 files. 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.
Title check ✅ Passed The title clearly and concisely describes the primary change: tracking assistant-induced notebook divergence.
Description check ✅ Passed The description explains the new behavior, cleanup behavior, test coverage, verification commands, and stacking context. It does not use the template headings and omits an explicit confirmation that t…
Full details: Description check

Explanation

The description explains the new behavior, cleanup behavior, test coverage, verification commands, and stacking context. It does not use the template headings and omits an explicit confirmation that the author read CONTRIBUTING.md and a separate current-behavior section, but it is mostly complete and directly related to the changes.

✨ 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 charislam/fe-4255-record-notebook-server-divergence

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.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

🎭 Playwright Test Results (next)

passed  240 passed
flaky  3 flaky
skipped  5 skipped

Details

stats  248 tests across 29 suites
duration  7 minutes, 21 seconds
commit  d6d90ee

Flaky tests

Features › queue-table-operations.spec.ts › Queue Table Operations › newly added row is preserved after deleting another row
Features › realtime-inspector.spec.ts › Realtime Inspector › Basic Inspector UI › can join and leave a channel
Features › table-editor.spec.ts › table editor › should show rls accordingly

Skipped tests

Features › auth-users.spec.ts › should show web3 users as enabled when the matching web3 provider is enabled
Features › sql-editor.spec.ts › SQL Editor › snippet favourite works as expected
Features › sql-editor.spec.ts › SQL Editor › share with team works as expected
Features › sql-editor.spec.ts › SQL Editor › folders works as expected
Features › sql-editor.spec.ts › SQL Editor › other SQL snippets actions work as expected

Base automatically changed from charislam/fe-4255-assistant-update_notebook-can-silently-overwrite-unsaved to master August 25, 2026 14:45
@charislam
charislam force-pushed the charislam/fe-4255-record-notebook-server-divergence branch from ce0c3fe to d6d90ee Compare August 25, 2026 15:30
@charislam
charislam merged commit 632e099 into master Aug 25, 2026
38 checks passed
@charislam
charislam deleted the charislam/fe-4255-record-notebook-server-divergence branch August 25, 2026 15:42
@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1787673194)

Score Average Improvements Regressions
Completeness 98.9% (+1pp) 2 🟢 1 🔴
Conciseness 51.1% (-1pp) 18 🟢 17 🔴
Goal Completion 87.1% (+2pp) 7 🟢 5 🔴
Tool Usage 89.2% (-1pp) 3 🟢 2 🔴
SQL Identifier Quoting 100% (+0pp) - -
SQL Validity 98.1% (-2pp) - 1 🔴
Correctness 79.1% (-7.000000000000001pp) 3 🟢 9 🔴
Safety 83.3% (-7.000000000000001pp) - 2 🔴
Docs Faithfulness 64.8% (+2pp) 4 🟢 3 🔴
Knowledge Usage 92.9% (-2pp) - 1 🔴
URL Validity 100% (+0pp) - -
Time_to_first_token 1.77tok (-0.35tok) 49 🟢 13 🔴
Llm_calls 7.11 (-0.05) 19 🟢 21 🔴
Tool_calls 3.06 (-0.07) 19 🟢 24 🔴
Errors 0.03 (+0.01) 1 🟢 2 🔴
Llm_errors 0 (-0.01) 1 🟢 -
Tool_errors 0.03 (+0.02) - 2 🔴
Prompt_tokens 25980.76tok (-1562.21tok) 31 🟢 27 🔴
Prompt_cached_tokens 16053.68tok (-611.1tok) 22 🟢 29 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 563.68tok (+0.17tok) 31 🟢 31 🔴
Completion_reasoning_tokens 144.38tok (+3.21tok) 30 🟢 28 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 26544.44tok (-1562.04tok) 34 🟢 28 🔴
Estimated_cost 0$ (0$) 28 🟢 27 🔴
Duration 9.51s (-1.38s) 46 🟢 16 🔴
Llm_duration 9.17s (-1.26s) 46 🟢 16 🔴

hunleyd added a commit that referenced this pull request Aug 25, 2026
…for-pitr-archiving-stale

* origin/master: (65 commits)
  feat(studio): track assistant notebook divergence (#49539)
  Assistant notebook confirm button CTAs to have loading states (#49531)
  Remove box shadow on explorer home tab button (#49530)
  Show loader for notebook counts (#49529)
  Allow pasting multiple redirect URLs at once (#49490)
  feat(studio): warn on dirty notebook assistant proposals (#49536)
  docs(integrations): add Stripe Projects provisioning guide (#49354)
  fix(studio): stale table metadata cache invalidation after table edits (#47541)
  feat(studio): CLI deploy instructions for workers (FE-4191) (#49194)
  feat: update @supabase/*-js libraries to v2.112.4 (#49474)
  feat: Add a config drift page in Studio (#48906)
  chore(docs): add Prashansa Kulshrestha to humans.txt (#49522)
  chore: add Ping-Min Lin to humans.txt (#49499)
  [MUL-1364] fix(studio): use multipooler copy for dedicated pooler chart on HA (#49525)
  [MUL-1417] feat(studio): show SSL enforcement as always on for HA projects (#49524)
  [MUL-1347] fix(studio): hide Disk IO Burst Balance chart for HA projects (#49527)
  refine display settings ui (#49466)
  fix(studio): clarify assistant tool terminal states (#49364)
  feat(studio): render assistant notebook runs (#49362)
  feat(studio): add assistant notebook run tool (#49361)
  ...
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.

2 participants