Skip to content

Ability to manage agent profiles - #124

Open
nezhar wants to merge 4 commits into
mainfrom
agent-profiles
Open

Ability to manage agent profiles#124
nezhar wants to merge 4 commits into
mainfrom
agent-profiles

Conversation

@nezhar

@nezhar nezhar commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

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 profile CLI subcommand for managing profiles, updates core commands to accept a --profile option, 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:

  • Added the concept of credential profiles, allowing users to create, list, and remove named profiles for agent credentials. Profiles are stored under ~/.config/vibepod/profiles/<name>/agents/<agent>/, with the default profile remaining at ~/.config/vibepod/agents/<agent>/.
  • Introduced the profile CLI subcommand (vp profile) with list, create, and remove actions for managing profiles.

CLI and Command Integration:

  • Updated run, task create, and doctor claude commands (and their aliases) to accept a --profile option, 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

    • Added credential profiles for managing and switching between multiple agent credential sets.
    • Added vp profile list, create, and remove commands.
    • Added profile selection to vp run, vp task create, vp task run, and vp doctor claude.
    • Added VP_PROFILE configuration support with clear selection precedence.
  • Documentation

    • Added comprehensive credential profile guidance and navigation links.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Credential Profiles add named per-agent credential directories, profile selection precedence, vp profile management commands, profile-aware run/task/doctor behavior, documentation, and tests for lifecycle, validation, traversal rejection, and command plumbing.

Changes

Credential Profiles

Layer / File(s) Summary
Profile storage and resolution
src/vibepod/core/profiles.py, src/vibepod/core/agents.py, tests/test_profiles.py
Adds profile validation, lifecycle operations, precedence-based resolution, profile-specific agent paths, and core tests.
Profile commands and documentation
src/vibepod/commands/profile.py, src/vibepod/cli.py, docs/profiles.md, docs/configuration.md, docs/agents/index.md, mkdocs.yml, tests/test_profile_cmd.py
Adds vp profile list/create/remove, registers the command group, documents profile usage and precedence, and tests command behavior.
Profile-aware command execution
src/vibepod/commands/run.py, src/vibepod/commands/task.py, src/vibepod/commands/doctor.py, tests/test_profile_plumbing.py, tests/test_doctor.py
Adds profile options and resolution to run, task, and doctor flows, uses profile-specific credential paths, and updates integration coverage.

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
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 19.40% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: adding support for managing agent credential profiles.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 2
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch agent-profiles

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread src/vibepod/core/profiles.py Outdated
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):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment thread src/vibepod/commands/profile.py Outdated
Comment on lines +40 to +41
except ValueError:
return DEFAULT_PROFILE

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +32 to +33
if agent_dir.is_dir() and any(agent_dir.iterdir()):
found.append(agent)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7b45600 and 9931e09.

📒 Files selected for processing (15)
  • docs/agents/index.md
  • docs/configuration.md
  • docs/profiles.md
  • mkdocs.yml
  • src/vibepod/cli.py
  • src/vibepod/commands/doctor.py
  • src/vibepod/commands/profile.py
  • src/vibepod/commands/run.py
  • src/vibepod/commands/task.py
  • src/vibepod/core/agents.py
  • src/vibepod/core/profiles.py
  • tests/test_doctor.py
  • tests/test_profile_cmd.py
  • tests/test_profile_plumbing.py
  • tests/test_profiles.py

Comment thread docs/agents/index.md
# 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).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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.

Comment thread docs/profiles.md
Comment on lines +15 to +19
```
~/.config/vibepod/
agents/<agent>/ # the built-in "default" profile
profiles/<name>/agents/<agent>/ # named profiles
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant