Skip to content

feat(exec): best-of-N fan-out runs; completion notifications - #241

Merged
Patel230 merged 2 commits into
mainfrom
feat/orca-adoptions
Aug 23, 2026
Merged

feat(exec): best-of-N fan-out runs; completion notifications#241
Patel230 merged 2 commits into
mainfrom
feat/orca-adoptions

Conversation

@Patel230

Copy link
Copy Markdown
Contributor

Summary

Two adoptions from Orca (stablyai's ADE for parallel agent fleets, 51.5k★), mapped onto hawk exec.

1. Best-of-N fan-out — hawk exec --fanout N

Orca's killer pattern: run the same prompt N times, each in its own isolated worktree, compare, merge the winner. Hawk's mission mode decomposes prompts into different features — this is the complementary same-task sampling pattern, verified absent until now.

  • --fanout 2..5 (bounded): sequential attempts (os.Chdir is process-global), each with fresh branch hawk-exec/<ts>-fanout<i>-<rand> + independent session
  • Worktrees deliberately kept after the run — human diffs branches and merges the winner; report prints per-attempt status/tokens/duration/response-tail, git diff main...<branch> compare hints, and per-worktree cleanup commands
  • Stream events captured rather than printed so N attempts don't interleave; attempts default to full autonomy; honors --auto/--model/--max-turns/--ephemeral; --session-id rejected with fanout (attempts independent by design)
  • Works with existing --json/--output-format for structured reports

2. Completion notifications — internal/notify

Best-effort multi-channel sender adopting Orca's "know when your agent finishes":

  • Generic webhook (HAWK_NOTIFY_WEBHOOK_URL) → POST {event:"agent_completion", title, body, ok, branch, finished_at}
  • Telegram Bot API (HAWK_NOTIFY_TELEGRAM_TOKEN/_CHAT_ID)
  • Unconfigured → silent no-op; delivery errors never fail the run
  • Fired once per exec/fanout completion (success or failure)

Testing

  • notify suite (6 tests incl. webhook payload contract + error surfacing + truncation)
  • cmd suite passes; testaudit emoji audit passes (glyphs via ui/icons); golangci-lint 0 issues (noctx fixed); gofmt clean; both cgo/no-cgo builds clean

Two adoptions from Orca (stablyai's ADE for parallel agent fleets),
mapped onto hawk exec.

Best-of-N fan-out (hawk exec --fanout N):
- Runs the same prompt in N (2-5) sequentially-executed isolated git
  worktrees, each a fully independent attempt with its own branch
  (hawk-exec/<ts>-fanout<i>-<rand>) and session.
- Worktrees are deliberately KEPT after the run so the human can diff
  branches and merge the winner; the report prints per-attempt status,
  tokens, duration, response tail, compare command (git diff
  main...<branch>), and cleanup commands.
- Stream events are captured rather than printed so attempts do not
  interleave; attempts default to full autonomy in fanout mode and honor
  --auto/--model/--max-turns/--ephemeral as usual. --session-id is
  rejected with fanout (attempts are independent by design).
- Structured output via existing --json/--output-format flags.

Completion notifications (internal/notify):
- Best-effort multi-channel sender: generic webhook
  (HAWK_NOTIFY_WEBHOOK_URL, POST {event,title,body,ok,...}) and Telegram
  Bot API (HAWK_NOTIFY_TELEGRAM_TOKEN/_CHAT_ID). Unconfigured -> silent
  no-op; delivery errors never fail the run.
- Fired once per exec/fanout completion (success or failure) - Orca's
  'know when your agent finishes' without scraping terminal output.

Verification: notify suite green (6 tests incl. webhook payload contract,
error surfacing, truncation); cmd suite passes; golangci-lint 0 issues
(noctx fixed via NewRequestWithContext); gofmt clean; go build ./... clean.
hawk's emoji audit (internal/testaudit) enforces that dingbat runes route
through internal/ui/icons. Replace the literal check/cross marks in the
fanout report and notification renderer with icons.Check()/icons.Close();
tests assert against the same helpers so they hold in ASCII-fallback
environments.
@Patel230
Patel230 merged commit 7849a00 into main Aug 23, 2026
26 checks passed
@Patel230
Patel230 deleted the feat/orca-adoptions branch August 23, 2026 13:06
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