Skip to content

Keep script automation settings on partial updates - #6465

Merged
ymichael merged 1 commit into
mainfrom
bb/automation-update-wipes-script-env-vars-thr_64jggvwniv
Oct 28, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/automation-update-wipes-script-env-vars-thr_64jggvwniv

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

bb automation update treated any script flag (--script, --script-file, --interpreter, --timeout, --env-json) as a complete replacement of the script execution. The only partial script update the automations_update RPC accepted was script: { workingDirectory }. So refreshing a script with update <id> --script-file ./check.sh silently dropped its env vars and reset timeoutMs to the 120000 default, while the working directory happened to carry over. update <id> --env-json '{...}' on its own was rejected with Provide an execution mode: .... The UI hits the same path: it edits only agent automations inline, and "Edit in thread" for a script automation has an agent run this CLI command.

Reproduced on a fresh pnpm start:worktree server: after a script-only update, the stored execution had no env and timeoutMs: 120000 (was 30000), and the next run printed Build under test: with empty vars.

What changed

  • rpc-types.ts: the script update on automations_update now accepts any subset of script, scriptFile (requires script), interpreter, timeoutMs, env, workingDirectory. The previous { workingDirectory } shape is still valid.
  • service.ts: new applyScriptExecutionUpdate patches the current script execution and keeps omitted fields. New content is staged and the superseded file cleaned up the same way as a full replacement. An empty env removes the variables.
  • cli.ts: script flags on a script automation send a partial script update. Script flags on an agent automation still build a full replacement, so agent→script switching is unchanged; the CLI reads the current mode to decide. Mixing agent and script flags is rejected. The printed refresh command is now just --script-file <path> [--host …].
  • Behavior choice: a new --script-file without --interpreter keeps the current interpreter rather than re-inferring it from the extension. Documented.
  • Docs: automations skill SKILL.md, references/updates.md, references/script-runtime.md, and update/--interpreter help text.
  • Not changed: --prompt --provider --model together still replace an agent's whole execution, including its environment target. Now stated in the docs.

No daemon wire changes.

How you verified

  • server-harness.test.ts: extended the end-to-end CLI→RPC flow with a content-only update, an env-only update, clearing with --env-json '{}', and rejection of mixed agent and script flags. Against the unfixed source it fails on the dropped env.
  • automations.test.ts: the refresh-command test now edits the source file and runs the printed command, then checks that interpreter, timeout, env and working directory are kept and the new content is stored.
  • pnpm exec turbo run typecheck lint test --filter=bb-plugin-automations: 140/140 tests pass.
  • Manual, on a rebuilt pnpm start:worktree server with the source CLI: a script-only update kept env and timeoutMs: 30000, and the run printed Build under test: L1 with both paths. An env-only update applied, and the old stored file was removed.

AGENT GENERATED

🤖 Generated with Claude Code

`bb automation update` with any script flag replaced the whole script
execution, so refreshing a script dropped its env vars and reset its
timeout, and `--env-json` could not be updated on its own. Script
updates now patch only the given fields; script flags on an agent
automation still replace it with a script.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit 1d36ef6 into main Oct 28, 2026
44 checks passed
@ymichael
ymichael deleted the bb/automation-update-wipes-script-env-vars-thr_64jggvwniv branch October 28, 2026 19:35
pZayash added a commit to pZayash/bb that referenced this pull request Nov 3, 2026
The merge kept the pre-get-bb#6465 refreshScriptFileCommand that re-expanded
--interpreter/--working-directory/--timeout/--env-json, and the test's
expected command was left incoherent. Since update --script-file is now a
partial update that preserves script settings, the refresh command is just
--script-file <path> [--host ...]. Keep only the forkShellQuote seam.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

1 participant