Skip to content

feat(agent-vault): pick the Agent Vault project and add sessions create/revoke - #488

Merged
saifsmailbox98 merged 13 commits into
mainfrom
saif/age2-177-support-multiple-agent-vault-projects-per-organization
Nov 5, 2026
Merged

saifsmailbox98 merged 13 commits into
mainfrom
saif/age2-177-support-multiple-agent-vault-projects-per-organization

Conversation

@saifsmailbox98

@saifsmailbox98 saifsmailbox98 commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Description 📣

Agent Vault orgs can now hold several projects, so the commands that need one take a project.

  • agent-vault run --access-bundle, agent-vault skills push and the new sessions create resolve the project from --project-id, then INFISICAL_AGENT_VAULT_PROJECT_ID, then INFISICAL_PROJECT_ID. With none set they stop with a message naming all three. An empty flag or a non-uuid is refused, and a 404 when the id came from INFISICAL_PROJECT_ID hints that it may be a Secrets Management project
  • New infisical agent-vault sessions create: mints a session and prints only the token, -o json|yaml for id, token, projectId, accessBundle, label and expiresAt. --ttl defaults to never like run. Doesn't open the login wizard when stdout isn't a terminal
  • New infisical agent-vault sessions revoke <session-id> or by token (calls the new token-authenticated revoke route), no prompt. The token comes from --session-token, else INFISICAL_AGENT_VAULT_SESSION_TOKEN, so scripts can keep it off the command line. --session-token rather than --token so the root command's token handling never reads it
  • Agent Vault commands don't read the domain in .infisical.yaml at all (that file is for Secrets Management), so a cloned repo can't redirect credentials or tokens and sessions create and revoke always talk to the same server. They use --domain, INFISICAL_DOMAIN or the login. Both revoke calls time out after 30s, like run's cleanup
  • A session token passed as the revoke argument is refused without being printed, a login that can't be read shows the real error, and project IDs are lowercased
  • run resolves the project only when minting, refuses --project-id with --session-token, and shows the project and its source in the run summary. run --session-token is unchanged
  • profile current shows the Agent Vault project and where it came from

Older CLIs keep working: the server falls back to the org's original Agent Vault project when no project is sent.

Infisical PR: Infisical/infisical#9160
Python SDK PR: Infisical/python-sdk-official#68
Node SDK PR: Infisical/node-sdk-v2#47

Type ✨

  • Bug fix
  • New feature
  • Improvement
  • Breaking change
  • Documentation

Tests 🛠️

# Here's some code block to paste some code snippets

…te/revoke

Agent Vault orgs can now hold several projects. Commands that mint sessions or
push skills take --project-id, INFISICAL_AGENT_VAULT_PROJECT_ID, the
agent-vault.project-id setting in .infisical.yaml, or INFISICAL_PROJECT_ID, in
that order. New sessions create and sessions revoke (by ID or --session-token).
@infisical-review-police

Copy link
Copy Markdown

💬 Discussion in Slack: #pr-review-cli-488-feat-agent-vault-pick-the-agent-vault-project-and-add-sessions

Posted by Review Police — reviews, comments, new commits, and CI failures will stream into this channel.

@linear

linear Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

AGE2-177

AGE2-317

Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved
@veria-ai

veria-ai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Security review

No open security issues remain on this pull request.

Fixed/addressed: 4 · PR risk: 0/10

@greptile-apps

greptile-apps Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[High impact] The latest changes appear safe to merge; no new blocking issues were found.

Summary

Adds project selection to Agent Vault session creation and skill uploads, plus commands to create and revoke sessions.

  • Agent Vault commands can choose the project used for sessions and skills.
  • The CLI can create Agent Vault sessions and revoke them by ID or token.
  • Agent Vault commands choose their server without using the repository domain.
  • Proxy refusals explain that a session may belong to another project.

Reviews (15) · Last reviewed commit: "fix(agent-vault): never repeat the repo ..." · Reviewed by Greptile

Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved

@claude claude 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.

