Skip to content

hcoord agent spawn validates its native arguments only after creating the worktree #237

Closed

Description

@yansfil

What happened

hcoord agent spawn --parent here --name <n> --intent <k> --repo <repo> --branch <b> --path <p> -- claude --dangerously-skip-permissions (no --kind, so the default codex) failed with:

hcoord: invalid_argument: Codex task must be the final native argument

By then it had already created the worktree at <p>, the branch <b>, and a Herdr workspace holding a bare shell pane.
Retrying with corrected arguments failed with worktree_failed: ... already exists, and recovery took closing that pane, git worktree remove, deleting the branch, and a fresh --intent.
hcoord agent spawn --help prints only --parent is required, so --kind and the meaning of the arguments after -- cannot be discovered from the CLI.

What you expected

Native-argument validation (codexLaunchArgs, plugins/hcoord/src/hcoord/herdr.ts:201-211) runs before any external effect, so a refused spawn creates nothing.
A retry of a spawn that did fail partway, with the same intent, reuses or cleans up what the first attempt created.
--help prints the spawn usage, including --kind and how Claude and Codex arguments are passed.

Steps to reproduce

  1. Run the command above without --kind from a named pane.
  2. Run git worktree list and herdr workspace list: the worktree and a new workspace exist although the command failed.

Versions

  • hcoord: the installed ~/.hcoord/bin/hcoord (plugin source plugins/hcoord at 25a2eba)
  • Herdr: 0.9.1

Activity

  1. added
    bug
    on Sep 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions