Files
freemo eee51b7d54 build(agents): use prompt_async for fire-and-forget supervisor launch + bash sleep for real waiting
Two fundamental architectural changes that solve the "supervisor exits and
never gets relaunched" problem:

1. PROMPT_ASYNC LAUNCH: The product-builder no longer uses the Task tool to
   launch supervisors. The Task tool blocks until ALL parallel tasks return,
   meaning if one supervisor exits, the product-builder can't relaunch it
   until all 10 others also exit. Instead, supervisors are now launched via
   the OpenCode Server HTTP API's POST /session/:id/prompt_async endpoint,
   which returns 204 immediately (true fire-and-forget). The product-builder
   then enters a bash-driven monitoring loop that checks session status
   every 60 seconds via curl and relaunches any dead supervisor instantly
   — independently of whether the other 10 are still running.

   Requires: opencode started with --port 4096 (fixed known port).
   Added curl and sleep to product-builder's bash allow list.

2. BASH SLEEP FOR GENUINE WAITING: All 11 supervisors now use the Bash
   tool with "sleep N" (and explicit timeout > sleep duration) for real
   blocking waits between polling cycles. Previously, pseudocode "wait N
   minutes" was interpreted by the LLM as "I'm done, return to caller" —
   causing supervisors to exit after their first idle cycle. The bash sleep
   call genuinely blocks the agent for the specified duration, then the
   agent resumes its loop. Every supervisor has a prominent instruction
   block explaining this mechanism and warning against returning to caller.

   All idle break/exit conditions removed across all 11 supervisors.
   Supervisors now loop forever: poll Forgejo → do work → bash sleep → repeat.

Changes across 12 agent definitions:

- product-builder: Phase C.2 rewritten to use curl + prompt_async.
  Phase C.3 rewritten as bash sleep + curl monitoring loop (checks every
  60s, relaunches dead supervisors, checks convergence every 10 min).
  Phase C.4 simplified to cleanup only.

- All 11 supervisors: Added "CRITICAL: Bash Sleep" instruction block.
  Replaced all pseudocode "wait N" with bash("sleep N", timeout=N*1.5).
  Removed all idle break/exit conditions — agents now sleep and re-poll
  instead of exiting.
2026-04-02 13:19:51 -04:00
..