Ability to manage agent profiles - #124
Conversation
📝 WalkthroughWalkthroughCredential Profiles add named per-agent credential directories, profile selection precedence, ChangesCredential Profiles
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant ProfileResolver
participant AgentConfig
participant AgentContainer
CLI->>ProfileResolver: Resolve --profile, VP_PROFILE, or config profile
ProfileResolver-->>CLI: Return active profile
CLI->>AgentConfig: Derive profile-specific agent directory
AgentConfig-->>CLI: Return credential/config path
CLI->>AgentContainer: Mount selected profile directory
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 2📝 Generate docstrings 💡
🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 24b18111a7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def resolve_profile(cli_value: str | None, config: dict[str, Any]) -> str: | ||
| """Resolve the active profile: CLI flag > VP_PROFILE > config key > default.""" | ||
| configured = config.get("profile") | ||
| if configured is not None and (not isinstance(configured, str) or not configured): |
There was a problem hiding this comment.
Apply profile overrides before validating the config value
When the merged config contains an invalid value such as profile: 123, this validation raises even if the user supplies a valid --profile work or VP_PROFILE=work. That contradicts the documented first-match precedence and prevents a higher-priority override from recovering from a bad lower-priority setting; validate only the source that was actually selected.
Useful? React with 👍 / 👎.
| except ValueError: | ||
| return DEFAULT_PROFILE |
There was a problem hiding this comment.
Do not mark the default profile active after resolution fails
When VP_PROFILE or the merged config references an invalid or removed profile, this blanket fallback makes vp profile list mark default as active even though run, task create, and doctor will all reject the same configuration. This hides the broken selection and reports an active profile that is not actually usable; surface the resolution error or display no active marker instead.
Useful? React with 👍 / 👎.
| if agent_dir.is_dir() and any(agent_dir.iterdir()): | ||
| found.append(agent) |
There was a problem hiding this comment.
Distinguish credentials from arbitrary agent state
When a fresh unauthenticated agent writes any cache, settings, session, or Xauthority file into its profile directory, this nonempty-directory check reports that agent under vp profile list as having stored credentials. Users can therefore be told a profile is authenticated after exiting before login; check agent-specific credential artifacts or describe the output as stored agent data instead.
Useful? React with 👍 / 👎.
| validate_profile_name(name) | ||
| if not profile_exists(name): | ||
| raise ValueError(f"Profile '{name}' does not exist.") | ||
| shutil.rmtree(profiles_root() / name) |
There was a problem hiding this comment.
Account for container-owned files when removing profiles
When an agent container has created nested directories that the host user cannot modify—for example root-owned credential or cache directories—shutil.rmtree raises PermissionError, while the command only handles ValueError. As a result, vp profile remove terminates with an unhandled exception and may leave a partially deleted profile; handle filesystem errors and provide a cleanup strategy or actionable diagnostic.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/agents/index.md`:
- Line 3: Update the documentation paragraph in the agent overview to identify
~/.config/vibepod/agents/<agent>/ as the location for the default profile only,
while retaining the existing explanation that credentials are persisted and
mounted. Keep the Credential Profiles link and mention of named profile storage
unchanged.
In `@docs/profiles.md`:
- Around line 15-19: Update the directory-tree fenced code block in the profiles
documentation to specify the text language using the ```text fence, while
preserving its existing layout and contents.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 34c36a3d-55fe-4765-8685-5f1707b59f13
📒 Files selected for processing (15)
docs/agents/index.mddocs/configuration.mddocs/profiles.mdmkdocs.ymlsrc/vibepod/cli.pysrc/vibepod/commands/doctor.pysrc/vibepod/commands/profile.pysrc/vibepod/commands/run.pysrc/vibepod/commands/task.pysrc/vibepod/core/agents.pysrc/vibepod/core/profiles.pytests/test_doctor.pytests/test_profile_cmd.pytests/test_profile_plumbing.pytests/test_profiles.py
| # Agents | ||
|
|
||
| VibePod manages each agent as a Docker or Podman container. Credentials and config are persisted to `~/.config/vibepod/agents/<agent>/` on your host and mounted into the container on every run, so you only need to authenticate once. | ||
| VibePod manages each agent as a Docker or Podman container. Credentials and config are persisted to `~/.config/vibepod/agents/<agent>/` on your host and mounted into the container on every run, so you only need to authenticate once. To keep several credential sets per agent (subscription vs. API key vs. Ollama), see [Credential Profiles](../profiles.md). |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Clarify that the displayed path is default-profile-only.
Line 3 says credentials persist at ~/.config/vibepod/agents/<agent>/ on every run, but named profiles use ~/.config/vibepod/profiles/<name>/agents/<agent>/. Describe the shown path as the default profile location.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/agents/index.md` at line 3, Update the documentation paragraph in the
agent overview to identify ~/.config/vibepod/agents/<agent>/ as the location for
the default profile only, while retaining the existing explanation that
credentials are persisted and mounted. Keep the Credential Profiles link and
mention of named profile storage unchanged.
| ``` | ||
| ~/.config/vibepod/ | ||
| agents/<agent>/ # the built-in "default" profile | ||
| profiles/<name>/agents/<agent>/ # named profiles | ||
| ``` |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Specify the layout fence language.
Line 15 violates markdownlint MD040. Use ```text for the directory-tree block.
🧰 Tools
🪛 markdownlint-cli2 (0.23.1)
[warning] 15-15: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/profiles.md` around lines 15 - 19, Update the directory-tree fenced code
block in the profiles documentation to specify the text language using the
```text fence, while preserving its existing layout and contents.
Source: Linters/SAST tools
Introduces support for credential profiles, enabling users to maintain and switch between multiple sets of credentials per agent (e.g., for different API keys or environments). It adds a new
profileCLI subcommand for managing profiles, updates core commands to accept a--profileoption, and documents the feature throughout the codebase and docs. The implementation ensures that profiles affect only credential storage, while other settings remain shared.Credential Profiles Feature:
~/.config/vibepod/profiles/<name>/agents/<agent>/, with the default profile remaining at~/.config/vibepod/agents/<agent>/.profileCLI subcommand (vp profile) withlist,create, andremoveactions for managing profiles.CLI and Command Integration:
run,task create, anddoctor claudecommands (and their aliases) to accept a--profileoption, resolving the active profile based on flag, environment variable, config, or default. All agent credential directory accesses now use the selected profile.Summary by CodeRabbit
New Features
vp profile list,create, andremovecommands.vp run,vp task create,vp task run, andvp doctor claude.VP_PROFILEconfiguration support with clear selection precedence.Documentation