herdr-orchestra 6.12.1 → 6.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +2 -0
- package/VERSION +1 -1
- package/agents.default.toml +9 -0
- package/bin/__pycache__/orchcpython-314.pyc +0 -0
- package/bin/orch +336 -13
- package/package.json +1 -1
- package/playbooks/run.md +1 -1
- package/view/index.html +5 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes. Versions follow [semantic versioning](https://semver.org).
|
|
4
4
|
|
|
5
|
+
## [6.14.0] - 2026-11-26
|
|
6
|
+
|
|
7
|
+
A coder's and the reviewer's chat no longer keeps growing from milestone to milestone. When one is done with a milestone, orch types its tool's `/compact` into its pane while it is idle, so the tool swaps the long chat for a short summary. Every job orch gives an agent is already written down in files (`task.md`, `task.json`, fix and review files), so the next milestone loses nothing it needs.
|
|
8
|
+
|
|
9
|
+
Example: `claude-1` builds M2 and M2 lands. `claude-1` is idle, so orch sends `/compact`. When herdr shows it idle again, it gets `Read .orch-task/M4/task.md ...`. `orch story` reads `the event manager did: claude-1 finished M2: orch sent /compact so its chat does not keep growing`.
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
- **`/compact` between milestones**, on by default for Claude Code, Codex and AGY. orch sends it only while herdr shows the agent idle and it holds no job: as soon as its milestone lands, or just before it starts a different milestone (then that milestone waits until the compact is done). Never in the middle of work, never for a fix or review round of the same milestone, and never for the lead.
|
|
13
|
+
- While it compacts, the agent shows as `compacting` in `orch status`, `orch status --json`, `orch view` and `orch board`, and gets no new work. It is free again once herdr shows it idle for `ORCH_COMPACT_SETTLE_S` (10 s). Still working after `ORCH_COMPACT_MAX_S` (5 min): orch stops waiting and says so.
|
|
14
|
+
- **`orch config compact on|off`** (and `ORCH_COMPACT=0|1`) turns it on or off for this machine. `orch config` shows it.
|
|
15
|
+
- Registry keys **`compact`** (the command, `/compact`) and **`compact_min_version`**. AGY added `/compact` in 1.2.15: an older or unreadable `agy --version` means no compacting, said once in `orch story`, and `orch doctor agy` shows it. OpenCode, amp, Pi and Hermes stay off until their command is checked; `compact = "/compact"` in your `agents.toml` turns it on for a kind, `compact = ""` turns it off.
|
|
16
|
+
- Restart recovery: what each agent's chat holds and a compact in progress are kept across `orch sync` and `orch resume`. A compact that was cut short by a restart does no harm: the agent just gets its next job.
|
|
17
|
+
- Docs: [Compact between milestones](https://herdr-orchestra.vercel.app/docs/agents/#compact-between-milestones), the new keys and variables in Configuration, the command in Commands.
|
|
18
|
+
|
|
19
|
+
### Not yet tried
|
|
20
|
+
- With real Claude Code, Codex and AGY windows. It was tested with orch's simulated agents and herdr. The command name was checked in each tool's docs (AGY: from 1.2.15).
|
|
21
|
+
|
|
22
|
+
## [6.13.0] - 2026-11-26
|
|
23
|
+
|
|
24
|
+
The views no longer pass an old run off as the current one, and orch says when a plan file has a name it does not read.
|
|
25
|
+
|
|
26
|
+
Example: a developer saves the new plan as `.orchestrate/csv-import.md` and opens `orch view`. Before, the page still showed last week's `plan.md` milestones as if they were live. Now a note at the top reads "This is the last run (Categories): all its milestones landed 2 d ago. No run is going now" and "`.orchestrate/csv-import.md` is not used: orch only reads `.orchestrate/plan.md`. Rename or copy it to plan.md, then run `orch sync`."
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
- **Notes about old runs and unread plans** in `orch view` (a bar at the top), `orch board`, `orch status` (a `note:` line) and `orch status --json` (a `notices` list). They appear only when no run is going: the last run landed everything (`old_run`), `plan.md` changed after the last run (`plan_unsynced`), or a `.orchestrate/*.md` file that orch does not read is newer than the run (`other_plan`). Files orch writes itself (summary, story, pr-body, manual-tests) are never counted. While a milestone is being worked on there are no notes.
|
|
30
|
+
- **`orch sync` points out a plan it does not read.** With no `plan.md` it names the other `.md` file and says to rename it; with a newer file beside `plan.md` it warns and still loads `plan.md` as before.
|
|
31
|
+
|
|
32
|
+
### Not changed
|
|
33
|
+
- orch still reads only `.orchestrate/plan.md`, and one repo still has one run at a time.
|
|
34
|
+
|
|
5
35
|
## [6.12.1] - 2026-11-26
|
|
6
36
|
|
|
7
37
|
### Fixed
|
package/README.md
CHANGED
|
@@ -85,6 +85,7 @@ orch update --check # only say whether a new version is out
|
|
|
85
85
|
orch update --version v5.8.0 # install that exact version (this is also how you go back)
|
|
86
86
|
orch config # auto-update on/off, the installed version, the last check
|
|
87
87
|
orch config auto-update off # or: on
|
|
88
|
+
orch config compact off # or: on (coders and the reviewer get /compact between milestones)
|
|
88
89
|
```
|
|
89
90
|
|
|
90
91
|
- **The check.** At most once a day, at `orch lead plan` or `orch version`, orch asks GitHub for the latest release (3 seconds at most; nothing about you or your project is sent). With no internet it stays silent and asks again the next day. `ORCH_NO_UPDATE_CHECK=1` turns the check off.
|
|
@@ -341,6 +342,7 @@ Three views show a run while it goes; none of them changes it.
|
|
|
341
342
|
| Attempts keep getting lost (unreachable, gone, rate-limited) | after 4 (`ORCH_MAX_LOST`) the task fails with the history instead of looping |
|
|
342
343
|
| Autopilot is killed mid-step | the next run confirms or re-sends an unconfirmed prompt to the same agent, and finishes or undoes a half-done merge |
|
|
343
344
|
| The computer was off, herdr was closed, or the event manager died | `orch status` says so in its first lines. `orch resume` carries on: the time orch was down is not counted against any task, the agents' panes get their names back, unsaved work is saved and the tasks in progress are sent again (see [After a restart](#after-a-restart)) |
|
|
345
|
+
| A coder's or the reviewer's chat keeps growing, milestone after milestone | between milestones, while herdr shows it idle, orch types the tool's `/compact` (Claude Code, Codex, AGY 1.2.15+): its chat becomes a short summary, and `orch story` says so. Never mid-work, never for a fix round of the same milestone, never the lead. `orch config compact off` turns it off |
|
|
344
346
|
| A milestone is paused or moved while its coder still works | orch presses the agent's interrupt key (Esc; set per agent kind as `interrupt_keys` in the registry), then types the STOP note. The coder shows as `stopping M7` in `orch status` and gets no new work until herdr shows it idle; the event manager presses the key again if it keeps going. `orch free <worker>` frees it once you have checked its pane |
|
|
345
347
|
| A paused coder keeps writing files | whatever it writes anyway is saved into the milestone the next time the milestone or that folder is used. orch never refuses a task because a folder has unsaved files |
|
|
346
348
|
| plan.md changed while a coder works on that milestone | its task.md is not rewritten mid-work; `orch sync` warns and says how to send the new text (`orch set Mn paused`, then `orch dispatch Mn`) |
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
6.
|
|
1
|
+
6.14.0
|
package/agents.default.toml
CHANGED
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
# interrupt_keys the keys that stop its current step, as `herdr agent send-keys` names them (default ["esc"]).
|
|
17
17
|
# orch presses them when a milestone is paused or moved while the coder still works, before the
|
|
18
18
|
# STOP note: a typed message is only read after the current step (agy queues it)
|
|
19
|
+
# compact the command that shrinks the tool's chat to a short summary (e.g. "/compact"). orch types it into a
|
|
20
|
+
# coder's or the reviewer's pane when its milestone is done, before it starts another one, while
|
|
21
|
+
# herdr shows it idle (never the lead). Leave it out (or "") for a tool where it is not known to work
|
|
22
|
+
# compact_min_version the first version of the tool that has that command: an older (or unreadable)
|
|
23
|
+
# `<binary> --version` means no compacting, said once in `orch story`
|
|
19
24
|
# roles any of "lead", "coder", "reviewer"
|
|
20
25
|
# skills_dirs global SKILL.md folders the installer may put the orch-plan / orch-run / orch-explain skills into
|
|
21
26
|
# (first = preferred)
|
|
@@ -43,6 +48,7 @@ review_launch = "claude --permission-mode acceptEdits --disallowedTools Edit,Not
|
|
|
43
48
|
model_flag = "--model"
|
|
44
49
|
herdr_detect = true
|
|
45
50
|
interrupt_keys = ["esc"]
|
|
51
|
+
compact = "/compact"
|
|
46
52
|
roles = ["lead", "coder", "reviewer"]
|
|
47
53
|
skills_dirs = ["~/.claude/skills"]
|
|
48
54
|
skills_one_wins = true
|
|
@@ -63,6 +69,7 @@ model_flag = "--model"
|
|
|
63
69
|
effort_flag = "-c model_reasoning_effort={effort}"
|
|
64
70
|
herdr_detect = true
|
|
65
71
|
interrupt_keys = ["esc"]
|
|
72
|
+
compact = "/compact"
|
|
66
73
|
roles = ["lead", "coder", "reviewer"]
|
|
67
74
|
skills_dirs = ["~/.agents/skills", "~/.codex/skills"]
|
|
68
75
|
skills_reads = ["~/.agents/skills", "~/.codex/skills"]
|
|
@@ -116,6 +123,8 @@ binary = "agy"
|
|
|
116
123
|
launch = "agy --mode accept-edits"
|
|
117
124
|
herdr_detect = true
|
|
118
125
|
interrupt_keys = ["esc"]
|
|
126
|
+
compact = "/compact"
|
|
127
|
+
compact_min_version = "1.2.15"
|
|
119
128
|
roles = ["lead", "coder", "reviewer"]
|
|
120
129
|
skills_dirs = ["~/.gemini/config/skills"]
|
|
121
130
|
invoke = "use the orch-plan skill: <feature>"
|
|
Binary file
|
package/bin/orch
CHANGED
|
@@ -13,7 +13,7 @@ Task status flow (every change goes through move(), which checks TRANSITIONS)
|
|
|
13
13
|
side states: needs-answer, paused, failed, conflict, needs-fix, held (waiting for `orch approve`), skipped
|
|
14
14
|
Also: .orchestrate/events.jsonl (one line per transition), driver.lock (held by autopilot while it drives).
|
|
15
15
|
"""
|
|
16
|
-
import atexit, contextlib, fcntl, fnmatch, hashlib, json, os, re, shlex, shutil, signal, socket, subprocess, sys, tempfile, time
|
|
16
|
+
import atexit, contextlib, fcntl, fnmatch, hashlib, json, os, re, shlex, shutil, signal, socket, subprocess, sys, tempfile, textwrap, time
|
|
17
17
|
from pathlib import Path
|
|
18
18
|
|
|
19
19
|
HERDR = os.environ.get("HERDR", "herdr")
|
|
@@ -41,6 +41,10 @@ STOP_WAIT_S = float(os.environ.get("ORCH_STOP_WAIT_S", "60")) # `orch stop` wa
|
|
|
41
41
|
HALT_WAIT_S = float(os.environ.get("ORCH_HALT_WAIT_S", "5")) # `orch set/park` waits this long for it to go idle
|
|
42
42
|
HALT_SETTLE_S = float(os.environ.get("ORCH_HALT_SETTLE_S", "10")) # idle at least this long after the stop note
|
|
43
43
|
HALT_REPEAT_S = float(os.environ.get("ORCH_HALT_REPEAT_S", "90")) # still working after this: interrupt it again
|
|
44
|
+
# a coder or reviewer whose milestone is done gets its tool's compact command (`/compact`), so its chat does not keep
|
|
45
|
+
# growing from milestone to milestone. It counts as busy until herdr shows it idle for COMPACT_SETTLE_S
|
|
46
|
+
COMPACT_SETTLE_S = float(os.environ.get("ORCH_COMPACT_SETTLE_S", "10"))
|
|
47
|
+
COMPACT_MAX_S = float(os.environ.get("ORCH_COMPACT_MAX_S", "300")) # still working after this: stop waiting for it
|
|
44
48
|
TEAM_CONFIRM_S = float(os.environ.get("ORCH_TEAM_CONFIRM_S", "5")) # `team up` looks again after this: still running?
|
|
45
49
|
LOG_MAX_B = int(float(os.environ.get("ORCH_LOG_MAX_MB", "2")) * 1024 * 1024) # autopilot.log; one old copy is kept
|
|
46
50
|
CRASH_KEEP = int(os.environ.get("ORCH_CRASH_KEEP", "20")) # saved agent screens in .orchestrate/crash/
|
|
@@ -1273,10 +1277,17 @@ def parse_workers(s):
|
|
|
1273
1277
|
def cmd_sync(args):
|
|
1274
1278
|
plan = ORCH / "plan.md"
|
|
1275
1279
|
if not plan.exists():
|
|
1276
|
-
|
|
1280
|
+
others = other_plan_files()
|
|
1281
|
+
die("missing .orchestrate/plan.md" + (
|
|
1282
|
+
f" (found {', '.join(others[:3])}, but orch only reads plan.md: rename or copy it to plan.md)"
|
|
1283
|
+
if others else ""))
|
|
1277
1284
|
plan_text = plan.read_text()
|
|
1278
1285
|
cfg, tasks = parse_plan(plan_text)
|
|
1279
1286
|
errors, warns = [], []
|
|
1287
|
+
newer = other_plan_files(plan.stat().st_mtime)
|
|
1288
|
+
if newer:
|
|
1289
|
+
warns.append(f"{', '.join(newer[:3])} {'is' if len(newer) == 1 else 'are'} newer than plan.md, but orch only "
|
|
1290
|
+
f"reads plan.md. If that is the plan you mean, copy it to plan.md and run `orch sync` again")
|
|
1280
1291
|
|
|
1281
1292
|
get = lambda k, d="": " ".join(cfg.get(k, [])).strip() or d
|
|
1282
1293
|
branch = get("branch").split()[0] if get("branch") else die("plan header needs `Branch: feature/<slug>`")
|
|
@@ -1659,7 +1670,7 @@ def cmd_sync(args):
|
|
|
1659
1670
|
"reviewer_info": ({"kind": rev_kind, "pane": rev_pane, "detect": detect(rev_kind, rev_pane, "Reviewer"),
|
|
1660
1671
|
"model": models.get(reviewer), "tier": tier_of(reviewer),
|
|
1661
1672
|
**({k: v for k, v in (old.get("reviewer_info") or {}).items()
|
|
1662
|
-
if k in ("cooldown_until", "cooldown_reason") and v is not None}
|
|
1673
|
+
if k in ("cooldown_until", "cooldown_reason", "ctx", "compacting") and v is not None}
|
|
1663
1674
|
if old.get("reviewer") == reviewer else {})}
|
|
1664
1675
|
if reviewer else None),
|
|
1665
1676
|
"reviewer_busy": old.get("reviewer_busy") if old.get("reviewer") == reviewer else None,
|
|
@@ -1674,6 +1685,7 @@ def cmd_sync(args):
|
|
|
1674
1685
|
"lead_seq": old.get("lead_seq", 0),
|
|
1675
1686
|
"lead_wake": old.get("lead_wake"),
|
|
1676
1687
|
"lead_ready_told": old.get("lead_ready_told"),
|
|
1688
|
+
"compact_told": old.get("compact_told") or [],
|
|
1677
1689
|
"tree_task": old.get("tree_task"),
|
|
1678
1690
|
"workers": {},
|
|
1679
1691
|
"order": ids,
|
|
@@ -1685,6 +1697,8 @@ def cmd_sync(args):
|
|
|
1685
1697
|
"cooldown_reason": ow.get("cooldown_reason", ""),
|
|
1686
1698
|
**({"off": ow["off"]} if ow.get("off") else {}), # kept until `orch bench <w> on`
|
|
1687
1699
|
**({"stopping": ow["stopping"]} if ow.get("stopping") else {}), # told to stop
|
|
1700
|
+
**({k: ow[k] for k in ("ctx", "compacting") if ow.get(k)}
|
|
1701
|
+
if ow.get("kind") in (None, kind) else {}), # what its chat holds
|
|
1688
1702
|
"dir": ow.get("dir"), "setup_done": ow.get("setup_done", False),
|
|
1689
1703
|
"setup_hash": ow.get("setup_hash"), "delivery_fails": ow.get("delivery_fails", 0),
|
|
1690
1704
|
"pane": pane, "detect": detect(kind, pane, "Workers"),
|
|
@@ -1979,6 +1993,132 @@ def stopping_line(st, name, w):
|
|
|
1979
1993
|
f"it gets no new work until herdr shows it idle — `orch free {name}` if you checked its pane)")
|
|
1980
1994
|
|
|
1981
1995
|
|
|
1996
|
+
# ---------------------------------------------------------------- compacting a coder's or the reviewer's chat
|
|
1997
|
+
# Every job orch gives a coder or the reviewer is written down in files (task.md, task.json, fix and review files),
|
|
1998
|
+
# so the chat itself only holds what the agent did on its LAST milestone. Before the agent starts a different
|
|
1999
|
+
# milestone (and as soon as the milestone it worked on has landed) orch types its tool's compact command
|
|
2000
|
+
# (`/compact` in Claude Code, Codex and AGY): the tool replaces the long chat with a short summary. Only when herdr
|
|
2001
|
+
# shows the agent idle, never while it works, and never the lead. A fix or review round of the SAME milestone keeps
|
|
2002
|
+
# the chat. `orch config compact off` (or ORCH_COMPACT=0) turns it off; `compact = ""` in agents.toml turns it off
|
|
2003
|
+
# for one tool.
|
|
2004
|
+
|
|
2005
|
+
def compact_on():
|
|
2006
|
+
env = os.environ.get("ORCH_COMPACT")
|
|
2007
|
+
if env in ("0", "1"):
|
|
2008
|
+
return env == "1"
|
|
2009
|
+
return settings_load().get("compact", True) is not False
|
|
2010
|
+
|
|
2011
|
+
|
|
2012
|
+
_VERSIONS = {}
|
|
2013
|
+
|
|
2014
|
+
|
|
2015
|
+
def _version_of(binary):
|
|
2016
|
+
"""The x.y.z version `<binary> --version` prints, or None (asked once per process)."""
|
|
2017
|
+
if binary not in _VERSIONS:
|
|
2018
|
+
_VERSIONS[binary] = _ask_version(binary)
|
|
2019
|
+
return _VERSIONS[binary]
|
|
2020
|
+
|
|
2021
|
+
|
|
2022
|
+
def _ask_version(binary):
|
|
2023
|
+
try:
|
|
2024
|
+
r = subprocess.run([binary, "--version"], text=True, capture_output=True, timeout=10)
|
|
2025
|
+
except (OSError, subprocess.SubprocessError):
|
|
2026
|
+
return None
|
|
2027
|
+
m = re.search(r"(\d+)\.(\d+)\.(\d+)", (r.stdout or "") + (r.stderr or ""))
|
|
2028
|
+
return tuple(int(x) for x in m.groups()) if m else None
|
|
2029
|
+
|
|
2030
|
+
|
|
2031
|
+
def compact_command(st, kind):
|
|
2032
|
+
"""(command, None) when orch can compact this kind of agent, else (None, why). A tool whose registry entry has
|
|
2033
|
+
`compact_min_version` is asked its version (once per process); too old or unknown: no compacting."""
|
|
2034
|
+
if not compact_on():
|
|
2035
|
+
return None, "turned off (`orch config compact on` turns it on)"
|
|
2036
|
+
v = (registry(required=False) or {}).get(kind) or {}
|
|
2037
|
+
cmd = str(v.get("compact") or "").strip()
|
|
2038
|
+
if not cmd:
|
|
2039
|
+
return None, f"{kind} has no compact command in the agent list"
|
|
2040
|
+
need_v = str(v.get("compact_min_version") or "").strip()
|
|
2041
|
+
if need_v:
|
|
2042
|
+
have = _version_of(v.get("binary", kind))
|
|
2043
|
+
want = tuple(int(x) for x in re.findall(r"\d+", need_v)[:3])
|
|
2044
|
+
if not have or have < want:
|
|
2045
|
+
return None, (f"{kind} {'.'.join(map(str, have))} is older than {need_v}, the first version with {cmd}"
|
|
2046
|
+
if have else f"could not read {kind}'s version (`{v.get('binary', kind)} --version`); "
|
|
2047
|
+
f"{cmd} needs {need_v} or newer")
|
|
2048
|
+
return cmd, None
|
|
2049
|
+
|
|
2050
|
+
|
|
2051
|
+
def compact_unsupported(st, name, kind):
|
|
2052
|
+
"""Why this agent's chat can't be compacted although its tool has a compact command (an old version), or None."""
|
|
2053
|
+
v = (registry(required=False) or {}).get(kind) or {}
|
|
2054
|
+
if not compact_on() or not str(v.get("compact") or "").strip():
|
|
2055
|
+
return None
|
|
2056
|
+
return compact_command(st, kind)[1]
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
def compact_agents(st):
|
|
2060
|
+
"""(name, info dict, holds a job) for every coder and the reviewer. The lead is never compacted."""
|
|
2061
|
+
out = [(n, w, bool(w.get("task"))) for n, w in st.get("workers", {}).items()]
|
|
2062
|
+
if st.get("reviewer") and st.get("reviewer_info") is not None:
|
|
2063
|
+
out.append((st["reviewer"], st["reviewer_info"], bool(st.get("reviewer_busy"))))
|
|
2064
|
+
return out
|
|
2065
|
+
|
|
2066
|
+
|
|
2067
|
+
def still_compacting(st, name, w=None):
|
|
2068
|
+
"""True while an agent that got the compact command may still be compacting: herdr shows it working, or it has
|
|
2069
|
+
been idle for less than COMPACT_SETTLE_S. Such an agent is busy: it gets no new work."""
|
|
2070
|
+
w = w if w is not None else agent_info(st, name)
|
|
2071
|
+
h = (w or {}).get("compacting")
|
|
2072
|
+
if not h or not w.get("detect", True):
|
|
2073
|
+
return False
|
|
2074
|
+
if now() - h.get("ts", 0) > COMPACT_MAX_S:
|
|
2075
|
+
return False
|
|
2076
|
+
s = herdr_state(name)
|
|
2077
|
+
if s is None:
|
|
2078
|
+
return False
|
|
2079
|
+
if busy_word(s):
|
|
2080
|
+
return True
|
|
2081
|
+
return now() - (h.get("idle_since") or h.get("ts", 0)) < COMPACT_SETTLE_S
|
|
2082
|
+
|
|
2083
|
+
|
|
2084
|
+
def compact_due(st, name, w, next_tid=None):
|
|
2085
|
+
"""The compact command to send now, or None. Due when the agent's chat holds another milestone than next_tid
|
|
2086
|
+
(or, with no next_tid, a milestone that has landed), it holds no job, and herdr shows it idle."""
|
|
2087
|
+
ctx = w.get("ctx")
|
|
2088
|
+
if not ctx or ctx == next_tid or w.get("compacting") or not w.get("detect", True) or w.get("off"):
|
|
2089
|
+
return None
|
|
2090
|
+
if next_tid is None and (st["tasks"].get(ctx) or {}).get("status", "merged") not in ("merged", "skipped"):
|
|
2091
|
+
return None
|
|
2092
|
+
if w.get("stopping") or cooling(name, w):
|
|
2093
|
+
return None
|
|
2094
|
+
cmd, _ = compact_command(st, w.get("kind"))
|
|
2095
|
+
if not cmd:
|
|
2096
|
+
return None
|
|
2097
|
+
s = herdr_state(name)
|
|
2098
|
+
if s is None or busy_word(s):
|
|
2099
|
+
return None
|
|
2100
|
+
return cmd
|
|
2101
|
+
|
|
2102
|
+
|
|
2103
|
+
def start_compact(st, name, w, cmd, before=None):
|
|
2104
|
+
"""Type the compact command into the agent's pane. The caller saves the state. Returns True when it was sent."""
|
|
2105
|
+
after = w.get("ctx")
|
|
2106
|
+
try:
|
|
2107
|
+
deliver(st, name, cmd)
|
|
2108
|
+
except DeliveryError:
|
|
2109
|
+
return False
|
|
2110
|
+
w["compacting"] = {"ts": now(), "after": after, "cmd": cmd, "before": before}
|
|
2111
|
+
story_note(st, f"{name} finished {after}: orch sent {cmd} so its chat does not keep growing"
|
|
2112
|
+
+ (f" (before it starts {before})" if before else ""), who="event manager")
|
|
2113
|
+
return True
|
|
2114
|
+
|
|
2115
|
+
|
|
2116
|
+
def compacting_line(st, name, w):
|
|
2117
|
+
h = w.get("compacting") or {}
|
|
2118
|
+
return (f"compacting its chat after {h.get('after') or '?'} ({h.get('cmd') or '/compact'}, sent "
|
|
2119
|
+
f"{_fmt_secs(now() - h.get('ts', now()))} ago; it gets new work once herdr shows it idle)")
|
|
2120
|
+
|
|
2121
|
+
|
|
1982
2122
|
def commit_message(st, tid):
|
|
1983
2123
|
"""Commit message for a landed milestone: the coder's `COMMIT:` line (what changed), else the title.
|
|
1984
2124
|
The milestone id is a trailer, never the subject."""
|
|
@@ -2502,7 +2642,7 @@ def cmd_ready(args):
|
|
|
2502
2642
|
slots = 1 # shared mode: a queued fix job IS the active milestone, and it needs a coder
|
|
2503
2643
|
# only coders herdr can see count as free: a coder with no agent can't take work, whatever its task field says
|
|
2504
2644
|
present = [n for n, w in st["workers"].items() if not w.get("task") and not w.get("off") and not cooling(n, w)
|
|
2505
|
-
and not still_stopping(st, n, w)
|
|
2645
|
+
and not still_stopping(st, n, w) and not still_compacting(st, n, w)
|
|
2506
2646
|
and (not w.get("detect", True) or w.get("pane") or herdr_state(n) is not None)]
|
|
2507
2647
|
gone = [n for n, w in st["workers"].items() if not w.get("task") and not w.get("off") and w.get("detect", True)
|
|
2508
2648
|
and not w.get("pane") and herdr_state(n) is None]
|
|
@@ -2528,7 +2668,8 @@ def cooling(name, info):
|
|
|
2528
2668
|
|
|
2529
2669
|
|
|
2530
2670
|
def worker_free(st, name, w):
|
|
2531
|
-
if w.get("task") or w.get("off") or cooling(name, w) or still_stopping(st, name, w)
|
|
2671
|
+
if w.get("task") or w.get("off") or cooling(name, w) or still_stopping(st, name, w) \
|
|
2672
|
+
or still_compacting(st, name, w):
|
|
2532
2673
|
return False
|
|
2533
2674
|
if not w.get("detect", True): # herdr can't watch it: no task + no cooldown = free
|
|
2534
2675
|
return True
|
|
@@ -2573,6 +2714,15 @@ def cmd_prepare(args):
|
|
|
2573
2714
|
f"(or `orch free {worker}` after you checked its pane)")
|
|
2574
2715
|
sys.exit(3)
|
|
2575
2716
|
w.pop("stopping", None)
|
|
2717
|
+
if still_compacting(st, worker, w):
|
|
2718
|
+
print(f"BUSY {worker} is {compacting_line(st, worker, w)}")
|
|
2719
|
+
sys.exit(3)
|
|
2720
|
+
squash = None if w.get("task") == tid else compact_due(st, worker, w, tid)
|
|
2721
|
+
if squash and start_compact(st, worker, w, squash, tid):
|
|
2722
|
+
save(st)
|
|
2723
|
+
print(f"BUSY {worker} is compacting its chat after {w['compacting']['after']} first ({squash}); {tid} starts "
|
|
2724
|
+
f"there once herdr shows it idle")
|
|
2725
|
+
sys.exit(3)
|
|
2576
2726
|
if not holds(st, tid) and free_slots(st) <= 0 and not (st["isolation"] == "shared" and t["status"] in ("conflict", "needs-fix")):
|
|
2577
2727
|
die("no free slot (max parallel reached)")
|
|
2578
2728
|
d = Path(w["dir"] or ROOT)
|
|
@@ -2795,6 +2945,8 @@ def cmd_send(args):
|
|
|
2795
2945
|
"result": str(d / rel / f"result-{k}.json"), "since": now(), "started": now(), "kind": "coder",
|
|
2796
2946
|
"prompt": text, "nudges": 0, "file": fname, "delivering": True,
|
|
2797
2947
|
"model": st["workers"][t["worker"]].get("model"), "tier": st["workers"][t["worker"]].get("tier")}
|
|
2948
|
+
st["workers"][t["worker"]]["ctx"] = tid # its chat now holds this milestone (compacted before another)
|
|
2949
|
+
st["workers"][t["worker"]].pop("compacting", None)
|
|
2798
2950
|
save(st)
|
|
2799
2951
|
try:
|
|
2800
2952
|
deliver(st, t["worker"], text)
|
|
@@ -2888,10 +3040,15 @@ def cmd_review(args):
|
|
|
2888
3040
|
die("no reviewer configured")
|
|
2889
3041
|
ri = st.get("reviewer_info") or {}
|
|
2890
3042
|
busy = st.get("reviewer_busy") and st["reviewer_busy"] != tid
|
|
2891
|
-
if busy or cooling(st["reviewer"], ri)
|
|
3043
|
+
squash = None if busy or cooling(st["reviewer"], ri) or still_compacting(st, st["reviewer"], ri) else \
|
|
3044
|
+
compact_due(st, st["reviewer"], ri, tid)
|
|
3045
|
+
if squash and not start_compact(st, st["reviewer"], ri, squash, tid):
|
|
3046
|
+
squash = None
|
|
3047
|
+
if busy or cooling(st["reviewer"], ri) or still_compacting(st, st["reviewer"], ri):
|
|
2892
3048
|
move(st, tid, "awaiting-review")
|
|
2893
3049
|
save(st)
|
|
2894
|
-
why = f"is on {st['reviewer_busy']}" if busy else "is benched (cooldown)"
|
|
3050
|
+
why = (f"is on {st['reviewer_busy']}" if busy else "is benched (cooldown)" if cooling(st["reviewer"], ri)
|
|
3051
|
+
else compacting_line(st, st["reviewer"], ri))
|
|
2895
3052
|
print(f"BUSY reviewer {why}; {tid} queued as awaiting-review")
|
|
2896
3053
|
sys.exit(3)
|
|
2897
3054
|
d = task_dir(t, tid)
|
|
@@ -2962,6 +3119,9 @@ def cmd_review(args):
|
|
|
2962
3119
|
rtext = f"Read {rel}/review-task-{k}.md and do exactly what it says."
|
|
2963
3120
|
t["review_round"] = k
|
|
2964
3121
|
st["reviewer_busy"] = tid
|
|
3122
|
+
if st.get("reviewer_info") is not None:
|
|
3123
|
+
st["reviewer_info"]["ctx"] = tid # its chat now holds this milestone (compacted before another)
|
|
3124
|
+
st["reviewer_info"].pop("compacting", None)
|
|
2965
3125
|
move(st, tid, "reviewing")
|
|
2966
3126
|
t["wait"] = {"agent": st["reviewer"], "sentinel": str(sentinel), "report": str(rd / f"review-{k}.md"),
|
|
2967
3127
|
"result": str(rd / f"review-{k}.json"), "since": now(), "started": now(), "kind": "reviewer",
|
|
@@ -3143,6 +3303,12 @@ def cmd_poll(args):
|
|
|
3143
3303
|
if events:
|
|
3144
3304
|
print("\n".join(events))
|
|
3145
3305
|
return
|
|
3306
|
+
# an agent that got /compact and is idle again can take its next milestone now: back to the event manager
|
|
3307
|
+
squashed = [n for n, w, holding in compact_agents(st) if w.get("compacting") and not holding
|
|
3308
|
+
and not still_compacting(st, n, w)]
|
|
3309
|
+
if squashed:
|
|
3310
|
+
print(f"WAITING compacted: {' '.join(squashed)} (free for new work)")
|
|
3311
|
+
sys.exit(10)
|
|
3146
3312
|
if time.time() >= end:
|
|
3147
3313
|
running = [f"{tid}:{st['tasks'][tid]['status']}" for tid in st["order"]
|
|
3148
3314
|
if st["tasks"][tid]["status"] in ("coding", "reviewing", "conflict")]
|
|
@@ -3635,9 +3801,13 @@ def cmd_status(args):
|
|
|
3635
3801
|
if st.get("mode") == "quick":
|
|
3636
3802
|
print(f"QUICK RUN because: {st.get('quick_because') or '-'}")
|
|
3637
3803
|
print(f"branch={st['branch']} base={st.get('base')} isolation={st['isolation']} "
|
|
3638
|
-
f"max_parallel={st['max_parallel']} reviewer={st['reviewer']} (busy: {st.get('reviewer_busy')})"
|
|
3804
|
+
f"max_parallel={st['max_parallel']} reviewer={st['reviewer']} (busy: {st.get('reviewer_busy')})"
|
|
3805
|
+
+ (f" — reviewer {compacting_line(st, st['reviewer'], st['reviewer_info'])}"
|
|
3806
|
+
if st.get("reviewer") and still_compacting(st, st["reviewer"], st.get("reviewer_info") or {}) else ""))
|
|
3639
3807
|
vu = view_url()
|
|
3640
3808
|
print(f"live view: {vu}" if vu else "live view: off — `orch view` shows this run as a picture in your browser")
|
|
3809
|
+
for n in run_notices(st):
|
|
3810
|
+
print("note: " + n["text"])
|
|
3641
3811
|
if st.get("integration_broken"):
|
|
3642
3812
|
print(f" INTEGRATION BROKEN: the check failed on {st['branch']} after merging "
|
|
3643
3813
|
f"{st['integration_broken']} — fix it; autopilot re-checks before it continues")
|
|
@@ -3647,6 +3817,7 @@ def cmd_status(args):
|
|
|
3647
3817
|
state = ("OFF (" + (w["off"].get("why") or "developer") + ")" if w.get("off") else
|
|
3648
3818
|
f"coding {w['task']}" if w.get("task") else
|
|
3649
3819
|
stopping_line(st, n, w) if still_stopping(st, n, w) else
|
|
3820
|
+
compacting_line(st, n, w) if still_compacting(st, n, w) else
|
|
3650
3821
|
f"benched {cd // 60}m ({w.get('cooldown_reason') or 'cooldown'})" if cd else "free")
|
|
3651
3822
|
if state == "free" and h == "ok" and w.get("detect", True) and busy_word(herdr_state(n)):
|
|
3652
3823
|
state = "free, but herdr shows it working: look at its pane before it gets new work"
|
|
@@ -5693,6 +5864,70 @@ def _autopilot(args):
|
|
|
5693
5864
|
+ f". It gets no new work until it is idle; look at its pane (`orch free {n}` once it has "
|
|
5694
5865
|
f"stopped)", h.get("again", 0) >= 1)
|
|
5695
5866
|
|
|
5867
|
+
def _agent_of(s_, name):
|
|
5868
|
+
return s_["workers"].get(name) if name in s_.get("workers", {}) else \
|
|
5869
|
+
(s_.get("reviewer_info") if name == s_.get("reviewer") else None)
|
|
5870
|
+
|
|
5871
|
+
def tend_compacts():
|
|
5872
|
+
"""Coders and the reviewer whose milestone landed get their tool's compact command while they are idle and
|
|
5873
|
+
hold no job; one that is compacting is free again once herdr shows it idle (or after COMPACT_MAX_S)."""
|
|
5874
|
+
st_ = load()
|
|
5875
|
+
for n, w, holding in compact_agents(st_):
|
|
5876
|
+
if holding:
|
|
5877
|
+
continue
|
|
5878
|
+
h = w.get("compacting")
|
|
5879
|
+
if h:
|
|
5880
|
+
s = herdr_state(n) if w.get("detect", True) else None
|
|
5881
|
+
busy = s is not None and busy_word(s)
|
|
5882
|
+
if busy and h.get("idle_since"):
|
|
5883
|
+
h["idle_since"] = None
|
|
5884
|
+
elif s is not None and not busy and not h.get("idle_since"):
|
|
5885
|
+
h["idle_since"] = now()
|
|
5886
|
+
late = now() - h.get("ts", 0) > COMPACT_MAX_S
|
|
5887
|
+
done = not still_compacting(st_, n, w)
|
|
5888
|
+
|
|
5889
|
+
def upd(s_, n=n, idle=h.get("idle_since"), done=done, late=late, busy=busy):
|
|
5890
|
+
a = _agent_of(s_, n)
|
|
5891
|
+
if not a or not a.get("compacting"):
|
|
5892
|
+
return
|
|
5893
|
+
if not done:
|
|
5894
|
+
a["compacting"]["idle_since"] = idle
|
|
5895
|
+
return
|
|
5896
|
+
a.pop("compacting", None)
|
|
5897
|
+
a["ctx"] = None
|
|
5898
|
+
if late and busy:
|
|
5899
|
+
story_note(s_, f"{n} was still busy {_fmt_secs(COMPACT_MAX_S)} after {h.get('cmd')}: orch "
|
|
5900
|
+
f"stopped waiting for it", who="event manager")
|
|
5901
|
+
patch_state(upd)
|
|
5902
|
+
if done:
|
|
5903
|
+
say(f"{n} is still working {_fmt_secs(COMPACT_MAX_S)} after {h.get('cmd')}: look at its pane"
|
|
5904
|
+
if late and busy else f"COMPACTED {n}: its chat after {h.get('after')} is now a short summary",
|
|
5905
|
+
late and busy)
|
|
5906
|
+
continue
|
|
5907
|
+
if not compact_due(st_, n, w):
|
|
5908
|
+
why = w.get("ctx") and w.get("detect", True) and compact_unsupported(st_, n, w.get("kind"))
|
|
5909
|
+
if why and w.get("kind") not in st_.get("compact_told", []):
|
|
5910
|
+
def told(s_, n=n, k=w.get("kind"), why=why):
|
|
5911
|
+
if k not in s_.setdefault("compact_told", []):
|
|
5912
|
+
s_["compact_told"].append(k)
|
|
5913
|
+
story_note(s_, f"{n}'s chat is not compacted: {why}", who="event manager")
|
|
5914
|
+
patch_state(told)
|
|
5915
|
+
say(f"{n}'s chat is not compacted: {why}")
|
|
5916
|
+
continue
|
|
5917
|
+
sent_ = {}
|
|
5918
|
+
|
|
5919
|
+
def go(s_, n=n, ctx=w.get("ctx")):
|
|
5920
|
+
a = _agent_of(s_, n)
|
|
5921
|
+
holds_ = (a or {}).get("task") if n in s_.get("workers", {}) else s_.get("reviewer_busy")
|
|
5922
|
+
if not a or holds_ or a.get("ctx") != ctx or a.get("compacting"):
|
|
5923
|
+
return
|
|
5924
|
+
cmd, _ = compact_command(s_, a.get("kind"))
|
|
5925
|
+
if cmd and start_compact(s_, n, a, cmd):
|
|
5926
|
+
sent_["cmd"] = cmd
|
|
5927
|
+
patch_state(go)
|
|
5928
|
+
if sent_:
|
|
5929
|
+
say(f"{n} finished {w.get('ctx')} and is idle: sent {sent_['cmd']} so its chat does not keep growing")
|
|
5930
|
+
|
|
5696
5931
|
def dispatch(kind, tid, worker):
|
|
5697
5932
|
code, prep = run("prepare", tid, worker, ok=(0, 3))
|
|
5698
5933
|
if code == 3: # the coder is busy after all (still stopping its last milestone): next loop
|
|
@@ -5897,6 +6132,7 @@ def _autopilot(args):
|
|
|
5897
6132
|
patch_state(lambda s_: (s_["run"].get("manager") or {}).update(procs))
|
|
5898
6133
|
watch_herdr()
|
|
5899
6134
|
tend_stops()
|
|
6135
|
+
tend_compacts()
|
|
5900
6136
|
# 0. budget: driving time adds up across restarts (time spent only waiting for an answer doesn't count)
|
|
5901
6137
|
el, last_tick = time.time() - last_tick, time.time()
|
|
5902
6138
|
asleep = slept()
|
|
@@ -6984,6 +7220,65 @@ def view_events(limit=None):
|
|
|
6984
7220
|
return out
|
|
6985
7221
|
|
|
6986
7222
|
|
|
7223
|
+
ORCH_OWN_MD = {"plan.md", "summary.md", "summary.prev.md", "story.md", "pr-body.md", "manual-tests.md"}
|
|
7224
|
+
|
|
7225
|
+
|
|
7226
|
+
def other_plan_files(newer_than=0):
|
|
7227
|
+
""".orchestrate/*.md files that orch does not write itself and does not read (it reads plan.md only)."""
|
|
7228
|
+
out = []
|
|
7229
|
+
try:
|
|
7230
|
+
for f in sorted(ORCH.glob("*.md")):
|
|
7231
|
+
if f.name not in ORCH_OWN_MD and f.stat().st_mtime > newer_than:
|
|
7232
|
+
out.append(f.name)
|
|
7233
|
+
except OSError:
|
|
7234
|
+
pass
|
|
7235
|
+
return out
|
|
7236
|
+
|
|
7237
|
+
|
|
7238
|
+
def _ago(secs):
|
|
7239
|
+
secs = max(0, int(secs))
|
|
7240
|
+
return ("less than a minute" if secs < 60 else f"{secs // 60} min" if secs < 3600 else
|
|
7241
|
+
f"{secs // 3600} h" if secs < 86400 else f"{secs // 86400} d")
|
|
7242
|
+
|
|
7243
|
+
|
|
7244
|
+
def run_notices(st):
|
|
7245
|
+
"""Plain-words notes for the views and `orch status` when what they show is not a run that is going now:
|
|
7246
|
+
the last run finished long ago, or a plan was written that orch will not read. Never fails."""
|
|
7247
|
+
try:
|
|
7248
|
+
try:
|
|
7249
|
+
state_t = STATE.stat().st_mtime
|
|
7250
|
+
except OSError:
|
|
7251
|
+
state_t = 0
|
|
7252
|
+
out = []
|
|
7253
|
+
if st is not None:
|
|
7254
|
+
tasks = st.get("tasks", {})
|
|
7255
|
+
active = any((tasks.get(t) or {}).get("status") in ACTIVE for t in st.get("order", []))
|
|
7256
|
+
done = bool(st.get("order")) and (
|
|
7257
|
+
all((tasks.get(t) or {}).get("status") in ("merged", "skipped") for t in st["order"])
|
|
7258
|
+
or any(e.get("kind") == "finished" for e in st.get("lead_events", [])))
|
|
7259
|
+
if active or driver_alive() or not done:
|
|
7260
|
+
return out # a run is going (or stopped half way): nothing to add
|
|
7261
|
+
out.append({"kind": "old_run", "text": (
|
|
7262
|
+
f"This is the last run ({st.get('title') or st.get('branch')}): all its milestones landed "
|
|
7263
|
+
f"{_ago(now() - state_t)} ago. No run is going now. For a new run, put the plan in "
|
|
7264
|
+
f".orchestrate/plan.md and run `orch sync`.")})
|
|
7265
|
+
try:
|
|
7266
|
+
if (ORCH / "plan.md").stat().st_mtime > state_t:
|
|
7267
|
+
out.append({"kind": "plan_unsynced", "text": (
|
|
7268
|
+
".orchestrate/plan.md was changed after this run. Run `orch sync` to load it.")})
|
|
7269
|
+
except OSError:
|
|
7270
|
+
pass
|
|
7271
|
+
others = other_plan_files(state_t)
|
|
7272
|
+
if others:
|
|
7273
|
+
out.append({"kind": "other_plan", "text": (
|
|
7274
|
+
f"{', '.join('.orchestrate/' + o for o in others[:3])} "
|
|
7275
|
+
f"{'is' if len(others) == 1 else 'are'} not used: orch only reads .orchestrate/plan.md. "
|
|
7276
|
+
f"Rename or copy it to plan.md, then run `orch sync`.")})
|
|
7277
|
+
return out
|
|
7278
|
+
except Exception:
|
|
7279
|
+
return []
|
|
7280
|
+
|
|
7281
|
+
|
|
6987
7282
|
def view_model(st=None, recent=40):
|
|
6988
7283
|
"""The run in one stable shape ("view": 1). Adding fields is fine; renaming one needs "view": 2."""
|
|
6989
7284
|
if st is None:
|
|
@@ -6991,7 +7286,8 @@ def view_model(st=None, recent=40):
|
|
|
6991
7286
|
st = json.loads(STATE.read_text())
|
|
6992
7287
|
except (OSError, ValueError):
|
|
6993
7288
|
return {"view": VIEW_SCHEMA, "empty": True, "repo": ROOT.name,
|
|
6994
|
-
"text": "No run in this repo yet: the lead writes the plan, then `orch sync` / `orch start`."
|
|
7289
|
+
"text": "No run in this repo yet: the lead writes the plan, then `orch sync` / `orch start`.",
|
|
7290
|
+
"notices": run_notices(None)}
|
|
6995
7291
|
tasks, t_now = st.get("tasks", {}), now()
|
|
6996
7292
|
ms, by_model = [], {}
|
|
6997
7293
|
for tid in st.get("order", []):
|
|
@@ -7033,6 +7329,7 @@ def view_model(st=None, recent=40):
|
|
|
7033
7329
|
for n, w in st.get("workers", {}).items():
|
|
7034
7330
|
cd = max(0, w.get("cooldown_until", 0) - t_now)
|
|
7035
7331
|
state = ("off" if w.get("off") else "stopping" if w.get("stopping") else
|
|
7332
|
+
"compacting" if w.get("compacting") and not w.get("task") else
|
|
7036
7333
|
(VIEW_WORDS.get(tasks.get(w["task"], {}).get("status"), "working") if w.get("task") else
|
|
7037
7334
|
f"benched {cd // 60}m" if cd else "free"))
|
|
7038
7335
|
agents.append({"name": n, "role": "coder", "kind": w.get("kind"), "model": w.get("model"),
|
|
@@ -7041,7 +7338,8 @@ def view_model(st=None, recent=40):
|
|
|
7041
7338
|
ri = st.get("reviewer_info") or {}
|
|
7042
7339
|
busy = st.get("reviewer_busy")
|
|
7043
7340
|
agents.append({"name": st["reviewer"], "role": "reviewer", "kind": ri.get("kind"), "model": ri.get("model"),
|
|
7044
|
-
"tier": ri.get("tier"), "task": busy, "state": "reviewing" if busy else
|
|
7341
|
+
"tier": ri.get("tier"), "task": busy, "state": "reviewing" if busy else
|
|
7342
|
+
"compacting" if ri.get("compacting") else "free"})
|
|
7045
7343
|
groups = [m["group"] for m in ms]
|
|
7046
7344
|
run = st.get("run") or {}
|
|
7047
7345
|
return {
|
|
@@ -7062,6 +7360,7 @@ def view_model(st=None, recent=40):
|
|
|
7062
7360
|
"open": len([e for e in st.get("lead_events", []) if event_open(st, e)])} if st.get("lead") else None),
|
|
7063
7361
|
"recent": view_events(recent)[::-1],
|
|
7064
7362
|
"all_done": bool(ms) and all(m["status"] in ("merged", "skipped") for m in ms),
|
|
7363
|
+
"notices": run_notices(st),
|
|
7065
7364
|
}
|
|
7066
7365
|
|
|
7067
7366
|
|
|
@@ -7521,8 +7820,10 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
|
|
|
7521
7820
|
|
|
7522
7821
|
def cut(s, n):
|
|
7523
7822
|
return s if len(s) <= n else s[:max(0, n - 1)] + "…"
|
|
7823
|
+
notes = [c("a", ln) for n in vm.get("notices", [])
|
|
7824
|
+
for ln in textwrap.wrap("! " + n["text"], max(30, width - 2), subsequent_indent=" ")]
|
|
7524
7825
|
if vm.get("empty"):
|
|
7525
|
-
return [c("a", "orch board"), "", vm.get("text", "No run yet.")]
|
|
7826
|
+
return [c("a", "orch board"), "", vm.get("text", "No run yet.")] + ([""] + notes if notes else [])
|
|
7526
7827
|
cn = vm["counts"]
|
|
7527
7828
|
out = [c("a", f"orch board · {vm.get('branch')}") + c("d", f" {time.strftime('%H:%M')} · live"),
|
|
7528
7829
|
c("B", f"{cn['landed']} of {cn['total']} landed")
|
|
@@ -7534,6 +7835,7 @@ def render_board(vm, width=100, color=True, sel=None, note=""):
|
|
|
7534
7835
|
out.append(c("d", f"tokens {u['tokens'] / 1e6:.1f}M · cost ~${u['cost_usd']:.2f}"))
|
|
7535
7836
|
if vm.get("all_done"):
|
|
7536
7837
|
out.append(c("g", "ALL DONE — `orch finish` pushes the branch and opens the PR"))
|
|
7838
|
+
out += notes
|
|
7537
7839
|
out += ["", c("d", "MILESTONES")]
|
|
7538
7840
|
ms = {m["id"]: m for m in vm["milestones"]}
|
|
7539
7841
|
kids = {}
|
|
@@ -7670,6 +7972,8 @@ USAGE = """usage: orch <command> [args]
|
|
|
7670
7972
|
version print the installed herdr-orchestra version
|
|
7671
7973
|
update [--check] [--version vX.Y.Z] install the latest release (or that one) and show what is new
|
|
7672
7974
|
config [auto-update on|off] this machine's settings: keep orch up to date by itself, or only be told
|
|
7975
|
+
config compact on|off a coder or the reviewer gets /compact when its milestone is done (on by default for
|
|
7976
|
+
Claude Code, Codex and AGY 1.2.15+; never the lead). ORCH_COMPACT=0|1 overrides it
|
|
7673
7977
|
lead plan|run print the lead playbook (any agent can lead: "Run `orch lead plan` and follow it")
|
|
7674
7978
|
lead plan quick|full the rest of the plan playbook: a quick run's rules, or steps 3-10 of the full process
|
|
7675
7979
|
lead run --section <EVENT|ALL_DONE|rules> one part of the run playbook (orch events prints these for you)
|
|
@@ -8477,6 +8781,10 @@ def cmd_doctor(args):
|
|
|
8477
8781
|
continue
|
|
8478
8782
|
bad = [m for ok, m in res if not ok]
|
|
8479
8783
|
broken += bool(bad)
|
|
8784
|
+
if str(reg[k].get("compact") or "").strip(): # information only: no compacting is never "broken"
|
|
8785
|
+
cmd, why = compact_command({}, k)
|
|
8786
|
+
res.append((True, f"compact: {cmd} between milestones (coders and the reviewer)" if cmd else
|
|
8787
|
+
f"compact: not sent — {why}"))
|
|
8480
8788
|
print(f"{'BROKEN' if bad else 'ok':<7} {k}" + ("" if reg[k].get("verified") else " (registry entry unverified)"))
|
|
8481
8789
|
for ok, m in res:
|
|
8482
8790
|
print(f" {'ok ' if ok else 'BAD'} {m}")
|
|
@@ -9223,7 +9531,7 @@ def cmd_sub(args):
|
|
|
9223
9531
|
|
|
9224
9532
|
|
|
9225
9533
|
def cmd_config(args):
|
|
9226
|
-
"""orch config -> this machine's settings; orch config auto-update on|off."""
|
|
9534
|
+
"""orch config -> this machine's settings; orch config auto-update on|off; orch config compact on|off."""
|
|
9227
9535
|
if args[:1] == ["auto-update"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
9228
9536
|
s = settings_load()
|
|
9229
9537
|
s["auto_update"] = args[1].lower() == "on"
|
|
@@ -9232,13 +9540,28 @@ def cmd_config(args):
|
|
|
9232
9540
|
"never during a run" if s["auto_update"] else " — orch only tells you when a new version is out; "
|
|
9233
9541
|
"update with `orch update`"))
|
|
9234
9542
|
return
|
|
9543
|
+
if args[:1] == ["compact"] and args[1:2] and args[1].lower() in ("on", "off"):
|
|
9544
|
+
s = settings_load()
|
|
9545
|
+
s["compact"] = args[1].lower() == "on"
|
|
9546
|
+
settings_save(s)
|
|
9547
|
+
print(f"compact: {args[1].lower()}" + (" — a coder or the reviewer gets its tool's compact command "
|
|
9548
|
+
"(/compact) when its milestone is done, before it starts another one" if s["compact"] else
|
|
9549
|
+
" — orch never compacts an agent's chat; the tools still compact by themselves when the chat is full"))
|
|
9550
|
+
return
|
|
9235
9551
|
if args:
|
|
9236
|
-
die("usage: orch config | orch config auto-update on|off")
|
|
9552
|
+
die("usage: orch config | orch config auto-update on|off | orch config compact on|off")
|
|
9237
9553
|
s = settings_load()
|
|
9238
9554
|
env = os.environ.get("ORCH_AUTO_UPDATE")
|
|
9239
9555
|
print(f"auto-update: {'on' if auto_update_on() else 'off'}"
|
|
9240
9556
|
+ (f" (ORCH_AUTO_UPDATE={env} overrides the saved setting)" if env else "")
|
|
9241
9557
|
+ ("" if "auto_update" in s or env else " (never asked: `orch config auto-update on` turns it on)"))
|
|
9558
|
+
cenv = os.environ.get("ORCH_COMPACT")
|
|
9559
|
+
reg = registry(required=False) or {}
|
|
9560
|
+
kinds = [k for k, v in reg.items() if str(v.get("compact") or "").strip()]
|
|
9561
|
+
print(f"compact: {'on' if compact_on() else 'off'}"
|
|
9562
|
+
+ (f" (ORCH_COMPACT={cenv} overrides the saved setting)" if cenv in ("0", "1") else "")
|
|
9563
|
+
+ (f" — coders and the reviewer on {', '.join(kinds)} get /compact between milestones; "
|
|
9564
|
+
"`orch config compact off` turns it off" if compact_on() and kinds else ""))
|
|
9242
9565
|
print(f"installed: {installed_version()}" + ("" if release_install() else " (not a release install: no update checks)"))
|
|
9243
9566
|
lc = int(s.get("last_check") or 0)
|
|
9244
9567
|
print("last check: " + (time.strftime("%Y-%m-%d %H:%M", time.localtime(lc)) if lc else "never")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "herdr-orchestra",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.14.0",
|
|
4
4
|
"description": "Orchestrate AI coding agents (Claude Code, Codex, OpenCode, Amp, Pi) as one team: a lead plans, coders build, a reviewer checks, you get one PR. Runs in Herdr panes, or in one Pi window with subagents.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
package/playbooks/run.md
CHANGED
|
@@ -60,7 +60,7 @@ If you changed plan.md by hand, run `orch sync` (it works once the event manager
|
|
|
60
60
|
|
|
61
61
|
**Swap a coder** (for example, AGY instead of OpenCode): `orch stop` (the event manager finishes its current step and exits; nothing is lost), change `Workers:` in plan.md, `orch sync`, `orch team up`, check that `orch status` shows the new worker as `herdr=ok`, then `orch resume`. Never kill the event manager by hand.
|
|
62
62
|
|
|
63
|
-
**Move a milestone to another coder** (for example M7 from rs-agy-1 to rs-claude-1): `orch set M7 paused`, then `orch dispatch M7 --to rs-claude-1`. orch presses the old coder's interrupt key and tells it to stop. Tell the developer it has stopped only when `orch status` no longer shows it as `stopping M7`; until then it may still be editing files, and it gets no new work.
|
|
63
|
+
**Move a milestone to another coder** (for example M7 from rs-agy-1 to rs-claude-1): `orch set M7 paused`, then `orch dispatch M7 --to rs-claude-1`. orch presses the old coder's interrupt key and tells it to stop. Tell the developer it has stopped only when `orch status` no longer shows it as `stopping M7`; until then it may still be editing files, and it gets no new work. A coder or the reviewer shown as `compacting` got `/compact` after its last milestone (orch does this by itself between milestones, never mid-work): it takes its next milestone in a minute, nothing to do.
|
|
64
64
|
|
|
65
65
|
**Before `orch dispatch --to <worker>`**, `orch status` must show that worker as `herdr=ok`. dispatch refuses a worker with no agent (`NO AGENT`, `SHELL ONLY`); do what it says (`orch team up`) and try again. If `orch team up` reports `QUIT <worker>`, the agent quit as soon as it started: show the developer the pane and the saved screen it names.
|
|
66
66
|
|
package/view/index.html
CHANGED
|
@@ -63,6 +63,8 @@ button:hover{border-color:var(--accent)}
|
|
|
63
63
|
.card code{background:var(--bg);padding:5px 8px;display:block;border-radius:3px;margin-top:6px;color:var(--accent);word-break:break-all}
|
|
64
64
|
.card table{width:100%;border-collapse:collapse;font-family:var(--mono);font-size:11.5px}.card td{padding:3px 0;vertical-align:top}.card td:last-child{text-align:right}
|
|
65
65
|
.muted{color:var(--muted)}.faint{color:var(--faint)}.bad{color:var(--bad)}.ok{color:var(--landed)}.warn{color:var(--accent)}
|
|
66
|
+
.notes{margin:10px 16px 0;padding:8px 12px;border:1px solid var(--accent);border-radius:4px;color:var(--accent);font-size:13px;line-height:1.5}
|
|
67
|
+
.notes div+div{margin-top:4px}
|
|
66
68
|
.empty{padding:60px 20px;text-align:center;color:var(--muted);font-size:14px}
|
|
67
69
|
@media (max-width:820px){
|
|
68
70
|
.grid{grid-template-columns:1fr}.left{border-right:0}
|
|
@@ -78,6 +80,7 @@ button:hover{border-color:var(--accent)}
|
|
|
78
80
|
<span id="chips" style="display:flex;gap:8px;flex-wrap:wrap"></span>
|
|
79
81
|
<span class="live" id="live"><button id="alerts" title="Show a notification when a milestone needs you">alerts: off</button><span id="livetxt">connecting…</span></span>
|
|
80
82
|
</div>
|
|
83
|
+
<div id="notes"></div>
|
|
81
84
|
<div id="root"></div>
|
|
82
85
|
<script>
|
|
83
86
|
"use strict";
|
|
@@ -117,6 +120,8 @@ function replayed(vm, hist, upto) {
|
|
|
117
120
|
function render() {
|
|
118
121
|
const v = view();
|
|
119
122
|
if (!v) return;
|
|
123
|
+
$("notes").innerHTML = (v.notices || []).length
|
|
124
|
+
? `<div class="notes">${v.notices.map(n => `<div>${esc(n.text)}</div>`).join("")}</div>` : "";
|
|
120
125
|
if (v.empty) { $("root").innerHTML = `<div class="empty">${esc(v.text)}</div>`; $("t-title").textContent = v.repo; return; }
|
|
121
126
|
const c = v.counts;
|
|
122
127
|
document.title = (c.needs_you ? `(${c.needs_you}) ` : "") + `orch view · ${v.title}`;
|