refactor(settings): move refresh_open_files toggle to NBI config#339
Merged
mbektas merged 1 commit intoMay 22, 2026
Merged
Conversation
Relocates the open-files refresh watcher's user toggle from JupyterLab's ISettingRegistry into NBI's own config.json + Settings dialog. Adds a new "External changes" section to the General tab with a Refresh-on-disk-change checkbox alongside the other NBI user preferences (explain-error, output-followup, output-toolbar). Wires the value through the standard admin-policy triad so deployments can pin it via NBI_REFRESH_OPEN_FILES_ON_DISK_CHANGE_POLICY or the matching traitlet. The watcher's isEnabled callback now reads NBIAPI.config.featurePolicies on every tick, so a user toggle in the Settings dialog takes effect without a Lab restart (capabilities refetch after each setConfig). Closes plmbr#337.
mbektas
approved these changes
May 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Issue #337 asks that the
refresh_open_files_on_disk_changesetting (introduced in #330) live in NBI's own config and Settings dialog rather than JupyterLab's Settings Editor, for consistency with the other user-toggleable booleans (enable_explain_error,enable_output_followup,enable_output_toolbar). This PR relocates it.Solution
The setting now lives in
~/.jupyter/nbi/config.json(read viaNBIConfig.refresh_open_files_on_disk_change) and renders as a checkbox in a new External changes section of the NBI Settings dialog. It is wired through the standard admin-policy triad: aFEATURE_POLICY_SPECentry, aTraitletEnum, and aNBI_REFRESH_OPEN_FILES_ON_DISK_CHANGE_POLICYenv var, so deployments can pin itforce-on/force-offwithout touching code.Key changes:
notebook_intelligence/extension.py:FEATURE_POLICY_SPECentry, newrefresh_open_files_on_disk_change_policyTraitletEnum,_build_feature_policies_responseuser value,ConfigHandler.valid_keys+locked_keysgating.notebook_intelligence/config.py:refresh_open_files_on_disk_changeproperty (defaultTrue).src/api.ts: extendsFeaturePolicyNameunion, thefeaturePoliciesgetter, and thedefaultOpenset so the watcher's boot-window read survives until capabilities land.src/index.ts: the watcher'sisEnabledcallback now re-reads NBI capabilities every tick, so toggling in the Settings dialog applies without a Lab restart.src/components/settings-panel.tsx: new "External changes" section with aCheckBoxItemthat honorsfeaturePolicies.refresh_open_files_on_disk_change.locked.schema/plugin.json: removed the orphan property (the schema retainsjupyter.lab.toolbarsandjupyter.lab.shortcutsblocks).docs/admin-guide.mdsection.Note that the prior home for this setting was only exposed in 5.0.0-alpha, so a runtime migration of stale JL Settings Registry values is not included; an alpha user who toggled it
falsewill revert to the defaulttrueand can opt out again in the new dialog.Testing
pytest tests/ --ignore=tests/test_claude_client.py -q: 1066 passed.jlpm tsc --noEmit: clean.jlpm lint:check: clean.jlpm jest: 281 passed.tests/test_cell_output_features_response.pypin the capabilities-response shape acrossuser-choice,force-on, andforce-off.~/.jupyter/nbi/config.jsonand the capabilities response, andNBI_REFRESH_OPEN_FILES_ON_DISK_CHANGE_POLICY=force-offcorrectly disables the checkbox and returns{enabled: false, locked: true}.Two reviewer rounds (six agents each: three /simplify and three persona reviewers covering JL extension lifecycle, frontend a11y, and API contract). All
fix-before-mergefindings were applied in round 2; remaining notes are scoped as follow-ups.Risks / follow-ups
featurePoliciesgetter insrc/api.tsallocates per call; the watcher tick reads it every 3 s. Round 2 efficiency review confirmed this is sub-microsecond and dwarfed by the watcher's own filesystem fan-out. A future pass could memoize the getter againstthis.capabilitiesidentity for broader benefit, but it isn't load-bearing for this change.model-config-section-headeris a styled<div>rather than a semantic heading; this is pre-existing across the whole Settings dialog and out of scope here.Screenshots
Default (unlocked, checked) and
force-off(locked, disabled) attached locally atnbi-settings-external-changes.pngandnbi-settings-force-off-locked.png; will drop into this description via the web UI.Closes #337.