chunk task run treats --new-branch as opt-in (false by default). When the flag is omitted, the CLI sends create-new-branch: false and the Chunk agent may commit directly to the branch configured as default_branch in .chunk/run.json (often main).
There is no interactive confirmation prompt and no --yes / --force-style acknowledgement for this path. First-time users who follow the happy path (task config → task run) can therefore push agent-authored commits onto a protected or shared default branch without realizing that is the default.
Current behavior
chunk task config writes .chunk/run.json with a default_branch (commonly main).
chunk task run --definition <name> --prompt "..." (no --new-branch) triggers a run with create-new-branch: false.
- The agent commits on that default branch when the run succeeds.
- Help text documents
--new-branch but does not warn that omitting it targets the default branch with no confirmation.
Relevant code:
internal/cmd/task.go — --new-branch defaults to false; no confirmation prompt
internal/task/task.go — sends "create-new-branch": params.NewBranch in the trigger payload
Impact
- Who: Anyone running
task run without --new-branch, especially users whose default_branch is a shared or protected branch.
- Workaround: Always pass
--new-branch, or point default_branch at a disposable branch before running.
- Cost: Accidental commits on
main / the repo default branch; hard to undo in teams with branch protection or required reviews.
Reproduction
chunk auth set circleci
chunk task config
# Completes with default_branch typically set to main (or the project default)
chunk task run --definition <name> --prompt "Add a trivial comment"
# No confirmation is shown.
# create-new-branch is false in the trigger payload.
# On success, the agent may commit directly to default_branch.
Verified against CLI 0.7.107. Acceptance coverage in acceptance/task_test.go asserts the default payload uses create-new-branch: false and that --new-branch flips it to true.
Expected behavior
Direct commits to the configured default branch should not be the silent default for interactive local use. Safer options (product decision needed):
- Safer default: Treat
--new-branch as the default (true), and require an explicit opt-in to commit on the existing branch (e.g. --commit-to-branch / --no-new-branch).
- Confirm when risky: If the target branch equals
default_branch (or a well-known protected name such as main / master), prompt for confirmation on interactive TTYs, with a non-interactive escape hatch such as --yes.
- Document clearly: At minimum,
task run --help and docs/CLI.md should state that omitting --new-branch commits on default_branch with no prompt — but documentation alone does not remove the footgun.
Proposed fix
Product decision first, then implementation. Suggested checklist:
Notes
This issue is about the CLI default and UX. The API already accepts create-new-branch; the gap is that chunk task run defaults it to false and never asks the user to confirm.
chunk task runtreats--new-branchas opt-in (falseby default). When the flag is omitted, the CLI sendscreate-new-branch: falseand the Chunk agent may commit directly to the branch configured asdefault_branchin.chunk/run.json(oftenmain).There is no interactive confirmation prompt and no
--yes/--force-style acknowledgement for this path. First-time users who follow the happy path (task config→task run) can therefore push agent-authored commits onto a protected or shared default branch without realizing that is the default.Current behavior
chunk task configwrites.chunk/run.jsonwith adefault_branch(commonlymain).chunk task run --definition <name> --prompt "..."(no--new-branch) triggers a run withcreate-new-branch: false.--new-branchbut does not warn that omitting it targets the default branch with no confirmation.Relevant code:
internal/cmd/task.go—--new-branchdefaults tofalse; no confirmation promptinternal/task/task.go— sends"create-new-branch": params.NewBranchin the trigger payloadImpact
task runwithout--new-branch, especially users whosedefault_branchis a shared or protected branch.--new-branch, or pointdefault_branchat a disposable branch before running.main/ the repo default branch; hard to undo in teams with branch protection or required reviews.Reproduction
Verified against CLI
0.7.107. Acceptance coverage inacceptance/task_test.goasserts the default payload usescreate-new-branch: falseand that--new-branchflips it totrue.Expected behavior
Direct commits to the configured default branch should not be the silent default for interactive local use. Safer options (product decision needed):
--new-branchas the default (true), and require an explicit opt-in to commit on the existing branch (e.g.--commit-to-branch/--no-new-branch).default_branch(or a well-known protected name such asmain/master), prompt for confirmation on interactive TTYs, with a non-interactive escape hatch such as--yes.task run --helpanddocs/CLI.mdshould state that omitting--new-branchcommits ondefault_branchwith no prompt — but documentation alone does not remove the footgun.Proposed fix
Product decision first, then implementation. Suggested checklist:
default_branch”chunk task run(default flip and/or TTY confirmation +--yes)docs/CLI.mdto describe the commit target and any confirmation behaviorcreate-new-branch: falseby defaultNotes
This issue is about the CLI default and UX. The API already accepts
create-new-branch; the gap is thatchunk task rundefaults it tofalseand never asks the user to confirm.