bots-garden/sidekickspublic Fork
⑂ 5f2aced
Commits
⬇ Clone ▾
git clone https://git.rickub.com/bots-garden/sidekicks.git
git clone ssh://git@rickub.com/bots-garden/sidekicks.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

#82 Assistant : refuser un sbxenv.yaml dont l'agent n'est pas celui du programme (Codex dans la sandbox de Claude)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
k33g committed 2026-11-10T06:21:14+01:00 Browse files
5f2aced parent: b08b7a1
modified .memory/history.md +1 -0
@@ -224,3 +224,4 @@
224224 - **2026-11-10 — #82 Codex and #84 Gemini in sbx, like #81** (owner: "implement 82 like 81, the example is agents/snippets/codex-acp; then 84, you create the example"): `sbxPrograms` + `sbxAgentOf` in agentform.ts (claude-agent-acp, `/home/agent/.local/bin/codex-acp` — outside the kit's PATH per its Docker Hub page —, `gemini --acp`); a note per agent (`assistant.codexNote`, `assistant.geminiNote`), config-file block hidden. Gemini example written: kit `docker.io/sbx/gemini-kit` (deprecated by Docker for `antigravity`), `bindings.google`. Lifecycle test reads every `agents/snippets/*/sbxenv.yaml`. Guides EN/FR add-a-codex/gemini-agent-in-a-sandbox. `agents/snippets/codex-acp` holds a nested `.git` (the owner's): not committed, asked the owner. Not tried with sbx.
225225 - **2026-11-10 — #84 fix** (owner: "propose only gemini, --acp goes in the arguments"): `sbxPrograms.gemini = 'gemini'`, `sbxArguments` (gemini: `--acp`); choosing an sbx agent's program fills Arguments unless other arguments were typed.
226226 - **2026-11-10 — #82 fix**: Claude and Gemini work on the Mac; Codex failed (`cannot mix v3 kits with v1/v2 kits`: sbx's `codex` agent is now the v3 kit docker.io/sbx/codex). Kit changed to the v3 `docker.io/sbx/codex-acp:latest` everywhere (snippet, note, guides); the error is documented in the Codex guide.
227+- **2026-11-10 — #82 wrong sandbox**: the Codex entry made by the assistant pointed at claude-acp (Claude's sbxenv.yaml was read; no code path keeps old values, the form restarts empty each time — cause on the Mac not established: dropped/chosen file?). Guard: `SbxEnv.Agent`/`SandboxEnv.agent`, `sandboxMismatch` blocks adding Claude/Codex/Gemini with another agent's sbxenv.yaml.
@@ -224,3 +224,4 @@
224 - **2026-11-10 — #82 Codex and #84 Gemini in sbx, like #81** (owner: "implement 82 like 81, the example is agents/snippets/codex-acp; then 84, you create the example"): `sbxPrograms` + `sbxAgentOf` in agentform.ts (claude-agent-acp, `/home/agent/.local/bin/codex-acp` — outside the kit's PATH per its Docker Hub page —, `gemini --acp`); a note per agent (`assistant.codexNote`, `assistant.geminiNote`), config-file block hidden. Gemini example written: kit `docker.io/sbx/gemini-kit` (deprecated by Docker for `antigravity`), `bindings.google`. Lifecycle test reads every `agents/snippets/*/sbxenv.yaml`. Guides EN/FR add-a-codex/gemini-agent-in-a-sandbox. `agents/snippets/codex-acp` holds a nested `.git` (the owner's): not committed, asked the owner. Not tried with sbx.224 - **2026-11-10 — #82 Codex and #84 Gemini in sbx, like #81** (owner: "implement 82 like 81, the example is agents/snippets/codex-acp; then 84, you create the example"): `sbxPrograms` + `sbxAgentOf` in agentform.ts (claude-agent-acp, `/home/agent/.local/bin/codex-acp` — outside the kit's PATH per its Docker Hub page —, `gemini --acp`); a note per agent (`assistant.codexNote`, `assistant.geminiNote`), config-file block hidden. Gemini example written: kit `docker.io/sbx/gemini-kit` (deprecated by Docker for `antigravity`), `bindings.google`. Lifecycle test reads every `agents/snippets/*/sbxenv.yaml`. Guides EN/FR add-a-codex/gemini-agent-in-a-sandbox. `agents/snippets/codex-acp` holds a nested `.git` (the owner's): not committed, asked the owner. Not tried with sbx.
225 - **2026-11-10 — #84 fix** (owner: "propose only gemini, --acp goes in the arguments"): `sbxPrograms.gemini = 'gemini'`, `sbxArguments` (gemini: `--acp`); choosing an sbx agent's program fills Arguments unless other arguments were typed.225 - **2026-11-10 — #84 fix** (owner: "propose only gemini, --acp goes in the arguments"): `sbxPrograms.gemini = 'gemini'`, `sbxArguments` (gemini: `--acp`); choosing an sbx agent's program fills Arguments unless other arguments were typed.
226 - **2026-11-10 — #82 fix**: Claude and Gemini work on the Mac; Codex failed (`cannot mix v3 kits with v1/v2 kits`: sbx's `codex` agent is now the v3 kit docker.io/sbx/codex). Kit changed to the v3 `docker.io/sbx/codex-acp:latest` everywhere (snippet, note, guides); the error is documented in the Codex guide.226 - **2026-11-10 — #82 fix**: Claude and Gemini work on the Mac; Codex failed (`cannot mix v3 kits with v1/v2 kits`: sbx's `codex` agent is now the v3 kit docker.io/sbx/codex). Kit changed to the v3 `docker.io/sbx/codex-acp:latest` everywhere (snippet, note, guides); the error is documented in the Codex guide.
227+- **2026-11-10 — #82 wrong sandbox**: the Codex entry made by the assistant pointed at claude-acp (Claude's sbxenv.yaml was read; no code path keeps old values, the form restarts empty each time — cause on the Mac not established: dropped/chosen file?). Guard: `SbxEnv.Agent`/`SandboxEnv.agent`, `sandboxMismatch` blocks adding Claude/Codex/Gemini with another agent's sbxenv.yaml.
modified .tickets/issues/0082-simplifier-l-ajout-d-une-sbx-avec-codex-acp.yaml +12 -1
@@ -6,7 +6,7 @@ author:
66 name: k33g
77 email: ph.charriere@gmail.com
88 createdAt: 2026-11-09T06:11:54.000Z
9-updatedAt: 2026-11-10T05:12:35.000Z
9+updatedAt: 2026-11-10T05:21:14.000Z
1010 labels:
1111 - kind::feature
1212 - area::config
@@ -103,3 +103,14 @@ comments:
103103 l'agent `codex` est maintenant le kit v3 `docker.io/sbx/codex`). Remplacé par le kit v3 `docker.io/sbx/codex-acp:latest`
104104 (même programme `/home/agent/.local/bin/codex-acp`) dans l'exemple, la note de l'assistant et les guides EN + FR,
105105 avec l'erreur et sa solution dans le guide.
106+ - id: 3
107+ author:
108+ name: k33g
109+ email: ph.charriere@gmail.com
110+ createdAt: 2026-11-10T05:21:14.000Z
111+ body: |
112+ Sur le Mac, l'entrée Codex produite par l'assistant pointait sur la sandbox `claude-acp` (args, runtime, lifecycle, workspace) :
113+ le `sbxenv.yaml` lu était celui de Claude, et `codex-acp` n'existe pas dans cette sandbox (exit status 127).
114+ Garde-fou : `ReadSandboxEnv` renvoie aussi l'`agent:` du fichier ; l'assistant refuse d'ajouter l'agent quand il ne
115+ correspond pas au programme (`sandboxMismatch` dans [agentform.ts](frontend/src/lib/agentform.ts)) et le dit sous le programme.
116+ Guide Codex EN + FR : l'erreur et quoi vérifier.
@@ -6,7 +6,7 @@ author:
6 name: k33g6 name: k33g
7 email: ph.charriere@gmail.com7 email: ph.charriere@gmail.com
8 createdAt: 2026-11-09T06:11:54.000Z8 createdAt: 2026-11-09T06:11:54.000Z
9-updatedAt: 2026-11-10T05:12:35.000Z9+updatedAt: 2026-11-10T05:21:14.000Z
10 labels:10 labels:
11 - kind::feature11 - kind::feature
12 - area::config12 - area::config
@@ -103,3 +103,14 @@ comments:
103 l'agent `codex` est maintenant le kit v3 `docker.io/sbx/codex`). Remplacé par le kit v3 `docker.io/sbx/codex-acp:latest`103 l'agent `codex` est maintenant le kit v3 `docker.io/sbx/codex`). Remplacé par le kit v3 `docker.io/sbx/codex-acp:latest`
104 (même programme `/home/agent/.local/bin/codex-acp`) dans l'exemple, la note de l'assistant et les guides EN + FR,104 (même programme `/home/agent/.local/bin/codex-acp`) dans l'exemple, la note de l'assistant et les guides EN + FR,
105 avec l'erreur et sa solution dans le guide.105 avec l'erreur et sa solution dans le guide.
106+ - id: 3
107+ author:
108+ name: k33g
109+ email: ph.charriere@gmail.com
110+ createdAt: 2026-11-10T05:21:14.000Z
111+ body: |
112+ Sur le Mac, l'entrée Codex produite par l'assistant pointait sur la sandbox `claude-acp` (args, runtime, lifecycle, workspace) :
113+ le `sbxenv.yaml` lu était celui de Claude, et `codex-acp` n'existe pas dans cette sandbox (exit status 127).
114+ Garde-fou : `ReadSandboxEnv` renvoie aussi l'`agent:` du fichier ; l'assistant refuse d'ajouter l'agent quand il ne
115+ correspond pas au programme (`sandboxMismatch` dans [agentform.ts](frontend/src/lib/agentform.ts)) et le dit sous le programme.
116+ Guide Codex EN + FR : l'erreur et quoi vérifier.
modified docs/en/how-to/add-a-codex-agent-in-a-sandbox.md +1 -0
@@ -85,6 +85,7 @@ And the agent's entry, under `agents:` in **Settings**:
8585 - Ask Codex to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/codex-acp/workspace` on this computer.
8686 - When Codex asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer.
8787 - **`cannot mix v3 kits with v1/v2 kits in one sandbox`** when the sandbox is created: the `sbxenv.yaml` names the older `docker.io/sbx/codex-acp-kit`. sbx now gives the `codex` agent as a kit of the new format (v3), which only composes with v3 kits: name `docker.io/sbx/codex-acp:latest` instead, then start the agent again.
88+- **`executable file … codex-acp not found`** (exit status 127): the agent runs in another sandbox — the log then shows another sandbox being started, such as `claude-acp`. The assistant now refuses an `sbxenv.yaml` whose `agent:` is not the program's; in **Settings**, check that the sandbox name is `codex-acp` in `args`, `runtime.sandbox` and `lifecycle`, and that `workspace` and `lifecycle.folder` are Codex's folders.
8889 - **An authentication error** in the **Log** tab: the credentials are not stored in sbx, or were stored after the sandbox was created. Store them again, then **🗑 Remove the sandbox** and start the agent.
8990
9091 ## See also
@@ -85,6 +85,7 @@ And the agent's entry, under `agents:` in **Settings**:
85 - Ask Codex to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/codex-acp/workspace` on this computer.85 - Ask Codex to write a file, e.g. "Write `notes/hello.md` with a greeting". The file appears in the agent's **Files** tab (📂) and in `/Users/me/agents/codex-acp/workspace` on this computer.
86 - When Codex asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer.86 - When Codex asks for permission to change a file or run a command, Sidekicks shows the request and waits for your answer.
87 - **`cannot mix v3 kits with v1/v2 kits in one sandbox`** when the sandbox is created: the `sbxenv.yaml` names the older `docker.io/sbx/codex-acp-kit`. sbx now gives the `codex` agent as a kit of the new format (v3), which only composes with v3 kits: name `docker.io/sbx/codex-acp:latest` instead, then start the agent again.87 - **`cannot mix v3 kits with v1/v2 kits in one sandbox`** when the sandbox is created: the `sbxenv.yaml` names the older `docker.io/sbx/codex-acp-kit`. sbx now gives the `codex` agent as a kit of the new format (v3), which only composes with v3 kits: name `docker.io/sbx/codex-acp:latest` instead, then start the agent again.
88+- **`executable file … codex-acp not found`** (exit status 127): the agent runs in another sandbox — the log then shows another sandbox being started, such as `claude-acp`. The assistant now refuses an `sbxenv.yaml` whose `agent:` is not the program's; in **Settings**, check that the sandbox name is `codex-acp` in `args`, `runtime.sandbox` and `lifecycle`, and that `workspace` and `lifecycle.folder` are Codex's folders.
88 - **An authentication error** in the **Log** tab: the credentials are not stored in sbx, or were stored after the sandbox was created. Store them again, then **🗑 Remove the sandbox** and start the agent.89 - **An authentication error** in the **Log** tab: the credentials are not stored in sbx, or were stored after the sandbox was created. Store them again, then **🗑 Remove the sandbox** and start the agent.
89 90
90 ## See also91 ## See also
modified docs/fr/how-to/ajouter-un-agent-codex-dans-une-sandbox.md +1 -0
@@ -85,6 +85,7 @@ Et l'entrée de l'agent, sous `agents:` dans **Settings** :
8585 - Demandez à Codex d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/codex-acp/workspace` sur cet ordinateur.
8686 - Quand Codex demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse.
8787 - **`cannot mix v3 kits with v1/v2 kits in one sandbox`** à la création de la sandbox : le `sbxenv.yaml` nomme l'ancien kit `docker.io/sbx/codex-acp-kit`. sbx fournit maintenant l'agent `codex` sous forme de kit au nouveau format (v3), qui ne se combine qu'avec des kits v3 : nommez plutôt `docker.io/sbx/codex-acp:latest`, puis redémarrez l'agent.
88+- **`executable file … codex-acp not found`** (exit status 127) : l'agent tourne dans une autre sandbox — le log montre alors le démarrage d'une autre sandbox, par exemple `claude-acp`. L'assistant refuse désormais un `sbxenv.yaml` dont l'`agent:` n'est pas celui du programme ; dans **Settings**, vérifiez que le nom de la sandbox est `codex-acp` dans `args`, `runtime.sandbox` et `lifecycle`, et que `workspace` et `lifecycle.folder` sont les dossiers de Codex.
8889 - **Une erreur d'authentification** dans l'onglet **Log** : les identifiants ne sont pas enregistrés dans sbx, ou l'ont été après la création de la sandbox. Enregistrez-les de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent.
8990
9091 ## Voir aussi
@@ -85,6 +85,7 @@ Et l'entrée de l'agent, sous `agents:` dans **Settings** :
85 - Demandez à Codex d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/codex-acp/workspace` sur cet ordinateur.85 - Demandez à Codex d'écrire un fichier, par exemple « Écris `notes/bonjour.md` avec un mot d'accueil ». Le fichier apparaît dans l'onglet **Files** de l'agent (📂) et dans `/Users/moi/agents/codex-acp/workspace` sur cet ordinateur.
86 - Quand Codex demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse.86 - Quand Codex demande l'autorisation de modifier un fichier ou de lancer une commande, Sidekicks affiche la demande et attend votre réponse.
87 - **`cannot mix v3 kits with v1/v2 kits in one sandbox`** à la création de la sandbox : le `sbxenv.yaml` nomme l'ancien kit `docker.io/sbx/codex-acp-kit`. sbx fournit maintenant l'agent `codex` sous forme de kit au nouveau format (v3), qui ne se combine qu'avec des kits v3 : nommez plutôt `docker.io/sbx/codex-acp:latest`, puis redémarrez l'agent.87 - **`cannot mix v3 kits with v1/v2 kits in one sandbox`** à la création de la sandbox : le `sbxenv.yaml` nomme l'ancien kit `docker.io/sbx/codex-acp-kit`. sbx fournit maintenant l'agent `codex` sous forme de kit au nouveau format (v3), qui ne se combine qu'avec des kits v3 : nommez plutôt `docker.io/sbx/codex-acp:latest`, puis redémarrez l'agent.
88+- **`executable file … codex-acp not found`** (exit status 127) : l'agent tourne dans une autre sandbox — le log montre alors le démarrage d'une autre sandbox, par exemple `claude-acp`. L'assistant refuse désormais un `sbxenv.yaml` dont l'`agent:` n'est pas celui du programme ; dans **Settings**, vérifiez que le nom de la sandbox est `codex-acp` dans `args`, `runtime.sandbox` et `lifecycle`, et que `workspace` et `lifecycle.folder` sont les dossiers de Codex.
88 - **Une erreur d'authentification** dans l'onglet **Log** : les identifiants ne sont pas enregistrés dans sbx, ou l'ont été après la création de la sandbox. Enregistrez-les de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent.89 - **Une erreur d'authentification** dans l'onglet **Log** : les identifiants ne sont pas enregistrés dans sbx, ou l'ont été après la création de la sandbox. Enregistrez-les de nouveau, puis **🗑 Supprimer la sandbox** et démarrez l'agent.
89 90
90 ## Voir aussi91 ## Voir aussi
modified frontend/bindings/git.rickub.com/bots-garden/sidekicks/internal/app/models.ts +5 -0
@@ -159,6 +159,11 @@ export interface ResetResult {
159159 */
160160 export interface SandboxEnv {
161161 "name": string;
162+
163+ /**
164+ * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude.
165+ */
166+ "agent": string;
162167 "workspace": string;
163168 "sandboxFolder": string;
164169 "createCommand": string;
@@ -159,6 +159,11 @@ export interface ResetResult {
159 */159 */
160 export interface SandboxEnv {160 export interface SandboxEnv {
161 "name": string;161 "name": string;
162+
163+ /**
164+ * Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude.
165+ */
166+ "agent": string;
162 "workspace": string;167 "workspace": string;
163 "sandboxFolder": string;168 "sandboxFolder": string;
164 "createCommand": string;169 "createCommand": string;
modified frontend/src/lib/agent/AddAgentForm.svelte +9 -2
@@ -7,7 +7,7 @@
77 import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
88 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'
99 import { FilesDropped } from '../../../bindings/events'
10- import { argumentsFor, emptyForm, nameFromTitle, sbxAgentOf, sbxArguments, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform'
10+ import { argumentsFor, emptyForm, nameFromTitle, sandboxMismatch, sbxAgentOf, sbxArguments, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform'
1111 import { subscribe } from '../events'
1212 import AgentAvatar from './AgentAvatar.svelte'
1313 import { agentAdded, appState } from '../state.svelte'
@@ -23,6 +23,8 @@
2323 // Why the last sbx environment file could not be read, and which one was.
2424 let envProblem = $state('')
2525 let envFile = $state('')
26+ // The sbx agent of that file ("agent:"), to catch Codex given Claude's sandbox.
27+ let envAgent = $state('')
2628 // The agent's configuration file dropped or chosen, and why one was refused.
2729 let configFile = $state('')
2830 let configProblem = $state('')
@@ -94,6 +96,7 @@
9496 const env = await ConfigService.ReadSandboxEnv(path)
9597 form = withSandboxEnv(form, env)
9698 envFile = path
99+ envAgent = env.agent ?? ''
97100 } catch (error) {
98101 envProblem = error instanceof Error ? error.message : String(error)
99102 }
@@ -103,6 +106,7 @@
103106 // Claude, Codex or Gemini in an sbx sandbox (issues #81, #82, #84): its
104107 // sbxenv.yaml, dropped above, gives the sandbox; it needs no configuration file.
105108 const sbxAgent = $derived(sbxAgentOf(form))
109+ const mismatch = $derived(sandboxMismatch(form, envAgent))
106110
107111 function useAgentConfig(path: string) {
108112 if (!/\.ya?ml$/i.test(path)) {
@@ -152,7 +156,7 @@
152156 tried = true
153157 refused = []
154158 failure = ''
155- if (missing.length > 0) return
159+ if (missing.length > 0 || mismatch) return
156160 adding = true
157161 try {
158162 const problems = (await ConfigService.AddAgent({ ...form, title: form.title.trim() || form.name })) ?? []
@@ -277,6 +281,9 @@
277281 {#if sbxAgent}
278282 <small class="note">{t(`assistant.${sbxAgent}Note`)}</small>
279283 {/if}
284+ {#if mismatch && sbxAgent}
285+ <small class="problem" role="alert">{t('assistant.sandboxMismatch', { file: envFile, agent: mismatch, wanted: sbxAgent })}</small>
286+ {/if}
280287 <!-- Wherever the agent runs: sbx mounts the shared host folders at the
281288 same path, and so must the container (as with docker exec today), so
282289 the file's path on this computer is also its path there. -->
@@ -7,7 +7,7 @@
7 import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'7 import { ConfigService } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/app'
8 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'8 import type { FilesDroppedPayload } from '../../../bindings/git.rickub.com/bots-garden/sidekicks/internal/events'
9 import { FilesDropped } from '../../../bindings/events'9 import { FilesDropped } from '../../../bindings/events'
10- import { argumentsFor, emptyForm, nameFromTitle, sbxAgentOf, sbxArguments, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform'10+ import { argumentsFor, emptyForm, nameFromTitle, sandboxMismatch, sbxAgentOf, sbxArguments, problemsOf, programsFor, withAgentConfig, withComposeService, withSandboxEnv, type ComposeServiceValues, type Environment, type Missing } from '../agentform'
11 import { subscribe } from '../events'11 import { subscribe } from '../events'
12 import AgentAvatar from './AgentAvatar.svelte'12 import AgentAvatar from './AgentAvatar.svelte'
13 import { agentAdded, appState } from '../state.svelte'13 import { agentAdded, appState } from '../state.svelte'
@@ -23,6 +23,8 @@
23 // Why the last sbx environment file could not be read, and which one was.23 // Why the last sbx environment file could not be read, and which one was.
24 let envProblem = $state('')24 let envProblem = $state('')
25 let envFile = $state('')25 let envFile = $state('')
26+ // The sbx agent of that file ("agent:"), to catch Codex given Claude's sandbox.
27+ let envAgent = $state('')
26 // The agent's configuration file dropped or chosen, and why one was refused.28 // The agent's configuration file dropped or chosen, and why one was refused.
27 let configFile = $state('')29 let configFile = $state('')
28 let configProblem = $state('')30 let configProblem = $state('')
@@ -94,6 +96,7 @@
94 const env = await ConfigService.ReadSandboxEnv(path)96 const env = await ConfigService.ReadSandboxEnv(path)
95 form = withSandboxEnv(form, env)97 form = withSandboxEnv(form, env)
96 envFile = path98 envFile = path
99+ envAgent = env.agent ?? ''
97 } catch (error) {100 } catch (error) {
98 envProblem = error instanceof Error ? error.message : String(error)101 envProblem = error instanceof Error ? error.message : String(error)
99 }102 }
@@ -103,6 +106,7 @@
103 // Claude, Codex or Gemini in an sbx sandbox (issues #81, #82, #84): its106 // Claude, Codex or Gemini in an sbx sandbox (issues #81, #82, #84): its
104 // sbxenv.yaml, dropped above, gives the sandbox; it needs no configuration file.107 // sbxenv.yaml, dropped above, gives the sandbox; it needs no configuration file.
105 const sbxAgent = $derived(sbxAgentOf(form))108 const sbxAgent = $derived(sbxAgentOf(form))
109+ const mismatch = $derived(sandboxMismatch(form, envAgent))
106 110
107 function useAgentConfig(path: string) {111 function useAgentConfig(path: string) {
108 if (!/\.ya?ml$/i.test(path)) {112 if (!/\.ya?ml$/i.test(path)) {
@@ -152,7 +156,7 @@
152 tried = true156 tried = true
153 refused = []157 refused = []
154 failure = ''158 failure = ''
155- if (missing.length > 0) return159+ if (missing.length > 0 || mismatch) return
156 adding = true160 adding = true
157 try {161 try {
158 const problems = (await ConfigService.AddAgent({ ...form, title: form.title.trim() || form.name })) ?? []162 const problems = (await ConfigService.AddAgent({ ...form, title: form.title.trim() || form.name })) ?? []
@@ -277,6 +281,9 @@
277 {#if sbxAgent}281 {#if sbxAgent}
278 <small class="note">{t(`assistant.${sbxAgent}Note`)}</small>282 <small class="note">{t(`assistant.${sbxAgent}Note`)}</small>
279 {/if}283 {/if}
284+ {#if mismatch && sbxAgent}
285+ <small class="problem" role="alert">{t('assistant.sandboxMismatch', { file: envFile, agent: mismatch, wanted: sbxAgent })}</small>
286+ {/if}
280 <!-- Wherever the agent runs: sbx mounts the shared host folders at the287 <!-- Wherever the agent runs: sbx mounts the shared host folders at the
281 same path, and so must the container (as with docker exec today), so288 same path, and so must the container (as with docker exec today), so
282 the file's path on this computer is also its path there. -->289 the file's path on this computer is also its path there. -->
modified frontend/src/lib/agentform.test.ts +14 -1
@@ -1,7 +1,7 @@
11 // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
22
33 import { describe, expect, it } from 'vitest'
4-import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, sbxAgentOf, sbxArguments, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform'
4+import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, sandboxMismatch, sbxAgentOf, sbxArguments, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform'
55
66 describe('nameFromTitle', () => {
77 it('folds accents, lowercases and joins words', () => {
@@ -130,3 +130,16 @@ describe('Codex and Gemini in an sbx sandbox (issues #82, #84)', () => {
130130 expect(sbxAgentOf({ ...emptyForm(), environment: 'local', program: 'gemini' })).toBeUndefined()
131131 })
132132 })
133+
134+describe('sandboxMismatch', () => {
135+ const codex = { ...emptyForm(), environment: 'sbx' as const, program: '/home/agent/.local/bin/codex-acp' }
136+ it("names the file's agent when it is not the program's", () => {
137+ expect(sandboxMismatch(codex, 'claude')).toBe('claude')
138+ })
139+ it('is empty when they match, or when one of them is unknown', () => {
140+ expect(sandboxMismatch(codex, 'codex')).toBe('')
141+ expect(sandboxMismatch(codex, '')).toBe('')
142+ expect(sandboxMismatch(codex, undefined)).toBe('')
143+ expect(sandboxMismatch({ ...codex, program: 'mm' }, 'claude')).toBe('')
144+ })
145+})
@@ -1,7 +1,7 @@
1 // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE1 // Copyright (c) 2026 Philippe Charrière — Sidekicks Source-Available License 1.0, see LICENSE
2 2
3 import { describe, expect, it } from 'vitest'3 import { describe, expect, it } from 'vitest'
4-import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, sbxAgentOf, sbxArguments, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform'4+import { argumentsFor, emptyForm, folderOf, isClaudeSandbox, sandboxMismatch, sbxAgentOf, sbxArguments, nameFromTitle, problemsOf, programsFor, quoteArgument, withAgentConfig, withComposeService, withSandboxEnv } from './agentform'
5 5
6 describe('nameFromTitle', () => {6 describe('nameFromTitle', () => {
7 it('folds accents, lowercases and joins words', () => {7 it('folds accents, lowercases and joins words', () => {
@@ -130,3 +130,16 @@ describe('Codex and Gemini in an sbx sandbox (issues #82, #84)', () => {
130 expect(sbxAgentOf({ ...emptyForm(), environment: 'local', program: 'gemini' })).toBeUndefined()130 expect(sbxAgentOf({ ...emptyForm(), environment: 'local', program: 'gemini' })).toBeUndefined()
131 })131 })
132 })132 })
133+
134+describe('sandboxMismatch', () => {
135+ const codex = { ...emptyForm(), environment: 'sbx' as const, program: '/home/agent/.local/bin/codex-acp' }
136+ it("names the file's agent when it is not the program's", () => {
137+ expect(sandboxMismatch(codex, 'claude')).toBe('claude')
138+ })
139+ it('is empty when they match, or when one of them is unknown', () => {
140+ expect(sandboxMismatch(codex, 'codex')).toBe('')
141+ expect(sandboxMismatch(codex, '')).toBe('')
142+ expect(sandboxMismatch(codex, undefined)).toBe('')
143+ expect(sandboxMismatch({ ...codex, program: 'mm' }, 'claude')).toBe('')
144+ })
145+})
modified frontend/src/lib/agentform.ts +16 -0
@@ -34,6 +34,8 @@ export function emptyForm(): AgentFormValues {
3434 /** What ConfigService.ReadSandboxEnv reads in an sbx environment file. */
3535 export interface SandboxEnvValues {
3636 name: string
37+ /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */
38+ agent?: string
3739 workspace: string
3840 sandboxFolder: string
3941 createCommand: string
@@ -160,6 +162,20 @@ export function sbxAgentOf(form: AgentFormValues): SbxAgent | undefined {
160162 return undefined
161163 }
162164
165+/**
166+ * The sbx agent of the sandbox file read, when it is not the one the program
167+ * needs: Codex started in Claude's sandbox does not find its adapter. ''
168+ * when they match, or when the program or the file names no known agent.
169+ *
170+ * @example
171+ * sandboxMismatch({ ...form, environment: 'sbx', program: 'codex-acp' }, 'claude') // 'claude'
172+ */
173+export function sandboxMismatch(form: AgentFormValues, envAgent: string | undefined): string {
174+ const wanted = sbxAgentOf(form)
175+ const agent = (envAgent ?? '').trim()
176+ return wanted && agent && agent !== wanted ? agent : ''
177+}
178+
163179 /** Whether the form describes Claude in an sbx sandbox. */
164180 export function isClaudeSandbox(form: AgentFormValues): boolean {
165181 return sbxAgentOf(form) === 'claude'
@@ -34,6 +34,8 @@ export function emptyForm(): AgentFormValues {
34 /** What ConfigService.ReadSandboxEnv reads in an sbx environment file. */34 /** What ConfigService.ReadSandboxEnv reads in an sbx environment file. */
35 export interface SandboxEnvValues {35 export interface SandboxEnvValues {
36 name: string36 name: string
37+ /** The sbx agent of the sandbox ("agent:" of the file), such as claude. */
38+ agent?: string
37 workspace: string39 workspace: string
38 sandboxFolder: string40 sandboxFolder: string
39 createCommand: string41 createCommand: string
@@ -160,6 +162,20 @@ export function sbxAgentOf(form: AgentFormValues): SbxAgent | undefined {
160 return undefined162 return undefined
161 }163 }
162 164
165+/**
166+ * The sbx agent of the sandbox file read, when it is not the one the program
167+ * needs: Codex started in Claude's sandbox does not find its adapter. ''
168+ * when they match, or when the program or the file names no known agent.
169+ *
170+ * @example
171+ * sandboxMismatch({ ...form, environment: 'sbx', program: 'codex-acp' }, 'claude') // 'claude'
172+ */
173+export function sandboxMismatch(form: AgentFormValues, envAgent: string | undefined): string {
174+ const wanted = sbxAgentOf(form)
175+ const agent = (envAgent ?? '').trim()
176+ return wanted && agent && agent !== wanted ? agent : ''
177+}
178+
163 /** Whether the form describes Claude in an sbx sandbox. */179 /** Whether the form describes Claude in an sbx sandbox. */
164 export function isClaudeSandbox(form: AgentFormValues): boolean {180 export function isClaudeSandbox(form: AgentFormValues): boolean {
165 return sbxAgentOf(form) === 'claude'181 return sbxAgentOf(form) === 'claude'
modified frontend/src/lib/i18n/messages.ts +2 -0
@@ -360,6 +360,7 @@ export const en = {
360360 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.',
361361 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp, codex-acp, gemini (arguments --acp): Claude, Codex or Gemini, with the sbxenv.yaml of its sandbox dropped above.',
362362 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".',
363+ 'assistant.sandboxMismatch': '{file} describes a sandbox for the sbx agent "{agent}", not "{wanted}": this program would not be found there. Choose the sbxenv.yaml of the right sandbox above.',
363364 'assistant.codexNote': 'Codex runs from the docker.io/sbx/codex-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Sign in to ChatGPT or store your OpenAI API key in sbx before starting it: see the guide "Add a Codex agent in an sbx sandbox".',
364365 'assistant.geminiNote': 'Gemini runs from the docker.io/sbx/gemini-kit kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Gemini API key in sbx before starting it: see the guide "Add a Gemini agent in an sbx sandbox".',
365366 'assistant.arguments': 'Arguments',
@@ -749,6 +750,7 @@ export const fr: Record<MessageKey, string> = {
749750 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.",
750751 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp, codex-acp, gemini (arguments --acp) : Claude, Codex ou Gemini, avec le sbxenv.yaml de sa sandbox déposé plus haut.",
751752 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».",
753+ 'assistant.sandboxMismatch': "{file} décrit une sandbox pour l'agent sbx « {agent} », pas « {wanted} » : ce programme n'y serait pas trouvé. Choisissez plus haut le sbxenv.yaml de la bonne sandbox.",
752754 'assistant.codexNote': "Codex tourne grâce au kit docker.io/sbx/codex-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Connectez-vous à ChatGPT ou enregistrez votre clé d'API OpenAI dans sbx avant de le démarrer : voir le guide « Ajouter un agent Codex dans une sandbox sbx ».",
753755 'assistant.geminiNote': "Gemini tourne grâce au kit docker.io/sbx/gemini-kit nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Gemini dans sbx avant de le démarrer : voir le guide « Ajouter un agent Gemini dans une sandbox sbx ».",
754756 'assistant.arguments': 'Arguments',
@@ -360,6 +360,7 @@ export const en = {
360 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.',360 'assistant.programHint': 'The agent\'s program, as you would type it in a terminal: choose one in the list or type another. It must speak ACP.',
361 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp, codex-acp, gemini (arguments --acp): Claude, Codex or Gemini, with the sbxenv.yaml of its sandbox dropped above.',361 'assistant.programHintSbx': 'The agent\'s program inside the sandbox, as you would type it in a terminal: choose one in the list or type another. It must speak ACP. claude-agent-acp, codex-acp, gemini (arguments --acp): Claude, Codex or Gemini, with the sbxenv.yaml of its sandbox dropped above.',
362 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".',362 'assistant.claudeNote': 'Claude runs from the docker.io/sbx/claude-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Anthropic API key in sbx before starting it: see the guide "Add a Claude agent in an sbx sandbox".',
363+ 'assistant.sandboxMismatch': '{file} describes a sandbox for the sbx agent "{agent}", not "{wanted}": this program would not be found there. Choose the sbxenv.yaml of the right sandbox above.',
363 'assistant.codexNote': 'Codex runs from the docker.io/sbx/codex-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Sign in to ChatGPT or store your OpenAI API key in sbx before starting it: see the guide "Add a Codex agent in an sbx sandbox".',364 'assistant.codexNote': 'Codex runs from the docker.io/sbx/codex-acp kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Sign in to ChatGPT or store your OpenAI API key in sbx before starting it: see the guide "Add a Codex agent in an sbx sandbox".',
364 'assistant.geminiNote': 'Gemini runs from the docker.io/sbx/gemini-kit kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Gemini API key in sbx before starting it: see the guide "Add a Gemini agent in an sbx sandbox".',365 'assistant.geminiNote': 'Gemini runs from the docker.io/sbx/gemini-kit kit named in the sbxenv.yaml: a third party provides it, not Sidekicks. Store your Gemini API key in sbx before starting it: see the guide "Add a Gemini agent in an sbx sandbox".',
365 'assistant.arguments': 'Arguments',366 'assistant.arguments': 'Arguments',
@@ -749,6 +750,7 @@ export const fr: Record<MessageKey, string> = {
749 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.",750 'assistant.programHint': "Le programme de l'agent, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP.",
750 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp, codex-acp, gemini (arguments --acp) : Claude, Codex ou Gemini, avec le sbxenv.yaml de sa sandbox déposé plus haut.",751 'assistant.programHintSbx': "Le programme de l'agent dans la sandbox, tel que vous le taperiez dans un terminal : choisissez-en un dans la liste ou tapez-en un autre. Il doit parler ACP. claude-agent-acp, codex-acp, gemini (arguments --acp) : Claude, Codex ou Gemini, avec le sbxenv.yaml de sa sandbox déposé plus haut.",
751 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».",752 'assistant.claudeNote': "Claude tourne grâce au kit docker.io/sbx/claude-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Anthropic dans sbx avant de le démarrer : voir le guide « Ajouter un agent Claude dans une sandbox sbx ».",
753+ 'assistant.sandboxMismatch': "{file} décrit une sandbox pour l'agent sbx « {agent} », pas « {wanted} » : ce programme n'y serait pas trouvé. Choisissez plus haut le sbxenv.yaml de la bonne sandbox.",
752 'assistant.codexNote': "Codex tourne grâce au kit docker.io/sbx/codex-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Connectez-vous à ChatGPT ou enregistrez votre clé d'API OpenAI dans sbx avant de le démarrer : voir le guide « Ajouter un agent Codex dans une sandbox sbx ».",754 'assistant.codexNote': "Codex tourne grâce au kit docker.io/sbx/codex-acp nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Connectez-vous à ChatGPT ou enregistrez votre clé d'API OpenAI dans sbx avant de le démarrer : voir le guide « Ajouter un agent Codex dans une sandbox sbx ».",
753 'assistant.geminiNote': "Gemini tourne grâce au kit docker.io/sbx/gemini-kit nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Gemini dans sbx avant de le démarrer : voir le guide « Ajouter un agent Gemini dans une sandbox sbx ».",755 'assistant.geminiNote': "Gemini tourne grâce au kit docker.io/sbx/gemini-kit nommé dans le sbxenv.yaml : il est fourni par un tiers, pas par Sidekicks. Enregistrez votre clé d'API Gemini dans sbx avant de le démarrer : voir le guide « Ajouter un agent Gemini dans une sandbox sbx ».",
754 'assistant.arguments': 'Arguments',756 'assistant.arguments': 'Arguments',
modified internal/app/sandboxes.go +4 -2
@@ -46,7 +46,9 @@ func (c *Core) sandboxAction(ctx context.Context, name string, action lifecycle.
4646 // assistant: the sandbox's name, the agent's folder, and its commands on one
4747 // line each, ready for the form's fields.
4848 type SandboxEnv struct {
49- Name string `json:"name"`
49+ Name string `json:"name"`
50+ // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude.
51+ Agent string `json:"agent"`
5052 Workspace string `json:"workspace"`
5153 SandboxFolder string `json:"sandboxFolder"`
5254 CreateCommand string `json:"createCommand"`
@@ -65,7 +67,7 @@ func (s *ConfigService) ReadSandboxEnv(path string) (SandboxEnv, error) {
6567 return SandboxEnv{}, err
6668 }
6769 return SandboxEnv{
68- Name: env.Name, Workspace: env.Workspace, SandboxFolder: env.Folder,
70+ Name: env.Name, Agent: env.Agent, Workspace: env.Workspace, SandboxFolder: env.Folder,
6971 CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove),
7072 }, nil
7173 }
@@ -46,7 +46,9 @@ func (c *Core) sandboxAction(ctx context.Context, name string, action lifecycle.
46 // assistant: the sandbox's name, the agent's folder, and its commands on one46 // assistant: the sandbox's name, the agent's folder, and its commands on one
47 // line each, ready for the form's fields.47 // line each, ready for the form's fields.
48 type SandboxEnv struct {48 type SandboxEnv struct {
49- Name string `json:"name"`49+ Name string `json:"name"`
50+ // Agent is the sbx agent of the sandbox ("agent:" of the file), such as claude.
51+ Agent string `json:"agent"`
50 Workspace string `json:"workspace"`52 Workspace string `json:"workspace"`
51 SandboxFolder string `json:"sandboxFolder"`53 SandboxFolder string `json:"sandboxFolder"`
52 CreateCommand string `json:"createCommand"`54 CreateCommand string `json:"createCommand"`
@@ -65,7 +67,7 @@ func (s *ConfigService) ReadSandboxEnv(path string) (SandboxEnv, error) {
65 return SandboxEnv{}, err67 return SandboxEnv{}, err
66 }68 }
67 return SandboxEnv{69 return SandboxEnv{
68- Name: env.Name, Workspace: env.Workspace, SandboxFolder: env.Folder,70+ Name: env.Name, Agent: env.Agent, Workspace: env.Workspace, SandboxFolder: env.Folder,
69 CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove),71 CreateCommand: joinArguments(env.Create), StopCommand: joinArguments(env.Stop), RemoveCommand: joinArguments(env.Remove),
70 }, nil72 }, nil
71 }73 }
modified internal/app/sandboxes_test.go +1 -1
@@ -114,7 +114,7 @@ func TestReadSandboxEnvFillsTheAssistant(t *testing.T) {
114114 t.Fatal(err)
115115 }
116116 want := app.SandboxEnv{
117- Name: "milo-sbx", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir,
117+ Name: "milo-sbx", Agent: "mini-me-kit", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir,
118118 CreateCommand: `sbx env create "dev env.yaml" --force`, StopCommand: "sbx stop milo-sbx", RemoveCommand: `sbx env rm "dev env.yaml" --force`,
119119 }
120120 if env != want {
@@ -114,7 +114,7 @@ func TestReadSandboxEnvFillsTheAssistant(t *testing.T) {
114 t.Fatal(err)114 t.Fatal(err)
115 }115 }
116 want := app.SandboxEnv{116 want := app.SandboxEnv{
117- Name: "milo-sbx", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir,117+ Name: "milo-sbx", Agent: "mini-me-kit", Workspace: filepath.Join(dir, "workspace"), SandboxFolder: dir,
118 CreateCommand: `sbx env create "dev env.yaml" --force`, StopCommand: "sbx stop milo-sbx", RemoveCommand: `sbx env rm "dev env.yaml" --force`,118 CreateCommand: `sbx env create "dev env.yaml" --force`, StopCommand: "sbx stop milo-sbx", RemoveCommand: `sbx env rm "dev env.yaml" --force`,
119 }119 }
120 if env != want {120 if env != want {
modified internal/lifecycle/sbxenv.go +3 -1
@@ -23,6 +23,8 @@ var ErrNotSbxEnv = errors.New("not an sbx environment file (sbxenv.yaml)")
2323 type SbxEnv struct {
2424 // Name is the sandbox's name ("name:"); "" when the file does not set it.
2525 Name string
26+ // Agent is the sbx agent of the sandbox ("agent:"), such as claude or codex.
27+ Agent string
2628 // Folder is the folder of the file: the commands run there.
2729 Folder string
2830 // Workspace is the absolute host folder the sandbox mounts ("workspace:");
@@ -64,7 +66,7 @@ func ReadSbxEnv(path string) (SbxEnv, error) {
6466 if file.SchemaVersion == "" && file.Agent == "" && len(file.Kits) == 0 {
6567 return SbxEnv{}, ErrNotSbxEnv
6668 }
67- env := SbxEnv{Name: file.Name, Folder: filepath.Dir(absolute)}
69+ env := SbxEnv{Name: file.Name, Agent: file.Agent, Folder: filepath.Dir(absolute)}
6870 // A path built from ${{ … }} values is only known to sbx: it is left out.
6971 if workspace := workspacePath(&file.Workspace); workspace != "" && !strings.Contains(workspace, "${{") {
7072 if !filepath.IsAbs(workspace) {
@@ -23,6 +23,8 @@ var ErrNotSbxEnv = errors.New("not an sbx environment file (sbxenv.yaml)")
23 type SbxEnv struct {23 type SbxEnv struct {
24 // Name is the sandbox's name ("name:"); "" when the file does not set it.24 // Name is the sandbox's name ("name:"); "" when the file does not set it.
25 Name string25 Name string
26+ // Agent is the sbx agent of the sandbox ("agent:"), such as claude or codex.
27+ Agent string
26 // Folder is the folder of the file: the commands run there.28 // Folder is the folder of the file: the commands run there.
27 Folder string29 Folder string
28 // Workspace is the absolute host folder the sandbox mounts ("workspace:");30 // Workspace is the absolute host folder the sandbox mounts ("workspace:");
@@ -64,7 +66,7 @@ func ReadSbxEnv(path string) (SbxEnv, error) {
64 if file.SchemaVersion == "" && file.Agent == "" && len(file.Kits) == 0 {66 if file.SchemaVersion == "" && file.Agent == "" && len(file.Kits) == 0 {
65 return SbxEnv{}, ErrNotSbxEnv67 return SbxEnv{}, ErrNotSbxEnv
66 }68 }
67- env := SbxEnv{Name: file.Name, Folder: filepath.Dir(absolute)}69+ env := SbxEnv{Name: file.Name, Agent: file.Agent, Folder: filepath.Dir(absolute)}
68 // A path built from ${{ … }} values is only known to sbx: it is left out.70 // A path built from ${{ … }} values is only known to sbx: it is left out.
69 if workspace := workspacePath(&file.Workspace); workspace != "" && !strings.Contains(workspace, "${{") {71 if workspace := workspacePath(&file.Workspace); workspace != "" && !strings.Contains(workspace, "${{") {
70 if !filepath.IsAbs(workspace) {72 if !filepath.IsAbs(workspace) {
modified internal/lifecycle/sbxenv_test.go +8 -0
@@ -91,3 +91,11 @@ func TestTheSnippetsSandboxesAreRead(t *testing.T) {
9191 }
9292 }
9393 }
94+
95+func TestReadSbxEnvGivesTheAgent(t *testing.T) {
96+ path := write(t, t.TempDir(), "sbxenv.yaml", "name: codex-acp\nagent: codex\n")
97+ env, err := lifecycle.ReadSbxEnv(path)
98+ if err != nil || env.Agent != "codex" {
99+ t.Fatalf("got %+v, %v", env, err)
100+ }
101+}
@@ -91,3 +91,11 @@ func TestTheSnippetsSandboxesAreRead(t *testing.T) {
91 }91 }
92 }92 }
93 }93 }
94+
95+func TestReadSbxEnvGivesTheAgent(t *testing.T) {
96+ path := write(t, t.TempDir(), "sbxenv.yaml", "name: codex-acp\nagent: codex\n")
97+ env, err := lifecycle.ReadSbxEnv(path)
98+ if err != nil || env.Agent != "codex" {
99+ t.Fatalf("got %+v, %v", env, err)
100+ }
101+}