Skip to content

A seeded session with agent = "shell" cannot evaluate (installAgents has no "shell") #660

Description

@defangdevs

Found while adding tests/ttyd-isolation.nix in #650.

Symptom. Declaring a session on the NixOS module with the always-available "shell" pseudo-agent fails eval, before anything boots:

services.agent-box.users.agent: session "main" uses agent "shell", which is
not in services.agent-box.installAgents.

Smallest reproduction — this is the module's OWN documented example for users.<name>.sessions, from the option description (scratch = { agent = "shell"; }):

services.agent-box.users.agent = {
  web.passwordHashFile = "/var/lib/agent-box-web/password-hash";
  sessions.main.agent = "shell";
};

Why. The assertion compares the session's agent against cfg.installAgents:

assertion = builtins.elem (if s.agent != null then s.agent else cfg.agent) cfg.installAgents;

but installAgents is listOf (enum supportedAgents) and supportedAgents = [ "claude" "codex" ], so it can never contain "shell". The module is explicit a few lines above that "shell" is the pseudo-agent that is "always available (nothing to install), so it is appended, never filtered" — the assertion is the one place that does not append it. The runtime path is fine: agent-box-session add <n> --harness shell works, because AGENT_BOX_AGENTS comes from sessionKinds cfg.installAgents, which does append it. So only the DECLARATIVE spelling is broken, which is also the one the docs show.

The native backend has no such gap: bin/agentbox builds the same list as self.spec.agents + ["shell"].

Where the fix goes. modules/agent-box.nix.in, that assertion, comparing against sessionKinds cfg.installAgents instead of cfg.installAgents — the helper that already exists for exactly this and is used two places above. Worth a regression check in the same change: checkout-options is the pattern to copy (it reads config.assertions rather than forcing toplevel, so a failure names WHICH assertion fired, and it asserts the ACCEPTING cases too — here, that agent = "shell" evaluates and that a genuinely unknown agent is still refused).

Workaround meanwhile, which is what #650's VM test does: declare no session and create it at runtime with agent-box-session add <name> --harness shell.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    claudeIssues affecting the Claude harnesscodexIssues affecting the Codex harness

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions