Summary
packages/utils now resolves the authoritative home at call time (#4761 / #4772): getTrustedHomeDir(), getConfigRootDir(), getAgentDir() and friends re-derive on every access and rebuild their caches when the home changes. Several downstream consumers still capture a home-derived path into a module-level constant at import time, so they keep pointing at the home that was in effect when their module first loaded.
Concrete instance:
// packages/ai/src/auth-broker/remote-store.ts:78
const DEFAULT_PRESENTATION_SIDECAR = path.join(getConfigRootDir(), "auth-broker-presentations.json");
getConfigRootDir() is call-time; the constant built from it is not.
Why it matters
This is the same shape as the original #4761 defect, one layer out. If the resolved home changes after that module loads, the resolver moves and this consumer does not, so a process can read and write one logical profile through two different roots — exactly the split that made user-scope skills and MCP disappear.
The credential angle deserves specific attention: the sidecar holds auth-broker presentations, and <configRoot>/.env is one of the files $credentialEnv treats as trusted. A stale root here is a credential-coherence question, not just a path-tidiness one.
Scope
This is pre-existing and out of scope for #4772:
Raised separately rather than expanded into a regression fix that already carries a needs-human verdict.
Suggested work
- Sweep for module-level constants derived from
getConfigRootDir() / getAgentDir() / getTrustedHomeDir() and move them to construction or use time.
- Add regression coverage proving a consumer follows a post-load home change, ideally parent/child (a child inherits
GJC_CODING_AGENT_DIR, so both must resolve one profile to one lane).
- Decide explicitly whether any consumer should pin an import-time root; if so, document why, rather than leaving it implicit.
Found during independent critic review of #4772.
—
[repo owner's gaebal-gajae (clawdbot) 🦞]
Summary
packages/utilsnow resolves the authoritative home at call time (#4761 / #4772):getTrustedHomeDir(),getConfigRootDir(),getAgentDir()and friends re-derive on every access and rebuild their caches when the home changes. Several downstream consumers still capture a home-derived path into a module-level constant at import time, so they keep pointing at the home that was in effect when their module first loaded.Concrete instance:
getConfigRootDir()is call-time; the constant built from it is not.Why it matters
This is the same shape as the original #4761 defect, one layer out. If the resolved home changes after that module loads, the resolver moves and this consumer does not, so a process can read and write one logical profile through two different roots — exactly the split that made user-scope skills and MCP disappear.
The credential angle deserves specific attention: the sidecar holds auth-broker presentations, and
<configRoot>/.envis one of the files$credentialEnvtreats as trusted. A stale root here is a credential-coherence question, not just a path-tidiness one.Scope
This is pre-existing and out of scope for #4772:
bc63eaaa88(fix(subagent): contain a throwing await progress consumer (#4465 follow-up) #4512), present ondevtodaypackages/utils; it changes no consumerRaised separately rather than expanded into a regression fix that already carries a
needs-humanverdict.Suggested work
getConfigRootDir()/getAgentDir()/getTrustedHomeDir()and move them to construction or use time.GJC_CODING_AGENT_DIR, so both must resolve one profile to one lane).Found during independent critic review of #4772.
—
[repo owner's gaebal-gajae (clawdbot) 🦞]