Skip to content

Commit 187eec6

Browse files
committed
Distinguish the three prerequisite-check failure modes
`foundry version`, `foundry profile active`, and `foundry apps list` fail for unrelated reasons, and the skill treated them as one class, so an agent that hit any of them went looking for broken credentials. Only `apps list` reaches the tenant; the other two read local state. So a failure there while `profile active` succeeds rules out credentials and points at network, an approval gate, or an old CLI. `apps list` also landed in CLI 2.0.2, and on anything older it fails as an unknown command, which reads like an auth error but is not one. It exists to catch app-name collisions, so skipping it costs a collision check rather than the workflow. Adds the approval-gate case, which assistants that run only a small trusted command set unattended will hit on every `foundry` call. A denied or still-pending command has produced no evidence either way, so it should not be retried in a loop or answered by rewriting profiles and config paths. Ask once, or hand the user the command. Detail lives in the headless-operation reference because SKILL.md is at 99% of its size budget.
1 parent 3fe8fb9 commit 187eec6

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

skills/development-workflow/SKILL.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,15 @@ For other decisions, prefer reasonable defaults: use React for UI, download publ
142142

143143
```bash
144144
foundry version # Verify CLI installed
145-
foundry profile active # Verify authentication
146-
foundry apps list # Check existing apps (avoid name collisions)
145+
foundry profile active # Verify credentials (reads local config only)
146+
foundry apps list # First call that reaches the tenant; CLI 2.0.2+
147147
```
148148

149-
If any of these fail, see [headless operation](references/headless-operation.md)
150-
for setup options (env vars, non-interactive profile creation) and sandbox
151-
diagnostics. Never copy credentials into the workspace.
149+
`foundry apps list` is optional, for avoiding name collisions. An "unknown
150+
command" error means a CLI older than 2.0.2, not broken auth. Because it is the
151+
first command to reach the tenant, failing it while `profile active` succeeds
152+
points at network or a pending approval prompt rather than credentials. See
153+
[headless operation](references/headless-operation.md).
152154

153155
### Step 4: Scaffold the App
154156

skills/development-workflow/references/headless-operation.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,24 @@ When operating as a CLI agent:
116116
6. **Headless mode** is detected automatically by Foundry CLI v2.0.1+. For older versions or standalone scripts/CI, export `FOUNDRY_UI_HEADLESS_MODE=true` manually.
117117
7. **Choose the app directory automatically:** Use the current directory unless it is an unrelated repository; in that case use a sibling directory and request write access if the sandbox requires it.
118118

119+
### Distinguishing prerequisite failures
120+
121+
The three prerequisite commands fail for different reasons, and treating them alike sends the diagnosis down the wrong path:
122+
123+
| Command | Reaches tenant? | A failure means |
124+
|---------|-----------------|-----------------|
125+
| `foundry version` | No | CLI not installed or not on `PATH` |
126+
| `foundry profile active` | No, reads local config | No profile configured — set env vars or create one non-interactively |
127+
| `foundry apps list` | Yes | Network, an approval gate, or a CLI older than 2.0.2 — not credentials, if `profile active` succeeded |
128+
129+
`foundry apps list` arrived in Foundry CLI 2.0.2. On an older CLI it fails as an unknown or unrecognized command, which is not an authentication problem. Report the CLI version and move on; the command is only there to avoid app-name collisions, so losing it costs a collision check, not the workflow.
130+
131+
### Commands gated behind user approval
132+
133+
Some assistants run only a small trusted set of commands (`ls`, `cat`, `sed`) unattended and escalate everything else for user approval. `foundry` is never in that set, so every invocation can surface an approval request.
134+
135+
A command that was denied, or that never ran because approval was still pending, has produced no evidence about credentials or connectivity. Do not treat it as an auth failure, do not retry it in a loop hoping it slips through, and do not start rewriting profiles or config paths. Ask the user once to approve it, or give them the command to run and paste back. If the assistant supports a persistent allowlist, suggest adding read-only Foundry commands to it so the prerequisite check stops prompting.
136+
119137
### Sandboxed assistants
120138

121139
Some assistants run shell commands with network sandboxing. A profile command can succeed because it only reads local configuration, while a tenant command such as `foundry apps list` or `foundry apps validate` fails with only `connection issue`. The CLI holds client credentials on disk and exchanges them for a short-lived token in memory on each run, so it never needs to write to the config directory — a tenant failure points at network access, not file permissions.

0 commit comments

Comments
 (0)