diff options
| author | Peter Stone <thepeterstone@gmail.com> | 2026-03-03 21:15:06 +0000 |
|---|---|---|
| committer | Peter Stone <thepeterstone@gmail.com> | 2026-03-03 21:15:06 +0000 |
| commit | f527972f4d8311a09e639ede6c4da4ca669cfd5e (patch) | |
| tree | 58ee5c97fd7dea71cdff0ffca7ccd36af562c640 /internal/executor/claude.go | |
| parent | 704d007a26cac804148a51d35e129beaea382fb0 (diff) | |
Executor: dependency waiting and planning preamble
- Pool.waitForDependencies polls depends_on task states before running
- ClaudeRunner prepends planningPreamble to task instructions to prompt
a plan-then-implement approach
- Rate-limit test helper updated to match new ClaudeRunner signature
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'internal/executor/claude.go')
| -rw-r--r-- | internal/executor/claude.go | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/internal/executor/claude.go b/internal/executor/claude.go index 8901d35..8486427 100644 --- a/internal/executor/claude.go +++ b/internal/executor/claude.go @@ -20,6 +20,7 @@ type ClaudeRunner struct { BinaryPath string // defaults to "claude" Logger *slog.Logger LogDir string // base directory for execution logs + APIURL string // base URL of the Claudomator API, passed to subprocesses } func (r *ClaudeRunner) binaryPath() string { @@ -34,6 +35,10 @@ func (r *ClaudeRunner) Run(ctx context.Context, t *task.Task, e *storage.Executi args := r.buildArgs(t) cmd := exec.CommandContext(ctx, r.binaryPath(), args...) + cmd.Env = append(os.Environ(), + "CLAUDOMATOR_API_URL="+r.APIURL, + "CLAUDOMATOR_TASK_ID="+t.ID, + ) if t.Claude.WorkingDir != "" { cmd.Dir = t.Claude.WorkingDir } @@ -96,8 +101,26 @@ func (r *ClaudeRunner) Run(ctx context.Context, t *task.Task, e *storage.Executi } func (r *ClaudeRunner) buildArgs(t *task.Task) []string { + instructions := t.Claude.Instructions + allowedTools := t.Claude.AllowedTools + + if !t.Claude.SkipPlanning { + instructions = withPlanningPreamble(instructions) + // Ensure Bash is available so the agent can POST subtasks. + hasBash := false + for _, tool := range allowedTools { + if tool == "Bash" { + hasBash = true + break + } + } + if !hasBash { + allowedTools = append(allowedTools, "Bash") + } + } + args := []string{ - "-p", t.Claude.Instructions, + "-p", instructions, "--output-format", "stream-json", "--verbose", } @@ -114,7 +137,7 @@ func (r *ClaudeRunner) buildArgs(t *task.Task) []string { if t.Claude.SystemPromptAppend != "" { args = append(args, "--append-system-prompt", t.Claude.SystemPromptAppend) } - for _, tool := range t.Claude.AllowedTools { + for _, tool := range allowedTools { args = append(args, "--allowedTools", tool) } for _, tool := range t.Claude.DisallowedTools { |
