fix: point the `warehouse_list` no-connections hint at the real config locations
Issue for this PR
Closes #1558
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
warehouse_list told users with no connections to create connections.json in .opencode/, which the registry never reads (observed in agent sessions: the file was written there and ignored). Even with the right path, the registry latched on first load, so a file created after an empty answer stayed invisible until restart.
- The hint now leads with
warehouse_add(credential-store backed), then lists the real sources:~/.altimate-code/connections.json, the project.altimate-code/connections.jsonandALTIMATE_CODE_CONN_<NAME>, keeps the example JSON, and notes credentials can come from the env var instead of a plaintext password. Paths come fromglobalConfigPath()/localConfigPath()/CONN_ENV_PREFIX, now exported from the registry, so the hint cannot drift. - Narrow reload rule: the registry re-reads its sources only while it holds zero connections (the case the hint addresses). The project-local file is re-read only when the current project is the one the registry was first loaded for; the global file and env are process-wide. Once any connection is loaded nothing is replaced or closed, so edits to an existing file take effect after a restart, which the hint says.
setConfigs()injections are not reloaded. An earlier fingerprint-based auto-reload was dropped because it could replace the process-global map across projects and lose keyring-less in-memory credentials. - Known limitation (out of scope, pre-existing): the registry is process-global, so a server serving several directories applies the first load's project-local file to all; per-directory keying is a larger design change.
- A repo sweep found no other reference to the old location; docs already name the correct paths.
Behavior delta: while the registry is empty, each registry access re-reads two small files and the env (was: once per process). No change once a connection exists.
How did you verify your code works?
test/altimate/warehouse-list-hint.test.ts(9 tests): the message names the registry-computed paths and prefix; a file at the named path is loaded;.opencode/is not; through the realwarehouse_listtool, a connection created (file or env var) after an empty answer is listed in the same process and visible toRegistry.getConfig; with a connection loaded, editing the file does not replace the configs; a populated registry is not clobbered when the working project changes; an empty registry first loaded for project A does not pick up project B's file (same-project still works);setConfigsstate is kept.- 59 test files referencing the registry or
warehouse_list: 2414 pass, 0 fail. bun run typecheckclean;script/upstream/analyze.ts --markers --base main --strictclean.- Local read-only Codex review (gpt-6.1-sol) of head 434a319f34: no P0/P1.
Cost side effects
None. No model calls, warehouse queries or cloud resources are added.
Screenshots / recordings
N/A (text output of a tool).
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
- I checked for cost side effects (model calls, queries or cloud resources that grow with user data) and described them, or wrote "none"
🤖 Generated with Claude Code
Summary by CodeRabbit
- Bug Fixes
- The empty warehouse list message now explains the supported global, project, and environment-variable connection sources, their precedence, and how to add a connection using the applicable configuration path.
- After an empty warehouse result, newly added connection files and environment variables are recognized on subsequent access. Already-loaded or explicitly provided configurations remain unchanged across file edits or project changes.
[!NOTE]
Medium Risk
Changes process-global connection discovery and reload rules; scoped to empty-registry cases but affects when configs appear without restart.
Overview
Fixes warehouse_list telling users to create connections.json under .opencode/, which the connection registry never reads. The empty-state output now comes from noConnectionsMessage(), which prefers warehouse_add, lists the real sources via exported globalConfigPath(), localConfigPath(), and CONN_ENV_PREFIX, documents precedence and env-based secrets, and explicitly says not to use .opencode/.
The connection registry gains a narrow reload: while it holds zero connections (and configs were not setConfigs-injected), ensureLoaded() re-reads global config, env, and—only when projectConfigApplies()—the project-local file tied to the first loaded project. Once any connection is loaded, behavior is unchanged (file edits need a restart). load(includeProjectConfig) and loadedProjectDir stop an empty registry from picking up another project’s local file when the working directory changes.
Adds warehouse-list-hint.test.ts covering hint text, load paths, same-process pickup after the hint, and multi-project / injection edge cases.
Reviewed by Cursor Bugbot for commit 10ba54c5b06560e5fada9a5beca13984ee14d67f. Bugbot is set up for automated code reviews on this repo. Configure here.