Venture: parallel builds (TIME_VENTURE_HEAVY, default 3) #23

Merged
teahubxyz merged 1 commits from parallel-builds into main 2026-10-13 01:40:32 +00:00
Owner

Parallel work for the venture loop: a batch's children build at the same time instead of one per tick.

  • Waves: each tick runs its top due cards at once and hands out worker runs in priority order, at most TIME_VENTURE_HEAVY (default 3), one per card per tick. Cheap stages (checks, plans, launch) carry on in the same tick.
  • Thread safety:
    • the folder lock is a per-build Hands subclass, not a patch on the shared class (two builds would have swapped each other's lock)
    • ventures.json is read fresh and written under a lock (a sibling's entry was otherwise overwritten)
    • a Pages contents PUT that loses the race for the branch head (409) is retried
  • TIME_VENTURE_HEAVY=1 restores one-at-a-time.

Tests: #40 proves three 0.4s builds overlap (peak concurrency 3, under 1.1s), the folder lock holds under threads, HEAVY=1 keeps one at a time, and the 409 retry applies only to contents PUTs. #39 now sees a batch of three all reach ready in its first tick, with all three registry entries kept. All 40 pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva


Generated by Claude Code

Parallel work for the venture loop: a batch's children build at the same time instead of one per tick. - **Waves:** each tick runs its top due cards at once and hands out worker runs in priority order, at most `TIME_VENTURE_HEAVY` (default 3), one per card per tick. Cheap stages (checks, plans, launch) carry on in the same tick. - **Thread safety:** - the folder lock is a per-build `Hands` subclass, not a patch on the shared class (two builds would have swapped each other's lock) - `ventures.json` is read fresh and written under a lock (a sibling's entry was otherwise overwritten) - a Pages contents PUT that loses the race for the branch head (409) is retried - `TIME_VENTURE_HEAVY=1` restores one-at-a-time. Tests: #40 proves three 0.4s builds overlap (peak concurrency 3, under 1.1s), the folder lock holds under threads, `HEAVY=1` keeps one at a time, and the 409 retry applies only to contents PUTs. #39 now sees a batch of three all reach `ready` in its first tick, with all three registry entries kept. All 40 pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva --- _Generated by [Claude Code](https://claude.ai/code/session_01VDkN7ukK1kXkqov8FaZxva)_
Sign in to join this conversation.