fix: keep a home value that is not a path off disk, and re-apply from the own home (release review)

getCustomModelForPersist() trusted homeEnvVar to name a path, but the registry
types it as any env name, so a clis.json override could write a session's own
credential to state.json. Only an absolute path is written now.

A re-apply resolved the CLI's real home from what the session's map held, which
under a selection is the injected directory, and recovery resolved none at all.
An entry the own home lacks (settings.yaml) was then linked from the server's
home on an endpoint switch and on recovery. The route now reads the new
Session.ownEnvValue(), and recovery reads the clamped record through the same
bounded guard, under the bulk cap since it walks every saved session. Also
corrects the comment that said only a removed directory gets its links again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Codeman maintainer committed 2026-11-06 02:39:11 +01:00
1 parent 10d43b993e
commit db5222c4fa
9 files changed
+149 -27

No files matched your search

+3 -2
View File
@@ -711,8 +711,9 @@ export interface CustomModelBookkeeping extends CustomModelSelection {
/**
* What the session itself had set under keys the selection replaced, put back when the
* selection goes. In memory this can hold a credential (a session's own `GEMINI_API_KEY`),
* so `Session.getCustomModelForPersist()` writes `homeEnvVar`'s entry and nothing else:
* tmux keeps only the injected value, so state.json is the one copy left after a restart.
* so `Session.getCustomModelForPersist()` writes `homeEnvVar`'s entry, when it is an absolute
* path, and nothing else: tmux keeps only the injected value, so state.json is the one copy
* left after a restart.
*/
ownEnv?: Record<string, string>;
}