feat(config): add agent profile roots configuration support#1966
Open
fangzc1 wants to merge 5 commits into
Open
feat(config): add agent profile roots configuration support#1966fangzc1 wants to merge 5 commits into
fangzc1 wants to merge 5 commits into
Conversation
fangzc1
force-pushed
the
fix/multi-agent-session-roots
branch
from
July 23, 2026 14:17
dacb985 to
fb70d98
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Agent hook installation and transcript recovery currently assume a single
profile root.
This breaks when an agent is launched with a non-default home, for example:
CODEX_HOME=~/.codex-personal2 codexIn this situation:
report 0% AI.
The same issue can affect other agents with configurable profile or session
directories, so this change addresses the shared root-selection contract rather
than adding a Codex-specific workaround.
Solution
Add explicit multi-profile configuration through
agent_profile_roots..
Always retain each agent's official default directory.
Preserve existing official environment-variable overrides.
Do not scan home directories or infer sibling profiles; additional profiles
must be configured explicitly.
Share root expansion, validation, ordering, canonicalization, and
deduplication between hook installers and transcript recovery.
Install, check, and uninstall profile-owned hooks across selected profiles
for:
Pass --agent-profile-root from installed hooks when runtime resolution
needs the exact profile.
Sweep selected transcript roots for Codex, Claude, Cursor, Droid, Gemini,
Continue CLI, Copilot CLI, and Amp.
Document the configuration in the README.
Example:
git-ai config --add agent_profile_roots.codex ~/.codex-personal
git-ai config --add agent_profile_roots.codex ~/.codex-personal2
git-ai install
The effective root set still includes the official default (~/.codex) and
the current CODEX_HOME, when set.
Resolution order
Runtime transcript resolution uses:
Old hook commands without --agent-profile-root remain supported.
Safety and performance
No changes to daemon trace2 ingestion, Git proxy handling, or rewrite
processing.
No new Git subprocesses, object lookups, ref checks, or per-item Git work.
Filesystem work remains outside the critical ingestion path.
Missing additional profile roots are skipped.
Existing unrelated user hooks are preserved.
Duplicate or overlapping roots are deduplicated.
Validation
a non-default profile
A manual reproduction using CODEX_HOME=~/.codex-personal2 also produced the
expected Codex checkpoint, including the exact edited lines and transcript path.
Local test limitation
The complete integration suite could not run on the development machine because
Apple Git 2.39.5 does not support git worktree add --orphan and the required
git merge-tree --merge-base behavior. Feature-specific and non-worktree
regressions pass; CI can validate the remaining matrix with the supported Git
versions.