mirror of
https://github.com/headroomlabs-ai/headroom.git
synced 2026-11-22 15:10:00 +08:00
## What changes `headroom wrap claude|codex|grok|opencode` no longer registers Serena by default. | | Before | After | |---|---|---| | Default | Serena registered | No code-memory MCP | | Opt in | (default) | `--code-memory serena` or `HEADROOM_CODE_MEMORY=serena` (deprecated `--serena` still works) | | Opt out | `--code-memory none` / `--no-serena` | Still accepted | | Upgrading user, Serena installed by Headroom | Kept | Removed on next wrap, with the message "Serena is now off by default; pass --code-memory serena to keep it" | | Upgrading user, Serena added by hand | Kept | Kept, no message (shown only with `--verbose` or an explicit opt-out) | OpenCode now accepts `--code-memory` and uses the same setup path as the other agents. Its `--no-serena` flag is hidden and deprecated. ## Why Measured on 2026-10-27, Serena started exactly as `wrap` registers it: - It adds 22 tools, about 5.9K tokens of tool definitions on every request where tools aren't deferred. Its server instruction tells the model to call `initial_instructions`, which costs another 2K tokens. - Each launch takes about 6 s cold via `uvx`, plus a background `serena project index` that starts language servers. It also writes a `.serena/` folder into the user's repo. - Serena was registered in 6 of our own Claude Code sessions and called 0 times. Separately, an offline replay of about 108K tool calls found that symbol-level reads have little to recover for Claude Code. ## Not in this PR - `headroom.integrations.strands` still defaults `enable_serena_mcp=True`. It's public integration API, so it needs a deprecation step instead of a silent flip. - The opt-in `--serena-instructions` block in CLAUDE.md/AGENTS.md is never removed, by unwrap or anything else. Users who opted into it keep instructions that point at tools no longer registered. This predates this PR and will be fixed separately. - For Claude Code, Serena entries are per project, so removal happens the next time `wrap` or `unwrap` runs in each project. The docs say so. ## Tests - `pytest tests/test_wrap_code_memory.py tests/test_cli tests/test_mcp_registry`: 1368 passed. 5 failed, and those 5 fail the same way on `main` in my local venv: `test_mcp_reconcile.py::test_ordinary_install_does_not_adopt_serena` and 4 in `test_wrap_persistent.py`, all from an environment/install mismatch. - New tests: - The default wrap removes a Serena entry Headroom installed and prints how to keep it. - The default wrap leaves a hand-added Serena alone and prints nothing. - `--serena --no-serena` resolves to none. - `wrap opencode --code-memory serena` registers Serena with the `agent` context. - `ruff check`, `ruff format --check` and `mypy` are clean on the changed files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) ## Real Behavior Proof - **Environment:** macOS (Darwin 27.2), Python 3.12.13, Claude Code 2.1.318, real `claude` CLI doing every `claude mcp add`/`remove`. A temporary `HOME`, so `~/.claude.json` starts empty, and a fresh git repo per case. - **Builds:** "before" = `main` at `12864fc8`; "after" = this PR at `56557dc9`. - **Command:** `headroom wrap claude --no-proxy [flags] -- --version`. Wrap does its full MCP setup, then launches Claude Code, which prints its version and exits, so no model call is made. `state` is read from `~/.claude.json` (user scope and this project's local scope) and the project's `.mcp.json` after each run. ``` == 1. Upgrade: Serena installed by Headroom (project/local scope) $ headroom wrap claude --no-proxy -- --version (cwd=projA, build=12864fc8) exit=0 wrap| Serena MCP: registered (restart Claude Code if it was already running) wrap| scoped to this project — pass --code-memory-scope user to register it for every Claude Code session wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projA): ['serena'] | .mcp.json: - $ headroom wrap claude --no-proxy -- --version (cwd=projA, build=56557dc9) exit=0 wrap| Removed previously-installed Serena MCP (Serena is now off by default; pass --code-memory serena to keep it) wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projA): - | .mcp.json: - == 2. Upgrade: Serena added by hand (claude mcp add) state| user: ['headroom'] | local(projB): ['serena'] | .mcp.json: - $ headroom wrap claude --no-proxy -- --version (cwd=projB, build=56557dc9) exit=0 wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projB): ['serena'] | .mcp.json: - $ headroom wrap claude --no-proxy --code-memory none -- --version (cwd=projB, build=56557dc9) exit=0 wrap| Serena MCP is present but user-managed — leaving it in place (Headroom only removes entries it installed) wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projB): ['serena'] | .mcp.json: - == 3. Explicit opt-in, then rollback to the default $ headroom wrap claude --no-proxy --code-memory serena -- --version (cwd=projC, build=56557dc9) exit=0 wrap| Serena MCP: registered (restart Claude Code if it was already running) wrap| scoped to this project — pass --code-memory-scope user to register it for every Claude Code session wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projC): ['serena'] | .mcp.json: - $ headroom wrap claude --no-proxy -- --version (cwd=projC, build=56557dc9) exit=0 wrap| Removed previously-installed Serena MCP (Serena is now off by default; pass --code-memory serena to keep it) wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projC): - | .mcp.json: - $ headroom wrap claude --no-proxy -- --version (cwd=projC, build=56557dc9) exit=0 wrap| Serena MCP: registered (restart Claude Code if it was already running) wrap| scoped to this project — pass --code-memory-scope user to register it for every Claude Code session wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projC): ['serena'] | .mcp.json: - $ headroom wrap claude --no-proxy --serena -- --version (cwd=projC, build=56557dc9) exit=0 wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projC): ['serena'] | .mcp.json: - == 4. User scope: installed by Headroom with --code-memory-scope user $ headroom wrap claude --no-proxy --code-memory-scope user -- --version (cwd=projD, build=12864fc8) exit=0 wrap| Serena MCP: registered (restart Claude Code if it was already running) wrap| registered for every Claude Code session on this machine (--code-memory-scope user) wrap| 2.1.318 (Claude Code) state| user: ['headroom', 'serena'] | local(projD): - | .mcp.json: - $ headroom wrap claude --no-proxy -- --version (cwd=projD, build=56557dc9) exit=0 wrap| Removed previously-installed Serena MCP (Serena is now off by default; pass --code-memory serena to keep it) wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projD): - | .mcp.json: - == 5. User scope opt-in on the PR build $ headroom wrap claude --no-proxy --code-memory serena --code-memory-scope user -- --version (cwd=projE, build=56557dc9) exit=0 wrap| Serena MCP: registered (restart Claude Code if it was already running) wrap| registered for every Claude Code session on this machine (--code-memory-scope user) wrap| 2.1.318 (Claude Code) state| user: ['headroom', 'serena'] | local(projE): - | .mcp.json: - $ headroom wrap claude --no-proxy -- --version (cwd=projE, build=56557dc9) exit=0 wrap| Removed previously-installed Serena MCP (Serena is now off by default; pass --code-memory serena to keep it) wrap| 2.1.318 (Claude Code) state| user: ['headroom'] | local(projE): - | .mcp.json: - ``` What this shows: 1. A Serena entry Headroom installed on `main` is removed on the first wrap after upgrading, with the "off by default" message. This holds for both scopes (cases 1 and 4). 2. A hand-added Serena entry is kept, and the default wrap prints nothing. `--code-memory none` keeps it and says it's user-managed (case 2). 3. Opting in works with `--code-memory serena`, `HEADROOM_CODE_MEMORY=serena` and the deprecated `--serena`, at project scope and user scope (cases 3 and 5). Running the default afterwards rolls it back. 4. Project scope here means Claude Code's `local` scope, which is where wrap registers. Wrap never writes `.mcp.json`. Not tested live: `wrap codex|grok|opencode` (unit tests only), Windows, and an interactive Claude session that calls Serena tools. <!-- devin-review-badge-begin --> --- <a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4509" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4" alt="Devin Review"></picture></a> <!-- devin-review-badge-end --> ## Maintainer post-merge qualification Published `983b6bb15119a3ecb8f6e20bf014b8bed123e95d` includes upstream main `e4a60ed72f6ef5b28569f8bfbe2163cfda32c948`. 19 selector/Serena tests pass,1optional skip; Ruff/format/diff pass. Clean main sync; contributor selector/ownership code unchanged. Existing real upgrade/configuration/launch proof requirement remains; jCodeMunch proposal is unrelated to this source delta. Contributor correctness logic was not rewritten. Existing Changes Requested decision retained without duplicate findings. Scoped Windows validation uses the existing development native extension, not a fresh build. Hosted qualification is handled by maintainers; nothing merged. ### Maintainer current-main requalification Exact head `e8e3011187a2ffdfbb6c9932db26b22ec911ab39`, upstream main `ecbaf86d78cf52d185fbffa306157b9a4cc1b906`. Mechanically updated from upstream/mainecbaf86d78without changing contributor selector/ownership logic. Reviewed the current discussion and integration delta. All 29 focused code-memory/Serena-disable/Gemini tests pass with one optional skip; Ruff0.17.3 lint/format and whitespace checks pass. Existing Windows HOME/USERPROFILE fixture isolation remains intact. The prior upgrade/runtime qualification requirement remains unresolved: post-patch real configuration/launch evidence must cover an existing Headroom-owned Serena entry, a hand-managed entry, explicit opt-in, and Claude project/user scopes, with commands/results and untested-agent limits. No new author evidence was found to close it. This pass does not claim those actual launch/upgrade flows were executed; passing unit tests and the main sync do not establish that deployment behavior. The hold is not an inherited-main CI defect. Maintainers handle hosted checks; no contributor CI execution requested. Nothing merged. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `0b49a79cb192b294dde7ecb1c72b75fffa2733d5`, upstream main `8d3e9e5ca7cd645eb73084b848edbea5fc796e1a`. Clean mechanical sync with upstream main8d3e9e5ca7cd645eb73084b848edbea5fc796e1a without changing contributor selector/ownership logic. Current source, author discussion and Devin findings reviewed.29focused code-memory/Serena-disable/Gemini tests pass with1optional skip; changed Python Ruff0.17.3check/format and whitespace pass. Windows HOME/USERPROFILE fixture isolation preserved. Existing real upgrade/runtime qualification remains missing: existing Headroom-owned Serena versus hand-managed entry, explicit opt-in, and Claude project/user scopes need observed configuration/launch results with explicit untested-agent limits. No new evidence found to close it; these launch/upgrade paths were not executed in this pass. Passing unit tests and clean main integration do not establish deployment behavior. No new provider/native-build claim or inherited-main pipeline attribution. Maintainers handle hosted checks; nothing merged. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `30dfb386fa7284c9817bf5d7db0648fb10830055`, upstream main `7592e681459f14a2041eb5f524a658cb6ad1dd92`. Clean current-main sync7592e681459f14a2041eb5f524a658cb6ad1dd92,including HNSW re-index and memory relation-key fixes after917release-recovery merge. Contributor selector/ownership logic unchanged; fresh discussion considered.37wrapper/Serena/memory-regression/Gemini tests pass with1optional skip;whitespace passes. PriorRuff0.17.3validation applies to unchanged PR files. Existing real upgrade/launch evidence hold remains: Headroom-owned versus hand-managed Serena entries,explicitoptin,andClaudeproject/userscopes need observedpostpatchresults. No newevidence closesit;actualupgrade/launch pathsnotrerun. No freshnativebuild/provider claim. MaintainershandleCI;nothingmerged. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `e1778a5368626547ad958926d5570edf153182f6`, upstream main `2d3ee51846435ef5b320eea4806af14e602b0d8c`. Clean integration with upstream/main2d3ee51846after the external 0.43.1 release merge. Exact headroom/crates/tests comparison against previously reviewed30dfb386fshows no changes. Re-reviewed generated metadata; 78 release/version/MCP tests pass on this tree and whitespace passes. Earlier 37 wrapper/Serena/memory/Gemini passes and one optional skip remain scoped to unchanged inputs. Existing actual upgrade/launch proof hold remains: Headroom-owned versus hand-managed Serena entries, explicit opt-in, and Claude project/user scopes need observed postpatch results. Those runtime paths were not rerun and no new evidence closes the hold. No contributor ownership policy changed, no fresh native-build/provider claim. Maintainers handle checks; nothing merged. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `173c5739d7357ca9398faa41b4d1ce3b72d6c550`, upstream main `7877241d84c93b3ec487e07324245838ddae85cc`. Cleanly integrated upstream/main7877241d84c93b3ec487e07324245838ddae85cc and re-reviewed the wrapper overlap with Hermes registration and port discovery.35 selector/Serena-disable/Hermes provider and wrapper tests pass,1optional skip; Ruff and whitespace pass. Contributor ownership/default policy is unchanged. Existing actual upgrade/configuration/launch proof requirement remains open for Headroom-owned versus user-managed entries, explicit opt-in, and Claude project/user scopes. No runtime proof is inferred from mocks or native-build claim made. Maintainers handle hosted checks; nothing merged. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `eb1c3d66669cf71f881f1ba06dc049d36b20da7b`, upstream main `c01cf07d943d816cfd9d97e6838ed4e38f1ff9a4`. Final post-Dependabot requalification against upstream/mainc01cf07d94. All six Dependabot updates are now merged. Relative to this branch's freshly tested prepared tree, the final main sync changes only the three intended Cargo.lock records; Python/source/test inputs are unchanged. Re-reviewed the integration and confirmed complete native source/lock/toolchain objects match the tested combined build and exact fresh native DLL used for this branch's local tests. Focused fresh-native qualification: 35 passed, 1 skipped in 2.93s. Selected real dependency overlays and native DLL paths are recorded in final4509-fresh-native-tests.log; the DLL provenance/input hashes are in final-native-artifact-proof.json. No redundant rerun is implied after this Cargo-only merge. Whitespace passes. Prior source review and scoped real-behavior evidence remain applicable to unchanged contributor inputs. Existing real upgrade/configuration/launch qualification remains open for Headroom-owned versus user-managed Serena entries, explicit opt-in/rollback, and Claude project/user scopes. No new author evidence closes it; contributor ownership/default policy is unchanged. Maintainers handle hosted checks; no external-provider claim, contributor semantic rewrite or non-Dependabot merge. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `43bfea8a164c21ab69793b3905fbf1457fef7bc2`, upstream main `da6d9736cd82074988c7d0a2360b49d9d8b6c0a0`. Current-main requalification againstda6d9736cd. All69 integration patches exactly match c01cf07-to-current-main delta after diff-location normalization; contributor selector/default/Serena ownership logic unchanged.162 focused code-memory,Serena disable,Hermes,Windows supervisor,search-compressor tests pass;3 platform/optional skips. All31 changed Python files pass Ruff lint/format; offline lock and whitespace pass. Native pr3982 DLL verified against complete tracked native-input hash proof and artifact checksum; no fresh native-build claim. Author/Devin discussion checked. Existing real upgrade/configuration/launch qualification remains open: prior Headroom-owned Serena entry versus user-managed entry, explicit opt-in/rollback, Claude project/user scopes. No new author evidence closes it; this run does not assert actual agent launch or deployment proof. Maintainers handle hosted checks; no contributor policy rewrite or merge. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. ### Maintainer current-main requalification Exact head `56557dc91725422257f90c3cb5c5f04a665e6043`, upstream main `0ddaa56c21cdc01c4774391fdcc69e987ecc4e5c`. Clean integration with upstream/main0ddaa56c21. All 19 integration patches exactly match the prior-reviewed-mainda6d9736to current-main delta after diff-location normalization; contributor selector/default/Serena ownership logic is unchanged. Fresh code-memory/Serena disable/scope/reconciliation/migration, doctor and incoming Vertex/backend/CLI tests: 330 passed, 12 skipped, 1 warning. Fourteen changed Python files pass Ruff lint/format; offline lock and whitespace checks pass. Author/Devin discussion read. Existing real upgrade/configuration/launch qualification remains open: prior Headroom-owned entry versus user-managed entry, explicit opt-in/rollback, Claude project/user scopes. This run establishes no actual agent launch or deployment proof. Static source/test scope and security inspection found no new workflow, dependency or setup path; the inherited flagged workflow-validation job is excluded by the exact PR's unchanged workflow paths. Native DLL reused after complete tracked input-set/hash and artifact-checksum verification; no fresh build claimed. Maintainers handle exact-head hosted checks; no PR merged. Exact-head hosted checks are being handled by maintainers. Existing correctness/qualification holds remain; nothing merged. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: JD Davis <mxjerrett@gmail.com>
157 lines
5.9 KiB
Python
157 lines
5.9 KiB
Python
"""`--no-serena` must actively disable Serena, not merely skip adding it.
|
|
|
|
Earlier releases installed Serena by default, so a prior `headroom wrap`
|
|
persisted a `serena` MCP entry and the agent keeps launching it (dashboard
|
|
popup and all). These tests pin that a later `--no-serena` or a default wrap
|
|
removes the entry Headroom installed, leaves a user-managed entry alone, and
|
|
that Codex unwrap also removes Serena.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pathlib import Path
|
|
from unittest.mock import patch
|
|
|
|
import pytest
|
|
from click.testing import CliRunner
|
|
|
|
from headroom.cli import wrap as wrap_cli
|
|
from headroom.cli.main import main
|
|
from headroom.mcp_registry import build_serena_spec
|
|
from headroom.mcp_registry.base import ServerSpec
|
|
from headroom.mcp_registry.ledger import record_install
|
|
|
|
|
|
@pytest.fixture
|
|
def runner() -> CliRunner:
|
|
return CliRunner()
|
|
|
|
|
|
class _FakeRegistrar:
|
|
"""Minimal registrar capturing unregister calls."""
|
|
|
|
def __init__(self, name: str, *, detected: bool = True, server: ServerSpec | None = None):
|
|
self.name = name
|
|
self.display_name = name.capitalize()
|
|
self._detected = detected
|
|
self._server = server
|
|
self.unregistered: list[str] = []
|
|
|
|
def detect(self) -> bool:
|
|
return self._detected
|
|
|
|
def get_server(self, server_name: str) -> ServerSpec | None:
|
|
return self._server if server_name == "serena" else None
|
|
|
|
def unregister_server(self, server_name: str) -> bool:
|
|
self.unregistered.append(server_name)
|
|
self._server = None
|
|
return True
|
|
|
|
|
|
def test_disable_removes_headroom_installed_serena(
|
|
monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
) -> None:
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
spec = build_serena_spec("claude-code")
|
|
record_install("claude", spec) # ledger now proves Headroom owns it
|
|
registrar = _FakeRegistrar("claude", server=spec)
|
|
|
|
wrap_cli._disable_serena_mcp(registrar, verbose=True)
|
|
|
|
assert registrar.unregistered == ["serena"]
|
|
assert "Removed previously-installed Serena MCP" in capsys.readouterr().out
|
|
|
|
|
|
def test_disable_preserves_user_managed_serena(
|
|
monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
) -> None:
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
# Present in the agent config but NOT in Headroom's ledger → user-owned.
|
|
user_spec = ServerSpec(name="serena", command="/usr/local/bin/custom-serena")
|
|
registrar = _FakeRegistrar("claude", server=user_spec)
|
|
|
|
wrap_cli._disable_serena_mcp(registrar, verbose=True)
|
|
|
|
assert registrar.unregistered == [] # never touch a user-managed entry
|
|
assert "user-managed" in capsys.readouterr().out
|
|
|
|
|
|
def test_disable_noop_when_serena_absent(
|
|
monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
) -> None:
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
registrar = _FakeRegistrar("claude", server=None)
|
|
|
|
wrap_cli._disable_serena_mcp(registrar, verbose=True)
|
|
|
|
assert registrar.unregistered == []
|
|
assert "Skipping Serena MCP (--code-memory none" in capsys.readouterr().out
|
|
|
|
|
|
def test_disable_noop_when_agent_not_detected(
|
|
monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
|
) -> None:
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
spec = build_serena_spec("claude-code")
|
|
record_install("claude", spec)
|
|
registrar = _FakeRegistrar("claude", detected=False, server=spec)
|
|
|
|
wrap_cli._disable_serena_mcp(registrar, verbose=True)
|
|
|
|
assert registrar.unregistered == [] # not detected → leave everything alone
|
|
|
|
|
|
def test_unwrap_codex_removes_headroom_installed_serena(
|
|
runner: CliRunner, monkeypatch: pytest.MonkeyPatch, tmp_path: Path
|
|
) -> None:
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
spec = build_serena_spec("codex")
|
|
record_install("codex", spec)
|
|
registrar = _FakeRegistrar("codex", server=spec)
|
|
|
|
with (
|
|
patch("headroom.mcp_registry.CodexRegistrar", return_value=registrar),
|
|
patch(
|
|
"headroom.cli.wrap._restore_codex_provider_config",
|
|
return_value=("noop", tmp_path / "config.toml"),
|
|
),
|
|
patch("headroom.cli.wrap._stop_local_proxy_for_unwrap"),
|
|
):
|
|
result = runner.invoke(main, ["unwrap", "codex"])
|
|
|
|
assert result.exit_code == 0, result.output
|
|
assert registrar.unregistered == ["serena"]
|
|
assert "Removed Headroom-installed Serena MCP server from Codex" in result.output
|
|
|
|
|
|
def test_default_wrap_removes_headroom_installed_serena_and_says_how_to_keep_it(
|
|
monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
) -> None:
|
|
# Serena is off by default now: an upgrading user's Headroom-installed entry
|
|
# is removed on the next wrap, with the way to opt back in.
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
monkeypatch.delenv("HEADROOM_CODE_MEMORY", raising=False)
|
|
spec = build_serena_spec("claude-code")
|
|
record_install("claude", spec)
|
|
registrar = _FakeRegistrar("claude", server=spec)
|
|
|
|
wrap_cli._setup_coding_compressor(registrar, serena_context="claude-code")
|
|
|
|
assert registrar.unregistered == ["serena"]
|
|
assert "pass --code-memory serena to keep it" in capsys.readouterr().out
|
|
|
|
|
|
def test_default_wrap_leaves_user_managed_serena_silently(
|
|
monkeypatch: pytest.MonkeyPatch, tmp_path: Path, capsys: pytest.CaptureFixture[str]
|
|
) -> None:
|
|
# A Serena the user registered is theirs: kept, and no notice on every wrap.
|
|
monkeypatch.setenv("HEADROOM_WORKSPACE_DIR", str(tmp_path / ".headroom"))
|
|
monkeypatch.delenv("HEADROOM_CODE_MEMORY", raising=False)
|
|
registrar = _FakeRegistrar("claude", server=ServerSpec(name="serena", command="serena"))
|
|
|
|
wrap_cli._setup_coding_compressor(registrar, serena_context="claude-code")
|
|
|
|
assert registrar.unregistered == []
|
|
assert "Serena" not in capsys.readouterr().out
|