Findings marked 🟡 are optional suggestions and need no follow-up push.

Additional findings (outside the current diff — GitHub can't attach inline comments there):

  • 🔴 packages/cmd/agent_vault_project.go — Users upgrading who mint with agent-vault run --access-bundle or run skills push now fail in two cases that work on base. The first is when no project is configured. The second is when INFISICAL_PROJECT_ID is already set for Secrets Management, which is common in CI. With no source, resolveAgentVaultProject errors before any request. When the ID comes from INFISICAL_PROJECT_ID, the CLI sends that Secrets Management ID and the server answers 404. Fix: when no Agent Vault-specific source is set, leave projectId out (the request tag is already omitempty) so the server falls back to the org's oldest Agent Vault project.

    Why this was flagged

    On base, CallCreateAgentVaultSession and CallListAgentVaultSkillsByName send no project. The PR says the server then falls back to the org's oldest Agent Vault project, so a single-project org works with no setup. After the change, runAgentVaultRun (agent_vault_run.go:321-326), the skills push Run and sessions create all call resolveAgentVaultProject. With none of the four sources set, it returns "no Agent Vault project is set..." at agent_vault_project.go:49-53 and the command exits. If only INFISICAL_PROJECT_ID is set (agent_vault_project.go:184-186), which CI jobs set for infisical run/export, that Secrets Management UUID goes out as projectId and the mint or skill lookup fails with 404. agentVaultProjectHints only adds a hint and does not recover. The PR accepts this as breaking, but the server fallback it cites would keep these existing scripts working if projectId were omitted. The 404 hint does not prevent the failure.

    Verification: When no source is set, resolveAgentVaultProject returns "no Agent Vault project is set. Pass --project-id, ..." (agent_vault_project.go:49-53). resolveAgentVaultProjectFromEnvironment falls back to os.Getenv(util.INFISICAL_PROJECT_ID_NAME) (agent_vault_project.go:75-78). agentVaultProjectHints only adds a hint; the command still fails. Both paths break workflows that work on base.

  • 🟡 packages/cmd/init.go — Re-running infisical init silently deletes a user's agent-vault.project-id from .infisical.yaml. Later Agent Vault commands then fail or fall back to another project. writeWorkspaceFile builds a fresh models.WorkspaceConfigFileYaml with only Version and SecretsManagement, then overwrites the file. The new AgentVault section this PR adds to that struct is never carried over. Fix: when .infisical.yaml already exists, read it and keep its AgentVault section (and General) while replacing only secrets-management.project-id. The same pre-existing loss already hits general.domain.

    Why this was flagged

    A user adds agent-vault: project-id: <uuid> to .infisical.yaml, which this PR makes a documented project source (models/cli.go AgentVaultConfigSection, util/config.go:123). Later they run infisical init in that directory to link a different Secrets Management project and confirm the overwrite prompt. writeWorkspaceFile (packages/cmd/init.go:341-353) marshals a new struct with only Version and SecretsManagement and writes it with WriteFileAtomic, so the agent-vault section is dropped without warning. The next agent-vault run --access-bundle, skills push or sessions create goes to the next source in resolveAgentVaultProjectFromEnvironment (packages/cmd/agent_vault_project.go:75). That is INFISICAL_PROJECT_ID, often a Secrets Management project, which gives a 404 or a skill pushed to the wrong project; if it is unset, the command fails with "no Agent Vault project is set". Nothing on the init path reads or merges the existing file.

    Verification: writeWorkspaceFile (packages/cmd/init.go:341-346) builds models.WorkspaceConfigFileYaml{Version: ..., SecretsManagement: {ProjectID: selectedWorkspace.ID}} and writes it at line 353 without reading the existing file first. Nothing in writeWorkspaceFile copies the new AgentVault section over, so the agent-vault section is erased when the file is rewritten. Why nit and not normal: init already overwrites the whole file on the base branch.

… and timeout; drop .infisical.yaml project

- sessions revoke falls back to INFISICAL_AGENT_VAULT_SESSION_TOKEN
- revoke by token ignores the domain in .infisical.yaml, like run --session-token
- both revoke calls time out after 30s
- drop the agent-vault project-id setting in .infisical.yaml
@saifsmailbox98

Copy link
Copy Markdown
Member Author

On the two points in the review summary:

  • Upgrade: this is intentional. With multiple projects the CLI needs to know which one to use, so it asks for the project when none is set. Upgrading is a deliberate change, the error says exactly what to set, and Agent Vault is in preview. Leaving projectId out would also make the server fallback permanent, and we plan to remove it.
  • init: we dropped the agent-vault setting from .infisical.yaml, so the project now comes only from --project-id or the env vars.

Comment thread packages/cmd/agent_vault_sessions.go Resolved
@saifsmailbox98

Copy link
Copy Markdown
Member Author

@greptile review

…-multiple-agent-vault-projects-per-organization

# Conflicts:
#	packages/api/agent_vault.go
#	packages/cmd/agent_vault_run.go

@scott-ray-wilson scott-ray-wilson 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.

Ran a4ab1d7 against Infisical/infisical#9160 locally. The project lookup order, the empty and non-UUID refusals, the Secrets Management 404 hint, sessions create -o json and every sessions revoke path behave as described. The comments below are what's left. The server-side ones are on Infisical/infisical#9160.

}
minted = &created.Session
sessionToken = created.Session.Token
minted = mintAgentVaultSessionOrExit(identity, project, accessBundles, ttl, label)

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.

