Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Unreleased

- fix(workon): append `--non-interactive` to the headless `claude --print` bootstrap prompt in `handleClaudeSession` to prevent the 5-minute hang when `work-on` command needs input that cannot be answered headlessly

All notable changes to this project will be documented in this file.

Please choose versions by [Semantic Versioning](http://semver.org/).
Expand Down
5 changes: 4 additions & 1 deletion pkg/ops/workon.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,10 @@ func (w *workOnOperation) handleClaudeSession(
if w.starter == nil {
return "", ErrStarterUnavailable
}
prompt := fmt.Sprintf(`%s "%s"`, vault.GetWorkOnCommand(), task.FilePath)
// The bootstrap always runs headless `claude --print`, which cannot answer
// AskUserQuestion; --non-interactive tells the work-on command to take safe
// defaults instead of prompting (prevents the 5m headless hang).
prompt := fmt.Sprintf(`%s "%s" --non-interactive`, vault.GetWorkOnCommand(), task.FilePath)
slog.Info("starting claude session", "task", task.Name)
sessionID, err := w.starter.StartSession(ctx, prompt, vaultPath, task.Name)
if err != nil {
Expand Down
7 changes: 7 additions & 0 deletions pkg/ops/workon_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,13 @@ var _ = Describe("WorkOnOperation", func() {
_, prompt, _, _ := mockStarter.StartSessionArgsForCall(0)
Expect(prompt).To(MatchRegexp(`^/custom-cmd "`))
})

It("appends --non-interactive to the bootstrap prompt", func() {
Expect(mockStarter.StartSessionCallCount()).To(Equal(1))
_, prompt, _, _ := mockStarter.StartSessionArgsForCall(0)
Expect(prompt).To(MatchRegexp(` --non-interactive$`))
Expect(prompt).To(MatchRegexp(`/path/to/vault/tasks/my-task\.md`))
})
})

Context("when starter is nil and task has no cached session ID", func() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
status: approved
status: completed
summary: Appended `--non-interactive` to the headless bootstrap prompt in `handleClaudeSession` and added unit test verifying the flag is present and the task file path is preserved
execution_id: vault-cli-exec-159-work-on-headless-non-interactive
dark-factory-version: v0.191.0
created: "2026-07-02T18:15:00Z"
queued: "2026-07-02T17:51:16Z"
started: "2026-07-02T17:54:37Z"
completed: "2026-07-02T17:56:03Z"
---

<summary>
Expand Down
Loading