Skip to content

Fix Automations CLI host, path, and --at drift from core - #6885

Merged
ymichael merged 1 commit into
mainfrom
bb/fix-automations-cli-target-and-date-drift-thr_42m6bgjbxh
Nov 3, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/fix-automations-cli-target-and-date-drift-thr_42m6bgjbxh

Conversation

@ymichael

@ymichael ymichael commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The Automations CLI copies core's thread-spawn helpers, and the copies drifted. Its path check missed Windows paths (#4659), so --environment C:\repo was saved as an environment id. --new-environment and workspace paths picked the first host matching a connected field that doesn't exist, then any connected host, then hosts[0] even when offline. Core uses the CLI's own machine. --at 2026-12-01 was read as UTC midnight, but core rejects a date with no time as ambiguous.

What changed

plugins/automations/src/cli.ts only:

  • The path check uses core's rules: a backslash or a leading drive letter makes the value a path.
  • New environments and workspace paths run on the calling thread's machine, falling back to primaryHostId. This reuses the thread-host lookup that --script-file already had. The old host-list scan is deleted.
  • A date-only --at is rejected. Other --at values parse as before.
  • The --environment help text now says where a path runs.

No plugin SDK, host-daemon protocol, or RPC contract changes. Open #6056 makes the same default-machine change as part of a larger feature; whichever lands second will need a small conflict fix in cli.ts.

How you verified

New tests in server-harness.test.ts failed before the fix and pass after:

  • --environment C:\repo and --new-environment worktree from a thread land on that thread's machine. Before, the path was saved as reuse and the worktree went to the first connected host.
  • A date-only --at is rejected. Before, it was accepted.

Three existing expectations moved from the first connected host to the primary host, so they now cover the no-thread fallback. pnpm exec turbo run test typecheck lint --filter=bb-plugin-automations passes: 166 tests; lint has 0 errors and 4 warnings, all pre-existing in other files.

🤖 Generated with Claude Code

AGENT GENERATED

The automation CLI's copies of core's thread-spawn helpers had drifted:
--environment C:\repo was stored as an environment id because the path
check missed Windows separators and drive letters; --new-environment and
workspace paths ran on the first host matching a nonexistent "connected"
field, then any connected host, then hosts[0] even if offline; and --at
accepted a date-only value as UTC midnight.

Apply core's path rules, run on the calling thread's machine falling back
to primaryHostId (reusing the --script-file thread-host lookup), and
reject date-only --at values as ambiguous.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ymichael
ymichael merged commit d0bf452 into main Nov 3, 2026
45 checks passed
@ymichael
ymichael deleted the bb/fix-automations-cli-target-and-date-drift-thr_42m6bgjbxh branch November 3, 2026 00:59
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