run can mint in a project that doesn't own the proxy

run mints the session in the project from --project-id or the environment without checking that this project owns the --proxy it's about to use. On a mismatch, the agent starts and then every request is refused as an invalid session.

Reproduced against Infisical/infisical#9160 with a real proxy registered in Apollo. With --project-id <Apollo>, run injected Bearer apollo-secret-token and httpbin answered 200. With --project-id <Hermes> (Hermes also has a bundle named apollo-bundle), the same command minted, printed its summary and started the agent with no warning. curl then got http 000 and the proxy logged refused, the session is no longer valid ... status=403. The server's resolve treats proxy.projectId !== session.projectId as "Session not found", which the proxy reports as a dead session. run already has the proxy id from the CA fetch (line 369), so it could refuse the mismatch, or default the project from the proxy, before minting. Released CLIs hit this with any proxy outside the org's oldest project.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'd keep this out of the CLI. run only knows the address it's given and what the proxy says about itself, and the server already refuses a session from another project, so the rule stays in one place. A wrong proxy just doesn't work, so I added a troubleshooting note to the docs for that error instead.

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.

Agreed the rule belongs on the server. The confusing part is the message: a session minted a second earlier is refused with "the session is no longer valid". Could the server's resolve report a project mismatch separately from a dead session, so the proxy says the session is for another project? That keeps the rule in one place.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Kept the server's 404, since it's deliberate. The proxy's message now says the session is no longer valid, or belongs to a different Agent Vault project than this proxy.

