Repository navigation
Set up new worktrees from the repo's devcontainer.json or copilot-setup-steps.yml - #1709
Conversation
…p-steps.yml (#396) When neither project settings nor solenta.json define a setup, a new worktree runs the setup the repo already declares: devcontainer lifecycle commands (onCreate/updateContent/postCreate) or the copilot-setup-steps job's run steps, on the host. The spec's env (containerEnv/remoteEnv, workflow/job env) reaches agents, setup/verify, terminals and dev servers once approved. Both join solenta.json's approval hash, so editing the spec re-prompts before anything runs. runVerifyCommand no longer truncates at 500 chars: callers already cap, and a spec's multi-line setup cut short would run half a script. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3bb0940e0c
ℹ️ 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".
| if (step.shell && !/^(bash|sh)\b/.test(step.shell)) continue; | ||
| const wd = typeof step["working-directory"] === "string" ? step["working-directory"] : ""; | ||
| cmds.push(wd ? `(\ncd ${shQuote(wd)}\n${step.run.trim()}\n)` : step.run.trim()); |
There was a problem hiding this comment.
Execute Bash workflow steps with Bash
On Linux hosts where /bin/sh is not Bash, accepted workflow steps containing Bash syntax fail because runVerifyCommand executes the generated script with /bin/sh -c. For example, a step explicitly declaring shell: bash with items=(one two) fails with Syntax error: "(" unexpected. Preserve the selected shell when generating or executing each step instead of treating Bash and POSIX sh as interchangeable.
Useful? React with 👍 / 👎.
| for (const step of job.steps) { | ||
| if (!step || typeof step.run !== "string" || !step.run.trim()) continue; | ||
| if (step.shell && !/^(bash|sh)\b/.test(step.shell)) continue; | ||
| const wd = typeof step["working-directory"] === "string" ? step["working-directory"] : ""; | ||
| cmds.push(wd ? `(\ncd ${shQuote(wd)}\n${step.run.trim()}\n)` : step.run.trim()); |
There was a problem hiding this comment.
Respect conditions before including workflow steps
Workflow steps with if: conditions are currently included unconditionally. A workflow containing if: false and run: echo should-not-run produces a setup script that executes that command; similarly, OS-specific installation steps execute on incompatible hosts. Honor conditions that can be evaluated locally and reject or explicitly skip unsupported conditions rather than silently removing their execution guard.
Useful? React with 👍 / 👎.
| if (!step || typeof step.run !== "string" || !step.run.trim()) continue; | ||
| if (step.shell && !/^(bash|sh)\b/.test(step.shell)) continue; | ||
| const wd = typeof step["working-directory"] === "string" ? step["working-directory"] : ""; | ||
| cmds.push(wd ? `(\ncd ${shQuote(wd)}\n${step.run.trim()}\n)` : step.run.trim()); |
There was a problem hiding this comment.
Preserve step-scoped environment variables
When a setup step declares its own env, those values are discarded before its command runs: only workflow and job env are collected below, and no step-specific environment is added here. For example, a step with env: { INSTALL_MODE: development } that checks or consumes $INSTALL_MODE runs without that value, causing setup to fail or install the wrong configuration. Apply each step's literal env values within that step's execution scope, including their precedence over job env.
Useful? React with 👍 / 👎.
| return { file, error: `${file} must be a JSON object` }; | ||
| } | ||
| const cmds = DEVCONTAINER_STAGES.map((k) => lifecycleCommand(data[k])).filter(Boolean); | ||
| return finish(file, cmds.join(" && "), stringEnv(data.containerEnv, data.remoteEnv)); |
There was a problem hiding this comment.
Isolate lifecycle commands before joining them
A valid lifecycle command ending in a shell comment swallows every subsequent stage because the commands are concatenated on the same line. For example, onCreateCommand: "echo created # comment" followed by postCreateCommand: "npm ci" becomes echo created # comment && npm ci, reports success, and never installs dependencies. Delimit each lifecycle command as a separate shell group with newline boundaries; the same issue also affects named commands joined inside lifecycleCommand.
Useful? React with 👍 / 👎.
) #1708 added solenta.local.json and its own setupSource; both now share one field. A local or shared solenta.json setup still beats the repo's env spec. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New worktrees now set themselves up the way the repo already describes. When neither project settings nor
solenta.jsondefine a setup, Solenta reads.devcontainer/devcontainer.json(or.devcontainer.json), or.github/workflows/copilot-setup-steps.yml, and runs that setup in the worktree. Closes the setup and env part of #396.Changes
onCreateCommand,updateContentCommandandpostCreateCommandrun in order on the host, with workspace-folder and${localEnv:X}variables rewritten for a host shell. copilot-setup-steps: the job'srun:steps become one script underset -e, which matches Actions'bash -e.uses:steps, steps in other shells, and${{ }}env values are skipped. Which setup wins: project settings, thensolenta.json, then the spec.solenta.json's approval hash, so editing the spec re-prompts before anything runs. The approval card names the files it covers and lists the env vars.containerEnv/remoteEnv, workflow/jobenv) reaches agents, setup/verify/quick actions, terminals and dev servers, but only once approved: it can carryNODE_OPTIONSorLD_PRELOAD. Env vars set on the project still override it.runVerifyCommandno longer cuts commands at 500 chars. Every caller already caps what it accepts, and a spec's multi-line setup cut short would run half a script. Spec setups are capped at 8000 chars and refused past that.Verification
electron/test/env-spec.test.js: JSONC, exec-form quoting (round-tripped throughsh), YAML block scalars and comments,working-directory, precedence, re-prompt on spec edit, env gating, broken-spec reporting.test:electronwith a CI-like env: 5029 pass, 0 fail. ThreadView and EditProjectModal renderer tests: 118 pass.npm run typecheckandvite buildsucceed.Notes for reviewers
sudo apt-get,$GITHUB_ENV) and will fail at that step on macOS. The failure is logged and the worktree is kept, and the approval card shows the full script first..flox/environments (running agents in a container or underflox activateis its own feature; direnv'suse floxworks today), and reusing setup across threads.solenta.json(without a setup) and a devcontainer gets a new hash and is asked to approve once more. That's intended, since there is a new command to approve.🤖 Generated with Claude Code