herdr-orchestra 6.39.0 → 6.41.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 CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes. Versions follow [semantic versioning](https://semver.org).
4
4
 
5
+ ## [6.41.0] - 2026-11-28
6
+
7
+ The board (`prefix+a`, `orch board`) no longer drops keys you typed while it was busy.
8
+
9
+ Example: on a busy machine you press `↓`, `Enter`, `→` quickly while the board is still reading git. Before, all three reached it at once, were read as one unknown key, and nothing happened. Now it reads them one by one: it picks the milestone, opens its files, and moves to the next milestone.
10
+
11
+ ### Fixed
12
+ - **Keys typed while the board was busy were lost.** The board read up to 8 bytes at a time, so keys waiting together in the terminal became one string that matched no key. It now reads one key at a time: a whole escape sequence (arrows, Page Up and Page Down) or one character. This was the 1 failing check in the main CI run after 6.33.0 ("↓ picks a milestone and Enter opens its files"). That run was on a loaded machine, so the keys queued up.
13
+ - **Keys typed while the board was starting were thrown away.** This was the 1 failing check in the main CI run after 6.34.0 ("the board popup: f shows the changed files"). On a busy machine the board took over a second to start, and the test typed `f` and `Enter` in that time. Two things lost them. Turning on key-by-key mode flushed what was already typed (now `TCSANOW`). The half-second guard against terminal replies at open dropped every key, not only the replies. It now drops only what a terminal sends by itself (focus, cursor or size reports, OSC strings, a lone Esc), so `f`, Enter and the arrows count. A new check types the keys before the board has started.
14
+ - New checks type the keys in one go, and before the board has started. They fail before this fix and pass after it.
15
+
16
+ ## [6.40.0] - 2026-11-28
17
+
18
+ Tokens per milestone no longer miss a reply written in a job's last second. That also made the CI check "orch report: ... tokens per milestone" fail now and then (main CI after 6.34.0, PR #68).
19
+
20
+ Example: a coder's last reply is saved at 10:42:07.6 and orch sees the job's done file in the same second. orch keeps whole seconds, so it took 10:42:07 as the job's end and left that reply out. The milestone showed fewer tokens, or "not available" when it was the job's only reply.
21
+
22
+ ### Fixed
23
+ - **A job's token window now runs at least one second past its end**, the next job's start still cutting it off after that (`token_measure`).
24
+ - A new check in section 65 has a reply 0.6 s after the job's whole-second end. It fails before the fix and passes after. Section 18 run 12 times at once: 3 failed before the fix, none after.
5
25
  ## [6.39.0] - 2026-11-28
6
26
 
7
27
  The lead now writes the plan and the team in its chat before it asks "Keep this team?". Before, an Antigravity lead ran `orch plan show` as a command, the agent folded its output away ("ctrl+o to expand"), and the picker came up right after, so you were asked to keep a team you never saw.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 6.39.0
1
+ 6.41.0
Binary file
package/bin/orch CHANGED
@@ -2620,7 +2620,9 @@ def token_measure(st, agent, kind, marker, start, end, cap=None):
2620
2620
  path = token_log_find(kind, marker, start, known)
2621
2621
  if not path:
2622
2622
  return None if now() - end < TOKEN_GIVE_UP_S else {"na": f"no {kind} log has this job's prompt"}
2623
- acc = token_window(kind, path, start, min(end + TOKEN_GRACE_S, cap or float("inf")))
2623
+ # orch's clock has whole seconds (now() is an int): a reply written in the job's last second is later than
2624
+ # `end`, so the window always runs at least one second past it (the next job's start cuts it off after that)
2625
+ acc = token_window(kind, path, start, max(end + 1, min(end + 1 + TOKEN_GRACE_S, cap or float("inf"))))
2624
2626
  except TokenNA as e:
2625
2627
  return {"na": str(e)}
2626
2628
  if path not in known:
@@ -10021,10 +10023,34 @@ def render_diff(ch, f, lines, width=100, height=40, color=True, top=0, err=None)
10021
10023
  return head + [""] + shown + foot, top
10022
10024
 
10023
10025
 
10026
+ def _terminal_reply(key):
10027
+ """True for what a terminal sends by itself as a popup opens, never typed: focus in/out, cursor or size reports,
10028
+ device replies, OSC/DCS strings, and a lone Esc (the start of one that came in pieces)."""
10029
+ if key == "\x1b" or key[:2] in ("\x1b]", "\x1bP", "\x1b_", "\x1b^"):
10030
+ return True
10031
+ return key.startswith("\x1b[") and (key in ("\x1b[I", "\x1b[O") or key[-1:] in ("R", "t", "c", "n", "y"))
10032
+
10033
+
10024
10034
  def _board_key(fd, select):
10025
- ch = os.read(fd, 8).decode(errors="ignore")
10026
- if ch == "\x1b" and select.select([sys.stdin], [], [], 0.05)[0]:
10027
- ch += os.read(fd, 8).decode(errors="ignore") # the rest of an escape sequence, not the Esc key
10035
+ """ONE key press from the terminal. Keys typed while the board was busy (reading git on a loaded machine) wait
10036
+ together in the terminal; reading them all at once made `↓ Enter →` one unknown key, and nothing happened."""
10037
+ def more(wait=0.05):
10038
+ return select.select([fd], [], [], wait)[0]
10039
+ b = os.read(fd, 1)
10040
+ if b == b"\x1b":
10041
+ if more(): # the rest of an escape sequence, not the Esc key
10042
+ b += os.read(fd, 1)
10043
+ if b[1:] in (b"[", b"O"): # CSI / SS3: up to and including the final byte (@ to ~)
10044
+ while len(b) < 16 and more():
10045
+ b += os.read(fd, 1)
10046
+ if 0x40 <= b[-1] <= 0x7e:
10047
+ break
10048
+ elif b and b[0] >= 0xc0: # the other bytes of one UTF-8 character
10049
+ need = 3 if b[0] >= 0xf0 else 2 if b[0] >= 0xe0 else 1
10050
+ while need and more():
10051
+ b += os.read(fd, 1)
10052
+ need -= 1
10053
+ ch = b.decode(errors="ignore")
10028
10054
  return {"\x1bOA": "\x1b[A", "\x1bOB": "\x1b[B", "\x1bOC": "\x1b[C", "\x1bOD": "\x1b[D"}.get(ch, ch)
10029
10055
 
10030
10056
 
@@ -10106,7 +10132,8 @@ def cmd_board(args):
10106
10132
  mid, ch, fsel, ftop = None, None, 0, 0 # the changed-files screen: milestone, its changes, picked file, scroll
10107
10133
  dfile, dlines, derr, dtop = None, [], None, 0 # the diff screen
10108
10134
  try:
10109
- tty.setcbreak(fd)
10135
+ # TCSANOW, not the default TCSAFLUSH: that throws away every key typed while the board was starting up
10136
+ tty.setcbreak(fd, termios.TCSANOW)
10110
10137
  sys.stdout.write("\x1b[?1049h\x1b[?25l")
10111
10138
  while True:
10112
10139
  k = _view_snapshot_key()
@@ -10143,8 +10170,9 @@ def cmd_board(args):
10143
10170
  if not r:
10144
10171
  continue
10145
10172
  key = _board_key(fd, select)
10146
- if time.time() - opened < 0.5:
10147
- continue # what a terminal sends as a pane opens (focus or size replies) is not a key press
10173
+ if time.time() - opened < 0.5 and _terminal_reply(key):
10174
+ continue # what a terminal sends as a pane opens (focus or size replies) is not a key press;
10175
+ # keys typed while the board was starting (f, Enter, an arrow) still count
10148
10176
  size = shutil.get_terminal_size((100, 40))
10149
10177
  if screen == "diff":
10150
10178
  page = max(3, size.lines - 8)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "herdr-orchestra",
3
- "version": "6.39.0",
3
+ "version": "6.41.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": {