if err != nil {
return agentVaultProject{}, err
}
if !found {

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.

Requiring a project breaks the CLI-first release window

The new CLI refuses run --access-bundle, skills push and sessions create when no project is set. Since the CLI ships before Infisical/infisical#9160, users on servers without it must supply a project ID their server never shows them.

With no project set, sessions create exits with no Agent Vault project is set. Pass --project-id, or set INFISICAL_AGENT_VAULT_PROJECT_ID or INFISICAL_PROJECT_ID. The published docs' GitHub Actions and Dockerfile examples install the latest CLI and run agent-vault run --access-bundle with no project, so they fail on their first run after the CLI release, even against today's prod. On servers without the new release, the Agent Vault UI is org-scoped and never shows a project ID (the old layout resolved it through the hidden GET /api/v1/agent-vault/project), and the error's advice ("copy the ID from the Agent Vault project's settings") points at a page that doesn't exist there. Meanwhile any UUID would "work", since the old server drops the field. Omitting projectId when none is set (the new server falls back anyway) would keep old and new servers working through the release window.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Agreed there's a gap, but adoption of the Agent Vault CLI commands is still low, and we'll release the CLI and the server on the same day, so the window is a few hours. Anyone caught in it only needs to set the project ID, which they need on the new server anyway, so I'd keep the CLI strict rather than make it lean on the fallback.

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.

Same-day release works for me. Worth a line in the CLI release notes saying Agent Vault commands now need INFISICAL_AGENT_VAULT_PROJECT_ID or --project-id, and that the ID is under Settings > General after the server update.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Our CLI release notes are generated from PR titles. The CLI's error names --project-id and the two variables, and the docs say where to find the ID.

Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_run.go Resolved
Comment thread packages/cmd/agent_vault_project.go Resolved
- Agent Vault commands ignore the domain in .infisical.yaml
- show the real login error instead of 'expired'
- never echo a session token passed as the revoke argument
- lowercase project IDs
Comment thread packages/cmd/root.go Resolved
@saifsmailbox98

Copy link
Copy Markdown
Member Author

@greptile review

@scott-ray-wilson scott-ray-wilson 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.

Verified the fixes on 8b8d3a7 against Infisical/infisical#9160: a token passed as the argument is refused without being printed, uppercase project IDs work, and create and revoke now use the same server. One follow-up on the domain change below.

Comment thread packages/cmd/root.go Resolved
}
minted = &created.Session
sessionToken = created.Session.Token
minted = mintAgentVaultSessionOrExit(identity, project, accessBundles, ttl, label)

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.

Agreed the rule belongs on the server. The confusing part is the message: a session minted a second earlier is refused with "the session is no longer valid". Could the server's resolve report a project mismatch separately from a dead session, so the proxy says the session is for another project? That keeps the rule in one place.

if err != nil {
return agentVaultProject{}, err
}
if !found {

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.

Same-day release works for me. Worth a line in the CLI release notes saying Agent Vault commands now need INFISICAL_AGENT_VAULT_PROJECT_ID or --project-id, and that the ID is under Settings > General after the server update.

…-multiple-agent-vault-projects-per-organization

# Conflicts:
#	packages/cmd/profile.go
@gitguardian

gitguardian Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

⚠️ GitGuardian has uncovered 4 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
39278625 Triggered JSON Web Token 5b081ff packages/util/cli_error_test.go View secret
39278625 Triggered JSON Web Token 5b081ff packages/util/cli_error_test.go View secret
39723066 Triggered Generic High Entropy Secret fa6f110 packages/cmd/agent_vault_project_test.go View secret
39723066 Triggered Generic High Entropy Secret 2a490c4 packages/cmd/agent_vault_errors_test.go View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Comment thread packages/cmd/root.go Resolved
Comment thread packages/cmd/agent_vault_project.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_sessions.go Resolved
Comment thread packages/cmd/agent_vault_project.go Resolved
Comment thread packages/cmd/agent_vault_errors.go Resolved
Comment thread packages/cmd/agent_vault_errors.go Resolved
@saifsmailbox98

Copy link
Copy Markdown
Member Author

@scott-ray-wilson thanks, all addressed:

  • Stop message: it no longer repeats the file's value. It now says "Pass --domain or set INFISICAL_DOMAIN".
  • run --session-token --no-skills: the stop is skipped when the run would really use the token and skips skills, since nothing contacts Infisical then.
  • -o json for "No access bundle named …": the server now names that error AccessBundleNotGranted, and the CLI maps it to access_bundle_not_granted.
  • CLI reference: says the project note is hidden with --silent or -o.
  • Same server written differently: left as is. Every other server check in the CLI (login, profile switch, the profile-session check) compares the same way, so loosening only this one would make them disagree. The fix is --domain or INFISICAL_DOMAIN.

@scott-ray-wilson scott-ray-wilson 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.

lgtm

@saifsmailbox98
saifsmailbox98 merged commit 71c243a into main Nov 5, 2026
33 of 34 checks passed
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.

2 participants