fix(install): drop semantic-search leftovers when local search is off
CI / CI configuration security checks (push) Successful in 2s
CI / Capabilities and shell quality (push) Successful in 17s
CI / Python tests and compilation (push) Successful in 30s
CI / QMD unit tests (push) Successful in 5s
CI / Build and inspect generated packages (push) Successful in 17s
CI / PowerShell tests on Ubuntu (push) Successful in 1m25s
CI / Installed client configuration smoke tests (push) Successful in 48s
CI / Bash integration and installation guards (push) Successful in 1m10s

Disabling local QMD search now removes the qmd-search sandbox exclusion,
also from existing settings on update. Agent instructions mention semantic
search only as available when installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Julian LechnerandClaude Opus 5.5 committed 2026-11-16 13:55:27 +01:00
1 parent 477e792f97
commit 53511937b0
6 files changed
+28 -3

No files matched your search

+11
View File
@@ -58,6 +58,12 @@ def filter_options(path, flashbang_enabled=True, statusline_enabled=True, semant
settings['hooks']['SessionStart'] = remaining
else:
settings.get('hooks', {}).pop('SessionStart', None)
sandbox = settings.get('sandbox', {})
excluded = [command for command in sandbox.get('excludedCommands', []) if 'qmd-search.mjs' not in command]
if excluded:
sandbox['excludedCommands'] = excluded
else:
sandbox.pop('excludedCommands', None)
if not statusline_enabled:
settings.pop('statusLine', None)
return json.dumps(settings, indent=2, ensure_ascii=False) + '\n'
@@ -109,6 +115,11 @@ def merge_json(current, managed):
result = dict(current)
if 'statusLine' not in managed:
result.pop('statusLine', None)
sandbox = result.get('sandbox')
if isinstance(sandbox, dict) and isinstance(sandbox.get('excludedCommands'), list):
# The QMD exclusion is owned; managed settings re-add it only while semantic retrieval is enabled.
excluded = [command for command in sandbox['excludedCommands'] if 'qmd-search.mjs' not in str(command)]
result['sandbox'] = dict(sandbox, excludedCommands=excluded) if excluded else {k: v for k, v in sandbox.items() if k != 'excludedCommands'}
for key, value in managed.items():
if key == 'hooks' and isinstance(value, dict) and isinstance(result.get(key), dict):
hooks = dict(result[key])
+13
View File
@@ -99,6 +99,19 @@ class InstallOptionsTests(unittest.TestCase):
commands = [hook['command'] for group in result['hooks']['SessionStart'] for hook in group['hooks']]
self.assertEqual(commands, ['bash "/c/hooks/scripts/show-session-state-pointer.sh"'])
def test_semantic_retrieval_disabled_removes_qmd_sandbox_exclusion(self):
with tempfile.TemporaryDirectory() as directory:
settings = Path(directory) / 'settings.json'
qmd = 'node "$HOME/.my-ai-configuration/qmd/qmd-search.mjs" *'
settings.write_text(json.dumps({'sandbox': {'enabled': True, 'excludedCommands': [qmd, 'docker *']}}), encoding='utf-8')
self.assertEqual(json.loads(OPTIONS.filter_options(settings, semantic_retrieval_enabled=False))['sandbox']['excludedCommands'], ['docker *'])
settings.write_text(json.dumps({'sandbox': {'enabled': True, 'excludedCommands': [qmd]}}), encoding='utf-8')
self.assertEqual(json.loads(OPTIONS.filter_options(settings, semantic_retrieval_enabled=False))['sandbox'], {'enabled': True})
self.assertEqual(json.loads(OPTIONS.filter_options(settings, semantic_retrieval_enabled=True))['sandbox']['excludedCommands'], [qmd])
current = {'sandbox': {'enabled': True, 'excludedCommands': [qmd, 'docker *']}}
self.assertEqual(OPTIONS.merge_json(current, {'sandbox': {'enabled': True}})['sandbox']['excludedCommands'], ['docker *'])
self.assertEqual(OPTIONS.merge_json(current, {'sandbox': {'excludedCommands': [qmd]}})['sandbox']['excludedCommands'], [qmd, 'docker *'])
def test_semantic_retrieval_disabled_removes_codex_session_hook(self):
with tempfile.TemporaryDirectory() as directory:
config = Path(directory) / 'config.toml'