Describe the bug
GeminiClientAdapter resolves .gemini/settings.json from os.getcwd() instead of the adapter's project_root / scope-aware path context. When callers instantiate the adapter with project_root=..., MCP config is skipped or written under the current process cwd rather than the target project. This breaks non-cwd installs and makes Gemini inconsistent with other repo-local MCP adapters.
To Reproduce
Steps to reproduce the behavior:
- From a checkout that is not the target project, run:
from pathlib import Path
from tempfile import TemporaryDirectory
from apm_cli.adapters.client.gemini import GeminiClientAdapter
with TemporaryDirectory() as tmp:
root = Path(tmp)
(root / ".gemini").mkdir()
adapter = GeminiClientAdapter(project_root=root)
adapter.update_config({"srv": {"command": "node"}})
print("expected exists:", (root / ".gemini" / "settings.json").exists())
print("actual adapter path:", adapter.get_config_path())
- Observe that
expected exists is False.
- Observe that
get_config_path() points at <cwd>/.gemini/settings.json.
Expected behavior
GeminiClientAdapter(project_root=root) should read and write root/.gemini/settings.json. If user scope is supported, user-scope behavior should be explicit and consistent with the target profile rather than silently using cwd.
Environment (please complete the following information):
- OS: Darwin 25.4.0 arm64
- Python Version: 3.12.12
- APM Version: 0.13.0 (9020aca)
- VSCode Version (if relevant): N/A
Logs
Current code path:
src/apm_cli/adapters/client/gemini.py uses Path(os.getcwd()) in get_config_path().
update_config() also gates on Path(os.getcwd()) / ".gemini".
Observed local repro:
expected_exists False
adapter_path /Users/ko1/.codex/worktrees/7541/apm/.gemini/settings.json
Additional context
This appears separate from #1266, which covers Gemini stdio env placeholder resolution, and #1062, which covered Gemini opt-in behavior. This issue is specifically about path/scope routing: adapter construction accepts project_root, but Gemini ignores it.
Describe the bug
GeminiClientAdapterresolves.gemini/settings.jsonfromos.getcwd()instead of the adapter'sproject_root/ scope-aware path context. When callers instantiate the adapter withproject_root=..., MCP config is skipped or written under the current process cwd rather than the target project. This breaks non-cwd installs and makes Gemini inconsistent with other repo-local MCP adapters.To Reproduce
Steps to reproduce the behavior:
expected existsisFalse.get_config_path()points at<cwd>/.gemini/settings.json.Expected behavior
GeminiClientAdapter(project_root=root)should read and writeroot/.gemini/settings.json. If user scope is supported, user-scope behavior should be explicit and consistent with the target profile rather than silently using cwd.Environment (please complete the following information):
Logs
Current code path:
src/apm_cli/adapters/client/gemini.pyusesPath(os.getcwd())inget_config_path().update_config()also gates onPath(os.getcwd()) / ".gemini".Observed local repro:
Additional context
This appears separate from #1266, which covers Gemini stdio env placeholder resolution, and #1062, which covered Gemini opt-in behavior. This issue is specifically about path/scope routing: adapter construction accepts
project_root, but Gemini ignores it.