Add TIME_PARALLEL config setting (default 3) #248

Merged
time merged 2 commits from time/card-243 into main 2026-10-22 20:07:56 +00:00
5 changed files with 22 additions and 3 deletions

No files matched your search

+1 -1
View File
@@ -89,7 +89,7 @@ Not a Time seat: `@cursor`. If Cursor's GitHub app is installed, `@cursor` in a
4. Human gate: PRs touching `TIME_PROTECTED` paths (default `.github/,deploy,infra/,.env,secret`) are never merged by
Time; they get `needs-human`. So are PRs the reviewer objects to.
5. Specs: write an issue, label it `spec`. One card per line, `- title — DONE: what finished means`, or `### title`
sections that contain a `DONE:` line. Time creates `queued` cards that run one at a time (`TIME_PARALLEL`, default 1).
sections that contain a `DONE:` line. Time creates `queued` cards that run one at a time (`TIME_PARALLEL`, default 3).
A spec that isn't card-shaped is split by a seat when `VENICE_API_KEY` is set (`TIME_PLANNER`, default kimi).
## Updating Time
+7
View File
@@ -1393,6 +1393,13 @@ assert not tm.moving(iss80(22, "parked again"))
if par135 is None: os.environ.pop("TIME_PARALLEL")
else: os.environ["TIME_PARALLEL"] = par135
tm.issues, tm.gh, tm.label, tm.unlabel = real80
_pp = os.environ.pop("TIME_PARALLEL", None)
assert tm.parallel() == 3, "default"
for v, want in [("5", 5), ("1", 1), ("0", 3), ("-2", 3), ("abc", 3), ("2.5", 3), ("", 3)]:
os.environ["TIME_PARALLEL"] = v
assert tm.parallel() == want, (v, tm.parallel())
os.environ.pop("TIME_PARALLEL")
if _pp is not None: os.environ["TIME_PARALLEL"] = _pp
print("ALL OK 80")
# 172 the router's outcomes: a live pick settles into one line (housekeeping writes it; test_housekeeping.py checks the
+10 -1
View File
@@ -780,6 +780,14 @@ def moving(card: dict) -> bool:
return not real or real[-1]["beat"] not in WAITING
def parallel() -> int:
"""TIME_PARALLEL: cards in flight at once (default 3); anything but a positive integer falls back to 3."""
try:
return max(0, int(os.environ.get("TIME_PARALLEL") or 3)) or 3
except ValueError:
return 3
def promote_next() -> int | None:
"""Label the best `queued` card whose dependencies are closed `ready`: the router's live ranking first (Astra's
latest), then the oldest; at most TIME_PARALLEL cards in flight. A `ready` card waiting on a person (an objection,
@@ -788,7 +796,7 @@ def promote_next() -> int | None:
ready = issues("state=open&labels=ready")
busy = [c for c in ready if moving(c)]
print(f"promote: ready={len(ready)} moving={len(busy)}")
if len(busy) >= int(os.environ.get("TIME_PARALLEL") or 1):
if len(busy) >= parallel():
return None
queued = issues("state=open&labels=queued")
pos = {n: k for k, n in enumerate(rank_order())}
@@ -1811,6 +1819,7 @@ def cmd_doctor() -> int:
row("TIME_WORKER", True, os.environ.get("TIME_WORKER") or "cursor (default); or claude:<seat> / venice:<seat> for a seat with hands")
row("TIME_REVIEW", True, os.environ.get("TIME_REVIEW") or "off (default); a comma-separated list of seats, each votes")
row("TIME_REVIEW_TIEBREAK", True, os.environ.get("TIME_REVIEW_TIEBREAK") or "none (default); a seat called only when the standing seats split")
row("TIME_PARALLEL", True, os.environ.get("TIME_PARALLEL") or "3 (default); cards in flight at once")
row("TIME_REVIEW_QUORUM", True, os.environ.get("TIME_REVIEW_QUORUM") or "1 (default); approvals needed, net of objections")
row("TIME_REVIEW_MAX_TOKENS", True, os.environ.get("TIME_REVIEW_MAX_TOKENS") or "8000 (default); a review cut off at 4000 is asked again with this")
today, day_cap, month, month_cap = budget()
+3
View File
@@ -2,6 +2,9 @@
## [Unreleased]
### Changed
- `TIME_PARALLEL` defaults to 3 (was 1) and a bad value (not a positive integer) falls back to 3 (#243).
### Security
- A label filter is checked on every row. Gitea ignores `labels=<name>` for a label the repo does not have and returns every issue: housekeeping's first live run listed all 59 open issues as parked cards (there is no `parked` label), and the same answer to `labels=spec` would have had Time split every open issue as a spec. `issues()` in time.py and the sweep's queries now keep only rows that carry the labels they asked for.
- A commit status from one of Time's own workflows (`heartbeat /`, `mention /`, `venture /`, `astra /`, `doctor /`, `update /`, `steward /`) is not a check: it neither blocks nor earns a merge. A seat's review is a `pull_request_review` event that wakes `heartbeat.yml` during a heartbeat; the concurrency group cancels the run and Gitea records it as a failure on the PR head, which had stopped approved, CI-green PRs from landing.
+1 -1
View File
@@ -3,7 +3,7 @@
A Gitea-native agent factory, running on Teahub prod (teahub.xyz). The Gitea repo is the ledger, Gitea Actions are the clock (Time), the worker is a Claude or Venice seat with hands or a Cursor cloud agent, and chat is where you plan.
- **Cards**: an issue with a `DONE:` line, labelled `ready`.
- **Heartbeat** (`heartbeat.yml`, hourly and whenever a card is labelled `ready`): moves cards forward. In `dry-run` (default) it only says what it would do; with `TIME_MODE=live` it dispatches each card to the worker (`TIME_WORKER`: a seat such as `claude:sonnet` or `venice:kimi`, which edits the repo and opens the PR itself, or a Cursor cloud agent), which opens a PR that closes the card. An optional reviewer (`TIME_REVIEW`) checks the PR. At most `TIME_DAILY_CAP` launches a day. **Spend governor:** every model call is booked to `time/ledger/<YYYY-MM>.jsonl` (tokens and dollars); once today's spend reaches `TIME_DAILY_USD` (default 5) or the month's reaches `TIME_MONTHLY_USD` (default 100), Time stops calling models, opens an `andon` issue, and a monthly breach also sets `TIME_MODE=dry-run`. No model decides whether to spend.
- **Heartbeat** (`heartbeat.yml`, hourly and whenever a card is labelled `ready`): moves cards forward. In `dry-run` (default) it only says what it would do; with `TIME_MODE=live` it dispatches each card to the worker (`TIME_WORKER`: a seat such as `claude:sonnet` or `venice:kimi`, which edits the repo and opens the PR itself, or a Cursor cloud agent), which opens a PR that closes the card. An optional reviewer (`TIME_REVIEW`) checks the PR. At most `TIME_DAILY_CAP` launches a day, and `TIME_PARALLEL` cards in flight at once (default 3; a non-positive or non-integer value falls back to 3). **Spend governor:** every model call is booked to `time/ledger/<YYYY-MM>.jsonl` (tokens and dollars); once today's spend reaches `TIME_DAILY_USD` (default 5) or the month's reaches `TIME_MONTHLY_USD` (default 100), Time stops calling models, opens an `andon` issue, and a monthly breach also sets `TIME_MODE=dry-run`. No model decides whether to spend.
- **Mentions** (`mention.yml`): `@sonnet`, `@opus`, `@kimi`, `@grok 4.7`, `@qwen max high` in any issue, PR or comment gets that seat's reply.
- **Hands-off** (`TIME_AUTOMERGE=on`): label an issue `spec` and Time splits it into cards that run one at a time. A card's PR merges itself once the reviewer approves and checks are green, then the next card starts. Objections, red checks and protected paths (workflows, deploy, secrets) go to a human.
- **Venture loop** (`venture.yml`, every 20 min once `TIME_VENTURE=on`): one venture card a day, or one right away from Actions → venture → Run workflow → "Start a new venture now". It scouts the repos that gained the most stars this week; seats pitch; the board votes (Borda, quorum of two); every board seat writes a launch plan (positioning, first users, pricing, channels, 7-day success and kill lines) and one seat synthesizes them into `LAUNCH.md`; the worker builds the product as the page on `gh-pages` (the tool fills the first screen under a slim header with the one signup button; pricing, limits and the why sit below); deterministic checks and headless Chrome (phone and desktop) gate it, with two fix rounds before an andon; GitHub Pages ships it at `/ventures/<slug>/`. Signups go through an issue form (`.github/ISSUE_TEMPLATE/early-access.yml`), each one thanked on its issue; after 7 days the count of distinct people decides: build v2, kill, or watch a week more. The studio index lives at `/ventures/`. Launch posts are drafts for a human; nothing is posted outside the repo.