@johngaynor/ocnus 2.0.1-next.20 → 2.0.1-next.24

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/README.md CHANGED
@@ -379,6 +379,13 @@ ocnus space team my-space ABC # once: the team whose cards are ABC-122
379
379
  ocnus task ls my-space
380
380
  ```
381
381
 
382
+ With `--json`, for programs, the list also says which cards are held and
383
+ which cards each of them waits on: a card is held while it is in a
384
+ not-started status, such as Todo, and a card that blocks it, or its parent,
385
+ is not done, which is when `task start` holds it. Each card names its parent
386
+ there too, with its place among the parent's sub-issues and how many of them
387
+ are done.
388
+
382
389
  It asks Linear itself, with no agent running. `ocnus status` checks the
383
390
  saved key with Linear each time it runs: it says whose the key is when it
384
391
  works, notes when no key is saved or when the key could not be checked, and
@@ -878,7 +885,7 @@ read afterwards. It is off until you turn it on, and works on macOS only.
878
885
 
879
886
  ```sh
880
887
  ocnus host on # turn recording on
881
- ocnus host report [<period>] # how often CPU, memory and disk were at their limit, with how many agents working and how much slower test runs were, what was going then, what used the most, where the steps' time went, whether the network may be the cause, and what to upgrade first
888
+ ocnus host report [<period>] # how often CPU, memory and disk were at their limit, what used the most, and where the steps' time went
882
889
  ocnus host off # turn it off, and delete every reading
883
890
  ocnus host # whether recording is on, and what it has
884
891
  ocnus tests run <command> # run a test command, and record the test run
@@ -949,31 +956,7 @@ and disk it says how much of the recorded time it was at its limit: the CPU
949
956
  at least 90% busy across all cores, memory pressure at warning or critical,
950
957
  or under 10% of the home folder's disk free. Time with no reading, such as
951
958
  when no agent was open, is shown as missing, never as idle. It also says how
952
- much of the CPU recording used, watching the test runs included. Then, for
953
- each number of agents working at once, from none up, it says how long that
954
- many were working and how much of that time the CPU or memory was at its
955
- limit. It names the fewest working at which that was at least a quarter of
956
- the time, as the number from which the host was the limit, so you can tell
957
- how many agents to run at once, or says the host was not the limit at any
958
- number. Readings from before the agents working were counted are left out
959
- of these figures, and their time is counted on a line of its own. Under
960
- each number from 2 up, it says how much slower test runs were than with one
961
- agent working, as a percentage, such as `test runs 30% slower than with 1
962
- working, from 3 runs of 1 command against 3 with 1 working`. It sets only
963
- runs of the same command in the same repo against each other, and a command
964
- counts only once it has run at least 3 times with that many working and 3
965
- times with one; with none that has, it says it cannot tell yet. A test run
966
- counts at the number of agents working for most of its time. Runs cut
967
- short, runs from before the fingerprints were kept, and runs while no
968
- reading counted the agents working are left out. Then it names the 5
969
- longest stretches in the period when the CPU or memory was at its limit,
970
- longest first: when each started, how long it lasted and which of the two
971
- was at its limit, then every card going then, with its step, or its phase
972
- when it was in none, and every test run going then, each with its share of
973
- all cores over the stretch and the most memory it held. Each card also says
974
- for how much of the stretch its agent was working. With none, it says the
975
- host was never at its limit for CPU or memory. Disk is not among them: a
976
- full disk is not caused by a moment's work. Then it lists the
959
+ much of the CPU recording used, watching the test runs included. Then it lists the
977
960
  10 steps and the 10 phases that used the most CPU time in the period, and
978
961
  the 10 of each that held the most memory at once, each one card's own, such
979
962
  as LAB-150's build step, with how long it ran. Then come the 10 test runs
@@ -983,34 +966,6 @@ Then it says where the steps' time went: the agents' time in all on the
983
966
  host, waiting on the model and the rest, then the same for the 10 steps open
984
967
  longest, each one card's own, such as LAB-152's build step, and how many
985
968
  steps had no split.
986
-
987
- Then it says whether the network may be the cause, as a slow wait on the
988
- model can be the network rather than the host. A wait is slow when it took
989
- over twice the median of every wait on the model recorded, up to 90 days.
990
- When waits that ended in the period were slow while CPU, memory and disk
991
- were all below their limit, in every reading over the wait, it says so:
992
- `The network may be the cause: 14 of 120 waits on the model were slow (over
993
- twice the median of 6.2s) while CPU, memory and disk were below their
994
- limit.` A slow wait with no reading over it does not count. With none, it
995
- says nothing. It cannot tell a slow network from a slow model.
996
-
997
- Last comes the verdict, one line with the numbers behind it, so that money
998
- goes on what slows the agents' work on the host. It weighs each reading by
999
- the agents' time on the host in it, the seconds their tools ran, an agent's
1000
- second each, from the splits. With fewer than 10 steps with their time
1001
- split in the period, or under 1 hour of the agents' time on the host, there
1002
- is too little data yet, and it says how many and how long. Otherwise, of
1003
- CPU, memory and disk, the one at its limit for the most of the agents' time
1004
- on the host, when that is at least 10% of it, is the one to upgrade first:
1005
- `upgrade memory first: it was at its limit for 23.0% of the agents' 6h 10m
1006
- on the host (CPU 8.0%, disk 0.0%)`. When over half of its time at its limit
1007
- was on battery, in Low Power Mode or with the thermal state at serious or
1008
- critical, the verdict is that the power state was the limit, in place of an
1009
- upgrade: plugging in, or letting the machine cool, costs nothing. With none
1010
- at its limit for 10%, the network was the limit when at least 10% of the
1011
- period's waits on the model were slow while CPU, memory and disk were below
1012
- their limit, so that no host upgrade is bought that would not have helped.
1013
- Otherwise no upgrade is needed.
1014
969
  See [herdr/README.md](herdr/README.md#recording-the-host) for what a
1015
970
  reading holds.
1016
971
 
package/cli/lib/host.sh CHANGED
@@ -33,9 +33,7 @@
33
33
  # turn, as herdr-core's status for its terminal says, and waiting while it is
34
34
  # open but its turn has ended, it waits on the human in its tab, it hit an
35
35
  # error, or it reports no status. A tab that holds its shell alone is not
36
- # open, so it is neither. `host report` shows, for each number of agents
37
- # working, how much of the time the host was at its limit, and from which
38
- # number the host was the limit.
36
+ # open, so it is neither.
39
37
  #
40
38
  # Beside the readings go the test runs: each run of a repo's tests that an
41
39
  # agent starts through `ocnus tests run` (tests.sh), with its card and
@@ -43,16 +41,12 @@
43
41
  # memory it held at once. A test run is named by its card and repo alone.
44
42
  # Its command is kept only as a fingerprint, a number the same for the same
45
43
  # command and from which its text cannot be read back, and nothing else of
46
- # its command line is kept. `host report` ranks the test runs too, and sets
47
- # runs of the same command in the same repo against each other to say how
48
- # much slower they were with more agents working.
44
+ # its command line is kept. `host report` ranks the test runs too.
49
45
  #
50
46
  # With each reading go the shares of the test runs going then, too, each
51
47
  # worked out as a terminal's is, from the processes under the run's job,
52
48
  # which are in their terminal's share as well. A run that ended since the
53
- # reading before gets the rest of its CPU in the next one. `host report`
54
- # names the cards' steps and the test runs going in the longest stretches
55
- # when the CPU or memory was at its limit.
49
+ # reading before gets the rest of its CPU in the next one.
56
50
  #
57
51
  # While recording is on, `task new` and `task build` start claude with hooks
58
52
  # that mark its agent's time (host_hooks): cli/host-mark appends a word and
@@ -64,16 +58,10 @@
64
58
  # those marks (host_splits): on the host, while its tools run, and waiting
65
59
  # on the model. The rest of the time its agent was open is neither, such as
66
60
  # waiting on the human. `host report` says where the steps' time went by
67
- # them, and ends with its verdict on the host, which weighs each reading by
68
- # the agents' time on the host in it: what to upgrade first, if anything.
61
+ # them.
69
62
  #
70
63
  # From the same marks, each wait on the model is kept too, as its start and
71
- # end alone, by the reading it ended in. A wait is slow at over twice the
72
- # median of every wait kept. When slow waits came while the CPU, memory and
73
- # disk were all below their limit, `host report` says the network may be the
74
- # cause, and when they were at least a tenth of the period's waits, and no
75
- # resource was the one to upgrade, its verdict is that the network was the
76
- # limit.
64
+ # end alone, by the reading it ended in.
77
65
  #
78
66
  # A share's card, phase and step, a split's, a wait's, and a test run's card
79
67
  # and repo, are the only text the readings hold, and only the values
@@ -1218,11 +1206,11 @@ host_day() {
1218
1206
 
1219
1207
  # How the CPU, memory and disk were, over a period: how much of the time it
1220
1208
  # was recorded, and how much of that each was at its limit. Time with no
1221
- # reading is shown as missing, never as idle. It ends with whether the
1222
- # network may be the cause of slow waits on the model, and the verdict on
1223
- # the host: what to upgrade first, if anything (host_verdict_sql).
1209
+ # reading is shown as missing, never as idle. Then come the steps, phases
1210
+ # and test runs that used the most (host_ranks_sql), and it ends with where
1211
+ # the steps' time went (host_split_sql).
1224
1212
  host_report() {
1225
- local period=${1:-7d} now start end n first last row works runs working shared splits power slower waits
1213
+ local period=${1:-7d} now start end n first last row works splits
1226
1214
  [ "$#" -le 1 ] || die "$HOST_USAGE"
1227
1215
  now=$(date +%s)
1228
1216
  case $period in
@@ -1262,38 +1250,20 @@ host_report() {
1262
1250
  say "Recording is on, and takes a reading every $HOST_EVERY seconds while an ocnus agent is open."
1263
1251
  return 0
1264
1252
  fi
1265
- # A store the recorder has not opened since the shares, the cores, the
1266
- # test runs and their shares, the agents working, the splits, the power
1267
- # state, the fingerprints of the test runs' commands, and the waits on the
1268
- # model came has none of them: one digit each, 1 for what it has, and for
1269
- # the power state how many of its 3 columns it has. The report only reads
1270
- # the store, so it never adds them, and leaves out what is missing.
1253
+ # A store the recorder has not opened since the cores, the shares, the
1254
+ # test runs and the splits came has none of them: one digit each, 1 for
1255
+ # what it has. The report only reads the store, so it never adds them, and
1256
+ # leaves out what is missing.
1271
1257
  row=$(store "$HOST_DB" "select (select count(*) from pragma_table_info('readings') where name = 'cores')
1272
1258
  || (select count(*) from sqlite_master where type = 'table' and name = 'shares')
1273
1259
  || (select count(*) from sqlite_master where type = 'table' and name = 'test_runs')
1274
- || (select count(*) from sqlite_master where type = 'table' and name = 'run_shares')
1275
- || (select count(*) from pragma_table_info('readings') where name = 'working')
1276
- || (select count(*) from pragma_table_info('shares') where name = 'working')
1277
- || (select count(*) from sqlite_master where type = 'table' and name = 'splits')
1278
- || (select count(*) from pragma_table_info('readings') where name in ('on_battery', 'low_power', 'thermal'))
1279
- || (select count(*) from pragma_table_info('test_runs') where name = 'cmd')
1280
- || (select count(*) from sqlite_master where type = 'table' and name = 'model_waits');") || row=
1281
- works=0 runs=0 working=0 shared=0 splits=0 power=0 slower=0 waits=0
1282
- case $row in ?1????????) works=1 ;; esac
1283
- case $row in ??11??????) runs=1 ;; esac
1284
- case $row in ????1?????) working=1 ;; esac
1285
- case $row in ?1???1????) shared=1 ;; esac
1286
- case $row in ?1????1???) splits=1 ;; esac
1287
- case $row in ???????3??) power=1 ;; esac
1288
- case $row in ????1???1?) slower=1 ;; esac
1289
- case $row in ?????????1) waits=1 ;; esac
1290
- case $row in 111???????) row=1 ;; *) row=0 ;; esac
1260
+ || (select count(*) from sqlite_master where type = 'table' and name = 'splits');") || row=
1261
+ works=0 splits=0
1262
+ case $row in ?1??) works=1 ;; esac
1263
+ case $row in ?1?1) splits=1 ;; esac
1264
+ case $row in 111?) row=1 ;; *) row=0 ;; esac
1291
1265
  store "$HOST_DB" "$(host_report_sql "$start" "$end" "$period" "$row")" ||
1292
1266
  die "could not read $HOST_DB"
1293
- store "$HOST_DB" "$(host_working_sql "$start" "$end" "$working" "$slower")" ||
1294
- die "could not read $HOST_DB"
1295
- store "$HOST_DB" "$(host_peaks_sql "$start" "$end" "$works" "$runs" "$shared")" ||
1296
- die "could not read $HOST_DB"
1297
1267
  if [ "$row" = 1 ]; then
1298
1268
  store "$HOST_DB" "$(host_ranks_sql "$start" "$end")" || die "could not read $HOST_DB"
1299
1269
  else
@@ -1301,7 +1271,6 @@ host_report() {
1301
1271
  say 'No step, phase or test run was recorded in this period.'
1302
1272
  fi
1303
1273
  store "$HOST_DB" "$(host_split_sql "$start" "$end" "$works" "$splits")" || die "could not read $HOST_DB"
1304
- store "$HOST_DB" "$(host_verdict_sql "$start" "$end" "$splits" "$power" "$waits")" || die "could not read $HOST_DB"
1305
1274
  }
1306
1275
 
1307
1276
  # The report's query, for the period from $1 to $2, named $3. A reading
@@ -1366,178 +1335,6 @@ select line from lines order by n, k;
1366
1335
  EOF
1367
1336
  }
1368
1337
 
1369
- # The agents working at once, from $1 to $2: for each number of agents
1370
- # working that the readings counted, from none up, how long that many were
1371
- # working, and how much of that time the CPU or the memory was at its limit,
1372
- # as the report counts it. Each reading counts for the part of it in the
1373
- # period. A reading from before the agents working were counted has no
1374
- # count, and nor has any when $3 is not 1, as the store has no column for
1375
- # them yet: it is left out, never counted as none working, and its time is
1376
- # on a line of its own. Last, the fewest working at which the CPU or memory
1377
- # was at its limit for at least a quarter of the time is named as the number
1378
- # from which the host was the limit; or it says there is no such number, or
1379
- # that no reading counted the agents working.
1380
- #
1381
- # Under each number from 2 up, with $4 as 1, which says the store has the
1382
- # fingerprints of the test runs' commands, comes how much slower test runs
1383
- # were than with one working. A test run that started in the period counts
1384
- # at the number working that covers most of its time, over the readings
1385
- # that counted them, and at the larger number on a tie. A run that was cut
1386
- # short, is still going, has no fingerprint, as one from before they were
1387
- # kept, or overlaps no reading with a count, is left out. A command is a
1388
- # repo and a fingerprint, so only runs of the same command in the same repo
1389
- # are set against each other, and a command counts at a number when it ran
1390
- # at least 3 times with that many working and 3 times with one. Its ratio is
1391
- # its runs' median time with that many working over their median time with
1392
- # one, and the figure is the median of the commands' ratios, so one odd run,
1393
- # such as one that failed early, does not move it. With no such command, it
1394
- # says it cannot tell yet.
1395
- host_working_sql() {
1396
- local s=$1 e=$2 working=working slower=0 runs='select null, null, null, null, null where 0' counted=null
1397
- [ "${3:-0}" = 1 ] || working=null
1398
- if [ "$working" = working ] && [ "${4:-0}" = 1 ]; then
1399
- slower=1 counted=g.working
1400
- runs="select id, repo, cmd, started, secs from test_runs
1401
- where started >= $s and started < $e and ended is not null and cut = 0 and cmd is not null and secs is not null"
1402
- fi
1403
- cat <<EOF
1404
- with
1405
- parts(n, d, lim) as (
1406
- select $working, max(0, min(at, $e) - max(at - secs, $s)), coalesce(cpu_busy >= 90 or mem_pressure >= 2, 0)
1407
- from readings where at > $s and at < $e + $HOST_GAP and at - secs < $e),
1408
- counts(n, len, lim) as (
1409
- select n, sum(d), sum(case when lim then d else 0 end) from parts where n is not null group by n),
1410
- uncounted(len) as (select coalesce(sum(d), 0) from parts where n is null),
1411
- fewest(n) as (select min(n) from counts where len > 0 and 4 * lim >= len),
1412
- runs(id, repo, cmd, started, secs) as ($runs),
1413
- -- A cross join keeps the runs outside, so that each one looks up only its
1414
- -- own readings by their at, never every reading for each run.
1415
- over(id, n, d) as (
1416
- select r.id, $counted, sum(max(0, min(g.at, r.started + r.secs) - max(g.at - g.secs, r.started)))
1417
- from runs r cross join readings g
1418
- on g.at > r.started and g.at < r.started + r.secs + $HOST_GAP and g.at - g.secs < r.started + r.secs
1419
- where $counted is not null group by r.id, $counted),
1420
- at_n(id, n) as (
1421
- select id, n from (select id, n, row_number() over (partition by id order by d desc, n desc) k from over) where k = 1),
1422
- timed(repo, cmd, n, secs, i, c) as (
1423
- select r.repo, r.cmd, a.n, r.secs, row_number() over (partition by r.repo, r.cmd, a.n order by r.secs),
1424
- count(*) over (partition by r.repo, r.cmd, a.n)
1425
- from runs r join at_n a on a.id = r.id),
1426
- medians(repo, cmd, n, runs, secs) as (
1427
- select repo, cmd, n, max(c), avg(secs) from timed where i in ((c + 1) / 2, (c + 2) / 2) group by repo, cmd, n),
1428
- ratios(n, ratio, runs, base, i, c) as (
1429
- select m.n, m.secs / b.secs, m.runs, b.runs, row_number() over (partition by m.n order by m.secs / b.secs),
1430
- count(*) over (partition by m.n)
1431
- from medians m join medians b on b.repo = m.repo and b.cmd = m.cmd and b.n = 1
1432
- where m.n >= 2 and m.runs >= 3 and b.runs >= 3 and b.secs > 0),
1433
- slower(n, ratio) as (select n, avg(ratio) from ratios where i in ((c + 1) / 2, (c + 2) / 2) group by n),
1434
- rested(n, cmds, runs, base) as (select n, count(*), sum(runs), sum(base) from ratios group by n),
1435
- lines(part, n, o, line) as (
1436
- select 0, 0, 0, ''
1437
- union all select 0, 1, 0, 'Agents working at once:'
1438
- union all
1439
- select 1, n, 0, ' ' || printf('%-11s', n || ' working') || ' ' || $(sql_took len) || ', CPU or memory at its limit '
1440
- || $(sql_took lim) || ', ' || printf('%.1f%%', 100.0 * lim / nullif(len, 0)) || ' of it'
1441
- from counts
1442
- union all
1443
- select 1, c.n, 1, ' test runs' || case when s.ratio is null
1444
- then ': cannot tell yet, as no command ran at least 3 times with ' || c.n || ' working and 3 times with 1'
1445
- else ' ' || case when s.ratio >= 1 then printf('%.0f%% slower', 100.0 * (s.ratio - 1))
1446
- else printf('%.0f%% faster', 100.0 * (1 - s.ratio)) end
1447
- || ' than with 1 working, from ' || r.runs || ' runs of ' || r.cmds || case when r.cmds = 1 then ' command' else ' commands' end
1448
- || ' against ' || r.base || ' with 1 working' end
1449
- from counts c left join slower s on s.n = c.n left join rested r on r.n = c.n
1450
- where c.n >= 2 and $slower
1451
- union all
1452
- select 2, 0, 0, ' not counted ' || $(sql_took len) || ', by readings from before the agents working were counted'
1453
- from uncounted where len > 0
1454
- union all
1455
- select 3, 0, 0, case
1456
- when not exists (select 1 from counts) then ' No reading in this period counted the agents working.'
1457
- when n is null then ' The host was not the limit at any number of working agents in this period: at each, the CPU or memory was at its limit for under a quarter of the time.'
1458
- else ' The host was the limit from ' || n || ' working ' || case when n = 1 then 'agent' else 'agents' end
1459
- || ': the fewest at which the CPU or memory was at its limit for at least a quarter of the time.' end
1460
- from fewest)
1461
- select line from lines order by part, n, o;
1462
- EOF
1463
- }
1464
-
1465
- # The longest stretches from $1 to $2 when the CPU or the memory was at its
1466
- # limit, as the report counts it, five at most, longest first. A stretch is
1467
- # readings in a row at the limit, each starting where the one before ended,
1468
- # and each counts for the part of it in the period, as the report counts a
1469
- # reading. Each says when it started, how long it lasted and which of the
1470
- # two was at its limit, then the work going in it: each card's step, or its
1471
- # phase when its card is in none, from the shares when $3 is 1, then each
1472
- # test run, from their shares when $4 is 1. Each has its share of all cores
1473
- # over the stretch, its share in each reading counted for that reading's
1474
- # part, and the most memory it held in one reading. Each card also has how
1475
- # much of the stretch its agent was working: the parts of the readings in
1476
- # which a share of its was working, over the stretch's length. With $5 not 1,
1477
- # the shares have no column for it, and with no share that says, as from
1478
- # before the agents working were told apart, it says it was not read. A
1479
- # share that names no card is left out. With no stretch, it says the host was
1480
- # never at its limit.
1481
- host_peaks_sql() {
1482
- local s=$1 e=$2 shares runs
1483
- shares='select at, card, phase, step, cpu, mem_mb, working from shares'
1484
- [ "${5:-0}" = 1 ] || shares='select at, card, phase, step, cpu, mem_mb, null from shares'
1485
- [ "${3:-0}" = 1 ] || shares='select null, null, null, null, null, null, null where 0'
1486
- runs='select r.at, r.run, t.card, t.repo, t.started, r.cpu, r.mem_mb from run_shares r join test_runs t on t.id = r.run'
1487
- [ "${4:-0}" = 1 ] || runs='select null, null, null, null, null, null, null where 0'
1488
- cat <<EOF
1489
- with
1490
- lim(at, start, d, cpu, mem, new) as (
1491
- select at, max(at - secs, $s), max(0, min(at, $e) - max(at - secs, $s)),
1492
- coalesce(cpu_busy >= 90, 0), coalesce(mem_pressure >= 2, 0),
1493
- case when lag(at) over (order by at) = at - secs then 0 else 1 end
1494
- from readings
1495
- where at > $s and at < $e + $HOST_GAP and at - secs < $e and (cpu_busy >= 90 or mem_pressure >= 2)),
1496
- grouped(at, start, d, cpu, mem, n) as (
1497
- select at, start, d, cpu, mem, sum(new) over (order by at rows between unbounded preceding and current row) from lim),
1498
- stretches(n, start, len, cpu, mem) as (
1499
- select n, min(start), sum(d), max(cpu), max(mem) from grouped group by n),
1500
- ranked(k, n, start, len, cpu, mem) as (
1501
- select row_number() over (order by len desc, start), n, start, len, cpu, mem from stretches),
1502
- top(k, n, start, len, cpu, mem) as (select k, n, start, len, cpu, mem from ranked where k <= 5),
1503
- parts(k, len, at, d) as (select t.k, t.len, g.at, g.d from top t join grouped g on g.n = t.n),
1504
- sh(at, card, phase, step, cpu, mem, working) as ($shares),
1505
- rs(at, run, card, repo, started, cpu, mem) as ($runs),
1506
- cards(k, len, at, d, name, cpu, mem, working) as (
1507
- select p.k, p.len, p.at, p.d, sh.card || ' ' || coalesce(sh.step || ' step', sh.phase || ' phase'), sum(sh.cpu), sum(sh.mem),
1508
- max(sh.working)
1509
- from parts p join sh on sh.at = p.at
1510
- where sh.card is not null and coalesce(sh.step, sh.phase) is not null
1511
- group by p.k, p.at, sh.card, sh.step, sh.phase),
1512
- work(k, part, name, cpu, mem, working) as (
1513
- select k, 1, name, sum(1.0 * cpu * d) / len, max(mem),
1514
- case when count(working) > 0 then 100.0 * sum(case when working = 1 then d else 0 end) / len end
1515
- from cards group by k, name
1516
- union all
1517
- select p.k, 2, rs.card || ' ' || rs.repo || ' test run ' || strftime('%Y-%m-%d %H:%M', rs.started, 'unixepoch', 'localtime'),
1518
- sum(1.0 * rs.cpu * p.d) / p.len, max(rs.mem), null
1519
- from parts p join rs on rs.at = p.at group by p.k, rs.run),
1520
- lines(k, part, o, line) as (
1521
- select -1, 0, 0, ''
1522
- union all select 0, 0, 0, 'Longest stretches with CPU or memory at its limit:' where exists (select 1 from top)
1523
- union all select 0, 0, 0, 'The host was never at its limit for CPU or memory in this period.' where not exists (select 1 from top)
1524
- union all
1525
- select k, 0, 0, ' ' || strftime('%Y-%m-%d %H:%M:%S', start, 'unixepoch', 'localtime') || ' for ' || $(sql_took len) || ', '
1526
- || case when cpu and mem then 'CPU and memory at their limit' when cpu then 'CPU at its limit' else 'memory at its limit' end
1527
- from top
1528
- union all
1529
- select k, part, row_number() over (partition by k, part order by cpu desc, name),
1530
- ' ' || printf('%-44s', name) || ' ' || case when cpu is null then 'CPU not read' else 'CPU ' || printf('%.1f%%', cpu) end
1531
- || ', ' || case when mem is null then 'memory not read' else 'memory ' || mem || ' MB' end
1532
- || case when part = 2 then '' when working is null then ', working not read'
1533
- else ', working ' || printf('%.0f%%', working) || ' of it' end
1534
- from work
1535
- union all
1536
- select k, 3, 0, ' no card or test run was going' from top t where not exists (select 1 from work w where w.k = t.k))
1537
- select line from lines order by k, part, o;
1538
- EOF
1539
- }
1540
-
1541
1338
  # The steps and the phases that used the most CPU time, and that held the
1542
1339
  # most memory at once, from $1 to $2: ten of each, each one card's own. Each
1543
1340
  # counts what its shares say for the part of their reading in the period,
@@ -1663,133 +1460,6 @@ select line from lines order by k;
1663
1460
  EOF
1664
1461
  }
1665
1462
 
1666
- # The verdict on the host from $1 to $2, from the splits when $3 is 1, and
1667
- # the power state of the readings when $4 is 1, and the waits on the model
1668
- # when $5 is 1: the report's last line, after the network line when there
1669
- # is one.
1670
- #
1671
- # A wait on the model is slow when it took over twice the median of every
1672
- # wait in model_waits, so 90 days at most: the wait halfway in order of
1673
- # length, the later of the two for an even count. A slow wait counts for the
1674
- # network when there is a reading over it, and every reading over it, in
1675
- # whole or in part, had the CPU, memory and disk below their limit, as the
1676
- # report counts it. The period's waits are those that ended in it. With any
1677
- # that count, the network line, between blank lines, says the network may
1678
- # be the cause: how many of the period's waits were slow while the host was
1679
- # below its limit, and the median. A store with no waits on the model has
1680
- # none.
1681
- #
1682
- # The agents' time on the host is their splits' seconds on the host, an
1683
- # agent's second each, each split counted for the part of its reading in the
1684
- # period, as the report counts a reading. The verdict is the first of these
1685
- # that holds:
1686
- # - too little data yet, with under HOST_VERDICT_STEPS steps with a split
1687
- # in the period, each one card's own, or under HOST_VERDICT_SECS of the
1688
- # agents' time on the host. It says how many and how long, against them.
1689
- # - of the CPU, memory and disk, the one at its limit, as the report counts
1690
- # it, for the most of the agents' time on the host, and for at least
1691
- # HOST_VERDICT_PCT% of it, the CPU before memory before the disk when two
1692
- # were as long: the power state was the limit, when over half of that
1693
- # one's time at its limit was on battery, in Low Power Mode or with the
1694
- # thermal state at serious or critical, and otherwise it is the one to
1695
- # upgrade first.
1696
- # - the network was the limit, when the waits that count for it are at
1697
- # least HOST_VERDICT_PCT% of the period's waits on the model. It gives
1698
- # that share and the median.
1699
- # - no upgrade is needed.
1700
- # All but the first say how much of the agents' time on the host each was at
1701
- # its limit. A store with no splits has too little data, and one whose
1702
- # readings have no power state counts them as on power, as a reading with
1703
- # none of it does.
1704
- HOST_VERDICT_STEPS=10
1705
- HOST_VERDICT_SECS=3600
1706
- HOST_VERDICT_PCT=10
1707
- host_verdict_sql() {
1708
- local s=$1 e=$2 splits power waits took median
1709
- splits='select at, card, step, host_secs from splits'
1710
- [ "${3:-0}" = 1 ] || splits='select null, null, null, null where 0'
1711
- power='coalesce(on_battery = 1 or low_power = 1 or thermal >= 2, 0)'
1712
- [ "${4:-0}" = 1 ] || power=0
1713
- waits='select ended - started, started, ended from model_waits'
1714
- [ "${5:-0}" = 1 ] || waits='select null, null, null where 0'
1715
- took=$(sql_took 'cast(round(t.host) as integer)')
1716
- # A median under a minute is given to a tenth of a second.
1717
- median="case when m < 59.95 then printf('%.1fs', m) else $(sql_took 'cast(round(m) as integer)') end"
1718
- cat <<EOF
1719
- with
1720
- parts(at, secs, d, cpu, mem, disk, power) as (
1721
- select at, secs, max(0, min(at, $e) - max(at - secs, $s)),
1722
- coalesce(cpu_busy >= 90, 0), coalesce(mem_pressure >= 2, 0), coalesce(disk_free_pct < 10, 0), $power
1723
- from readings where at > $s and at < $e + $HOST_GAP and at - secs < $e and secs > 0),
1724
- x(at, card, step, host) as ($splits),
1725
- sp(card, step, host, cpu, mem, disk, power) as (
1726
- select x.card, x.step, 1.0 * coalesce(x.host, 0) * p.d / p.secs, p.cpu, p.mem, p.disk, p.power
1727
- from parts p join x on x.at = p.at),
1728
- total(steps, host) as (
1729
- select (select count(*) from (select distinct card, step from sp where card is not null and step is not null)),
1730
- coalesce(sum(host), 0) from sp),
1731
- res(o, name, lim, pow) as (
1732
- select 1, 'the CPU', coalesce(sum(case when cpu then host end), 0), coalesce(sum(case when cpu and power then host end), 0) from sp
1733
- union all
1734
- select 2, 'memory', coalesce(sum(case when mem then host end), 0), coalesce(sum(case when mem and power then host end), 0) from sp
1735
- union all
1736
- select 3, 'the disk', coalesce(sum(case when disk then host end), 0), coalesce(sum(case when disk and power then host end), 0) from sp),
1737
- pcts(cpu, mem, disk) as (
1738
- select max(case when o = 1 then pct end), max(case when o = 2 then pct end), max(case when o = 3 then pct end)
1739
- from (select o, printf('%.1f%%', 100.0 * lim / nullif(t.host, 0)) pct from res, total t)),
1740
- named(o, name, lim, pow) as (
1741
- select o, name, lim, pow from res, total t
1742
- where lim > 0 and 100.0 * lim >= $HOST_VERDICT_PCT * t.host order by lim desc, o limit 1),
1743
- w(d, started, ended) as ($waits),
1744
- med(m) as (select d from w order by d limit 1 offset (select count(*) / 2 from w)),
1745
- inp(d, started, ended) as (select d, started, ended from w where ended >= $s and ended < $e),
1746
- slow(started, ended) as (select i.started, i.ended from inp i, med where i.d > 2 * med.m),
1747
- span(secs) as (select coalesce(max(secs), 0) from readings),
1748
- below(n) as (
1749
- select count(*) from slow, span
1750
- where exists (select 1 from readings r
1751
- where r.at > slow.started and r.at < slow.ended + span.secs and r.at - r.secs < slow.ended)
1752
- and not exists (select 1 from readings r
1753
- where r.at > slow.started and r.at < slow.ended + span.secs and r.at - r.secs < slow.ended
1754
- and (coalesce(r.cpu_busy >= 90, 0) or coalesce(r.mem_pressure >= 2, 0) or coalesce(r.disk_free_pct < 10, 0)))),
1755
- net(n, total, median) as (select b.n, (select count(*) from inp), $median from below b, med),
1756
- lines(k, line) as (
1757
- select 0, ''
1758
- union all
1759
- select 1, 'The network may be the cause: ' || n || ' of ' || total || case when total = 1 then ' wait' else ' waits' end
1760
- || ' on the model ' || case when n = 1 then 'was' else 'were' end || ' slow (over twice the median of ' || median
1761
- || ') while CPU, memory and disk were below their limit.'
1762
- from net where n > 0
1763
- union all
1764
- select 2, '' from net where n > 0
1765
- union all
1766
- select 3, 'Verdict: ' || case
1767
- when t.steps < $HOST_VERDICT_STEPS or t.host < $HOST_VERDICT_SECS then
1768
- 'too little data yet: ' || t.steps || case when t.steps = 1 then ' step had its' else ' steps had their' end
1769
- || ' time split, with ' || $took || ' of the agents'' time on the host, and a verdict takes at least '
1770
- || '$HOST_VERDICT_STEPS steps and ' || $(sql_took $HOST_VERDICT_SECS) || '.'
1771
- when f.o is not null then
1772
- case when 2 * f.pow > f.lim then 'the power state was the limit, not ' || f.name else 'upgrade ' || f.name || ' first' end
1773
- || ': it was at its limit for ' || printf('%.1f%%', 100.0 * f.lim / t.host) || ' of the agents'' ' || $took || ' on the host'
1774
- || case when 2 * f.pow > f.lim then ', ' || printf('%.1f%%', 100.0 * f.pow / f.lim)
1775
- || ' of that on battery, in Low Power Mode or with the thermal state at serious or critical' else '' end
1776
- || ' (' || case f.o when 1 then 'memory ' || p.mem || ', disk ' || p.disk
1777
- when 2 then 'CPU ' || p.cpu || ', disk ' || p.disk else 'CPU ' || p.cpu || ', memory ' || p.mem end || ').'
1778
- when nt.n > 0 and 100 * nt.n >= $HOST_VERDICT_PCT * nt.total then
1779
- 'the network was the limit: ' || printf('%.1f%%', 100.0 * nt.n / nt.total) || ' of the ' || nt.total
1780
- || case when nt.total = 1 then ' wait on the model was' else ' waits on the model were' end
1781
- || ' slow (over twice the median of ' || nt.median || ') while CPU, memory and disk were below their limit,'
1782
- || ' and each was at its limit for under $HOST_VERDICT_PCT% of the agents'' ' || $took
1783
- || ' on the host (CPU ' || p.cpu || ', memory ' || p.mem || ', disk ' || p.disk || ').'
1784
- else
1785
- 'no upgrade is needed: CPU, memory and disk were each at their limit for under $HOST_VERDICT_PCT% of the agents'' '
1786
- || $took || ' on the host (CPU ' || p.cpu || ', memory ' || p.mem || ', disk ' || p.disk || ').'
1787
- end
1788
- from total t left join named f on 1 left join pcts p on 1 left join net nt on 1)
1789
- select line from lines order by k;
1790
- EOF
1791
- }
1792
-
1793
1463
  cmd_host() {
1794
1464
  case ${1:-} in
1795
1465
  '') [ "$#" -le 1 ] || die "$HOST_USAGE"; host_show ;;
package/cli/lib/linear.sh CHANGED
@@ -233,13 +233,27 @@ OPEN_TYPES='["triage","backlog","unstarted","started"]'
233
233
  # deciding that Linear will never say it has no more.
234
234
  LINEAR_PAGE=100
235
235
  LINEAR_PAGES=50
236
+ # For `task ls --json`: how many cards one question about blockers asks
237
+ # about, and how many of each card's relations it reads. Linear caps what one
238
+ # question may cost, and a list inside a list counts once for each card it is
239
+ # asked of, however few it holds (SLICE_RELATIONS), so both are kept small. A
240
+ # card with more relations than are read may have blockers that were not
241
+ # read, which the list says of it.
242
+ LIST_BLOCKED=50
243
+ LIST_RELATIONS=20
236
244
 
237
245
  # The teams Linear knows of those asked for, their open statuses, and one page
238
246
  # of their open cards, with when each was last changed. Linear pages through
239
247
  # the cards in the order it is asked for, each page starting where the last
240
248
  # ended. That order is when each card was made, which nothing changes: in the
241
249
  # order they were last changed, a card edited while the pages are fetched
242
- # would move onto a page already fetched, and never be listed.
250
+ # would move onto a page already fetched, and never be listed. Each card
251
+ # comes with Linear's own id for it, its parent, and the first of the
252
+ # relations that name it as the related card. That one tells whether any
253
+ # card is related to it at all, and so whether one may block it: the
254
+ # blockers themselves are asked for afterwards, of those cards alone
255
+ # (LIST_BLOCKERS_QUERY), since reading them here would cost every card on the
256
+ # page a list of them.
243
257
  LIST_QUERY='query($teams: [String!], $types: [String!], $first: Int, $after: String) {
244
258
  teams(filter: {key: {in: $teams}}) { nodes { key } }
245
259
  workflowStates(first: 250, filter: {team: {key: {in: $teams}}, type: {in: $types}}) {
@@ -247,15 +261,58 @@ LIST_QUERY='query($teams: [String!], $types: [String!], $first: Int, $after: Str
247
261
  }
248
262
  issues(first: $first, after: $after, orderBy: createdAt,
249
263
  filter: {team: {key: {in: $teams}}, state: {type: {in: $types}}}) {
250
- nodes { identifier title url updatedAt state { name type position } }
264
+ nodes { id identifier title url updatedAt state { name type position }
265
+ parent { id identifier title }
266
+ inverseRelations(first: 1) { nodes { id } } }
251
267
  pageInfo { hasNextPage endCursor }
252
268
  }
253
269
  }'
254
270
 
255
- # Turn the pages Linear answered with (one line of JSON each, on stdin) into
256
- # the list: every open status, in Linear's order, with its cards. Teams often
257
- # share a status name; a status of one name and kind is one group, whichever
258
- # teams have it. $space, $teams and $types are given by the caller.
271
+ # One page of the sub-issues of some cards, the parents the open cards name,
272
+ # by Linear's own ids for them: every sub-issue, whatever its status and its
273
+ # team, with when it was made, the kind of status it is in and which of the
274
+ # cards it is a sub-issue of. All the parents are asked about in one
275
+ # question, which is paged through as the list is, in the order the
276
+ # sub-issues were made, so that no parent's count stops short.
277
+ LIST_SUBS_QUERY='query($parents: [ID!], $first: Int, $after: String) {
278
+ issues(first: $first, after: $after, orderBy: createdAt, filter: {parent: {id: {in: $parents}}}) {
279
+ nodes { identifier createdAt state { type } parent { id } }
280
+ pageInfo { hasNextPage endCursor }
281
+ }
282
+ }'
283
+
284
+ # The relations of some cards, by Linear's own ids for them, that name each
285
+ # as the related card, as CARD_BLOCKERS_READ reads them for one card, with
286
+ # the other card's title too. Those of the kind "blocks" name a card that
287
+ # blocks it. Whether a card has more of them than were read comes with them.
288
+ LIST_BLOCKERS_QUERY='query($ids: [ID!], $first: Int) {
289
+ issues(first: $first, filter: {id: {in: $ids}}) {
290
+ nodes { id
291
+ inverseRelations(first: '$LIST_RELATIONS') { nodes { type issue { identifier title state { name type } } } pageInfo { hasNextPage } } }
292
+ }
293
+ }'
294
+
295
+ # From the pages of the list (as for LIST_SHAPE, on stdin), what `task ls
296
+ # --json` asks Linear next, by Linear's own ids: parents, the cards whose
297
+ # sub-issues to read, which are the parents the cards name; and ids, the
298
+ # cards whose blockers to read, which are the cards that some card is related
299
+ # to and the parents of the cards in a not-started status, since a card that
300
+ # blocks its parent holds such a card too. Each id is there once.
301
+ LIST_ASK='
302
+ [.[].list.issues.nodes[]?] as $cards
303
+ | {parents: ([$cards[] | .parent.id? | strings] | unique),
304
+ ids: ([$cards[]
305
+ | (select((.inverseRelations.nodes? // []) | length > 0) | .id?),
306
+ (select(.state.type? == "unstarted") | .parent.id?)
307
+ | strings] | unique)}'
308
+
309
+ # Turn what Linear answered (on stdin, a line of JSON for each answer, under
310
+ # a name that says which question it answers: list for a page of the list,
311
+ # subs for a page of sub-issues and blockers for an answer about blockers)
312
+ # into the list: every open status, in Linear's order, with its cards. Teams
313
+ # often share a status name; a status of one name and kind is one group,
314
+ # whichever teams have it. $space, $teams, $types and $detail are given by
315
+ # the caller.
259
316
  # - Under each status the card changed last comes first. Cards changed at
260
317
  # the same moment keep the order Linear gave them in.
261
318
  # - Should a card come on two pages, the first copy is kept.
@@ -263,12 +320,76 @@ LIST_QUERY='query($teams: [String!], $types: [String!], $first: Int, $after: Str
263
320
  # that it did not, such as one made while the pages were fetched, so that
264
321
  # no card is dropped for want of a group.
265
322
  # - A closed status is never listed, should Linear send one.
323
+ # A card is its id, title and url. When $detail is true, it also says where
324
+ # it stands, from the other two questions' answers:
325
+ # - parent is the card it is a sub-issue of, with how many sub-issues that
326
+ # card has and how many of them are done, which is in a completed status.
327
+ # Every sub-issue counts, whatever its status. place is where the card
328
+ # comes among them, from 1, in the order they were made, the order
329
+ # READ_SHAPE gives subIssues in; it is null should the card not be among
330
+ # them, as when its parent changed between the questions. Both are null
331
+ # for a card with no parent.
332
+ # - blockedBy is the cards that block it, done or not, as READ_SHAPE gives
333
+ # them, and none for a card no card is related to.
334
+ # - held is whether `task start` would hold it, by the test card_branch
335
+ # applies (task.sh): it is in a not-started status, and a card that
336
+ # blocks it or its parent is not done. waitsOn is those cards, its own
337
+ # blockers and then its parent's, each once, and none when it is not held.
338
+ # - blockersCut is true when blockers may be missing from that: the card
339
+ # has more relations than were read, or its parent has, when the parent's
340
+ # can hold it, or Linear's answer left one of the two out.
341
+ # A sub-issue or a blocker that is not in the form Linear gives it in did not
342
+ # come from Linear, so nothing is listed. The list's own pages are read as
343
+ # they always were: a card with no parent or relations in the answer has
344
+ # neither.
266
345
  LIST_SHAPE='
346
+ def text: if type == "string" then . else error("unreadable") end;
347
+ def nodes: if (.issues.nodes | type) == "array" then .issues.nodes[] else error("unreadable") end;
348
+ def status: if type == "object" then {name: (.name | text), type: (.type | text)} else error("unreadable") end;
267
349
  ($types | to_entries | map({key: .value, value: .key}) | from_entries) as $rank
268
- | .[0] as $first
269
- | ([.[].issues.nodes[]] | to_entries | unique_by(.value.identifier)
350
+ | [.[] | .list | values] as $pages
351
+ | $pages[0] as $first
352
+ | ([$pages[].issues.nodes[]] | to_entries | unique_by(.value.identifier)
270
353
  | sort_by([.value.updatedAt, -.key]) | reverse | map(.value)) as $cards
271
- | {
354
+ | ([.[] | .subs | values | nodes
355
+ | {id: (.identifier | text), at: (.createdAt | text), done: ((.state.type | text) == "completed"),
356
+ of: (.parent.id | text)}]
357
+ | to_entries | unique_by(.value.id) | sort_by([.value.at, .key]) | map(.value)
358
+ | group_by(.of) | map({key: .[0].of, value: .}) | from_entries) as $subs
359
+ | ([.[] | .blockers | values | nodes
360
+ | {key: (.id | text),
361
+ value: (.inverseRelations
362
+ | if type == "object" and (.nodes | type) == "array" and (.pageInfo.hasNextPage | type) == "boolean"
363
+ then {cut: .pageInfo.hasNextPage,
364
+ by: [.nodes[] | select((.type | text) == "blocks") | .issue
365
+ | if type == "object"
366
+ then {id: (.identifier | text), title: (.title | text), status: (.state | status)}
367
+ else error("unreadable") end]}
368
+ else error("unreadable") end)}]
369
+ | from_entries) as $read
370
+ | def none: {by: [], cut: false};
371
+ def read($id): if ($id | type) == "string" and ($read | has($id)) then $read[$id] else {by: [], cut: true} end;
372
+ def detail:
373
+ . as $card
374
+ | (if .parent == null then null
375
+ elif (.parent | type) == "object"
376
+ then .parent | {key: (.id | text), id: (.identifier | text), title: (.title | text)}
377
+ else error("unreadable") end) as $parent
378
+ | (if $parent == null then [] else $subs[$parent.key] // [] end) as $among
379
+ | (if ((.inverseRelations.nodes? // []) | length) > 0 then read(.id) else none end) as $own
380
+ | (if $parent != null and .state.type == "unstarted" then read($parent.key) else none end) as $above
381
+ | (reduce ($own.by[], $above.by[] | select(.status.type != "completed")) as $by ([];
382
+ if any(.[]; .id == $by.id) then . else . + [$by] end)) as $open
383
+ | (.state.type == "unstarted" and ($open | length) > 0) as $held
384
+ | {parent: (if $parent == null then null
385
+ else {id: $parent.id, title: $parent.title, subIssues: ($among | length),
386
+ done: ([$among[] | select(.done)] | length)} end),
387
+ place: (($among | map(.id) | index($card.identifier)) as $at | if $at == null then null else $at + 1 end),
388
+ blockedBy: $own.by,
389
+ blockersCut: ($own.cut or $above.cut),
390
+ held: $held,
391
+ waitsOn: (if $held then $open else [] end)};
392
+ {
272
393
  missing: ($teams - [$first.teams.nodes[].key]),
273
394
  space: $space,
274
395
  teams: $teams,
@@ -286,45 +407,90 @@ LIST_SHAPE='
286
407
  cards: [
287
408
  $cards[]
288
409
  | select(.state.name == $status.name and .state.type == $status.type)
289
- | {id: .identifier, title: .title, url: .url}
410
+ | {id: .identifier, title: .title, url: .url} + (if $detail then detail else {} end)
290
411
  ]
291
412
  }
292
413
  ]
293
414
  }'
294
415
 
295
- # Print the open cards of some Linear teams as one line of JSON, grouped by
296
- # status:
297
- # {"space":"demo","teams":["ABC"],"statuses":[
298
- # {"name":"Backlog","type":"backlog","cards":[{"id":"ABC-1","title":"…","url":"…"}]}]}
299
- # Every open status of the teams is there, with no cards when it has none.
300
- # linear_open_cards <space> <team key>...
301
- linear_open_cards() {
302
- local space=$1 key teams vars data pages='' after='' more asked=0 list missing
303
- shift
304
- linear_tools
305
- key=$(linear_saved_key) || exit 1
306
- teams=$(printf '%s\n' "$@" | jq -Rcn '[inputs]')
416
+ # Ask Linear a question that pages through cards, up to the last page, and
417
+ # print each page's answer as a line of JSON under a name, like
418
+ # {"list": <the answer>}, for LIST_SHAPE to tell the questions' answers
419
+ # apart by. The query takes $first and $after with the variables given, and
420
+ # answers with issues { nodes pageInfo { hasNextPage endCursor } }. When the
421
+ # pages cannot be read to the last one, it stops, as die does: what came so
422
+ # far would pass a part for the whole.
423
+ # linear_pages <key> <name> <what the pages hold, for a message> <query> <its other variables, as JSON>
424
+ linear_pages() {
425
+ local key=$1 name=$2 what=$3 query=$4 base=$5 vars data after='' more asked=0
307
426
  while :; do
308
427
  asked=$((asked + 1))
309
428
  [ "$asked" -le "$LINEAR_PAGES" ] ||
310
- die "Linear still had more cards after $LINEAR_PAGES pages of $LINEAR_PAGE, which is more than ocnus lists."
311
- vars=$(jq -cn --argjson teams "$teams" --argjson types "$OPEN_TYPES" --argjson first "$LINEAR_PAGE" \
312
- --arg after "$after" \
313
- '{teams: $teams, types: $types, first: $first, after: (if $after == "" then null else $after end)}')
314
- data=$(linear_ask "$key" "$LIST_QUERY" "$vars") || exit 1
315
- pages+=$data$'\n'
429
+ die "Linear still had more $what after $LINEAR_PAGES pages of $LINEAR_PAGE, which is more than ocnus lists."
430
+ vars=$(jq -cn --argjson base "$base" --argjson first "$LINEAR_PAGE" --arg after "$after" \
431
+ '$base + {first: $first, after: (if $after == "" then null else $after end)}') ||
432
+ die "could not put a question to Linear together."
433
+ data=$(linear_ask "$key" "$query" "$vars") || exit 1
434
+ printf '{"%s":%s}\n' "$name" "$data"
316
435
  more=$(printf '%s' "$data" | jq -r '.issues.pageInfo.hasNextPage == true' 2>/dev/null) ||
317
436
  die "Linear's answer was not one ocnus can read."
318
437
  [ "$more" = true ] || break
319
438
  # Listing what came so far would pass a part of the list for the whole.
320
439
  after=$(printf '%s' "$data" | jq -r '.issues.pageInfo.endCursor | strings' 2>/dev/null) || after=
321
440
  [ -n "$after" ] ||
322
- die "Linear said it had more cards but not where the next ones start, so the list would be cut short."
441
+ die "Linear said it had more $what but not where the next ones start, so the list would be cut short."
323
442
  done
324
- # The pages go to jq on stdin, not as an argument: a long list of cards is
325
- # more than a command's arguments may hold.
326
- list=$(printf '%s' "$pages" |
327
- jq -cs --arg space "$space" --argjson teams "$teams" --argjson types "$OPEN_TYPES" "$LIST_SHAPE" 2>/dev/null) ||
443
+ }
444
+
445
+ # Print the open cards of some Linear teams as one line of JSON, grouped by
446
+ # status:
447
+ # {"space":"demo","teams":["ABC"],"statuses":[
448
+ # {"name":"Backlog","type":"backlog","cards":[{"id":"ABC-1","title":"…","url":"…"}]}]}
449
+ # Every open status of the teams is there, with no cards when it has none.
450
+ # With the detail, which `task ls --json` asks for, each card also says
451
+ # where it stands (LIST_SHAPE):
452
+ # {"id":"ABC-123","title":"…","url":"…",
453
+ # "parent":{"id":"ABC-100","title":"…","subIssues":3,"done":1},"place":2,
454
+ # "blockedBy":[{"id":"ABC-122","title":"…","status":{"name":"In Progress","type":"started"}}],
455
+ # "blockersCut":false,"held":true,
456
+ # "waitsOn":[{"id":"ABC-122","title":"…","status":{"name":"In Progress","type":"started"}}]}
457
+ # That takes up to two more questions, each asked only when the list holds
458
+ # something to ask about: the sub-issues of the parents the cards name, all
459
+ # in one question, paged to its end, and then the blockers of the cards
460
+ # that some card is related to and of the parents of not-started cards,
461
+ # LIST_BLOCKED cards at a time. When one of them fails, or cannot be read to
462
+ # its end, nothing is printed, as for the list itself.
463
+ # linear_open_cards <space> <true, for the detail, or false> <team key>...
464
+ linear_open_cards() {
465
+ local space=$1 detail=$2 key teams pages ask count at=0 vars data list missing
466
+ shift 2
467
+ linear_tools
468
+ key=$(linear_saved_key) || exit 1
469
+ teams=$(printf '%s\n' "$@" | jq -Rcn '[inputs]')
470
+ pages=$(linear_pages "$key" list cards "$LIST_QUERY" \
471
+ "$(jq -cn --argjson teams "$teams" --argjson types "$OPEN_TYPES" '{teams: $teams, types: $types}')") || exit 1
472
+ if [ "$detail" = true ]; then
473
+ # The pages go to jq on stdin, here and below, not as an argument: a
474
+ # long list of cards is more than a command's arguments may hold.
475
+ ask=$(printf '%s\n' "$pages" | jq -cs "$LIST_ASK" 2>/dev/null) ||
476
+ die "Linear's answer was not one ocnus can read."
477
+ if [ "$(printf '%s' "$ask" | jq -r '.parents | length')" != 0 ]; then
478
+ data=$(linear_pages "$key" subs sub-issues "$LIST_SUBS_QUERY" "$(printf '%s' "$ask" | jq -c '{parents}')") || exit 1
479
+ pages+=$'\n'$data
480
+ fi
481
+ count=$(printf '%s' "$ask" | jq -r '.ids | length')
482
+ while [ "$at" -lt "$count" ]; do
483
+ # As many cards are asked for as are named, and no more.
484
+ vars=$(printf '%s' "$ask" |
485
+ jq -c --argjson at "$at" --argjson n "$LIST_BLOCKED" '.ids[$at:($at + $n)] | {ids: ., first: length}')
486
+ data=$(linear_ask "$key" "$LIST_BLOCKERS_QUERY" "$vars") || exit 1
487
+ pages+=$'\n'"{\"blockers\":$data}"
488
+ at=$((at + LIST_BLOCKED))
489
+ done
490
+ fi
491
+ list=$(printf '%s\n' "$pages" |
492
+ jq -cs --arg space "$space" --argjson teams "$teams" --argjson types "$OPEN_TYPES" --argjson detail "$detail" \
493
+ "$LIST_SHAPE" 2>/dev/null) ||
328
494
  die "Linear's answer was not one ocnus can read."
329
495
  missing=$(printf '%s' "$list" | jq -r '.missing | join(", ")')
330
496
  [ -z "$missing" ] ||
package/cli/lib/task.sh CHANGED
@@ -849,13 +849,17 @@ task_build() {
849
849
 
850
850
  # List the open cards of a space's Linear teams, grouped by status: the
851
851
  # cards `task new` can be given. Linear itself is asked in linear.sh. --json
852
- # prints the list as one line for programs; the cards mod reads it.
852
+ # prints the list as one line for programs; the cards mod reads it. Only
853
+ # --json asks for the detail, where each card stands: its parent and its
854
+ # place among the parent's sub-issues, the cards that block it, and whether
855
+ # it is held. That costs up to two more questions to Linear, and the plain
856
+ # list shows none of it, so the plain list asks for the list alone.
853
857
  task_ls() {
854
- local name=${1:-} json=0 dir team keys list
858
+ local name=${1:-} json=0 detail=false dir team keys list
855
859
  local -a teams=()
856
860
  dir=$(space_dir "$name")
857
861
  case ${2:-} in
858
- --json) json=1 ;;
862
+ --json) json=1 detail=true ;;
859
863
  '') ;;
860
864
  *) die "unknown option for task ls: $2" ;;
861
865
  esac
@@ -866,7 +870,7 @@ task_ls() {
866
870
  while IFS= read -r team; do [ -z "$team" ] || teams+=("$team"); done <<< "$keys"
867
871
  [ "${#teams[@]}" -gt 0 ] ||
868
872
  die "space '$name' has no Linear team, so there are no cards to list. Set it with: ocnus space team $name <team key>, like: ocnus space team $name ABC"
869
- list=$(linear_open_cards "$name" "${teams[@]}") || exit 1
873
+ list=$(linear_open_cards "$name" "$detail" "${teams[@]}") || exit 1
870
874
  if [ "$json" = 1 ]; then
871
875
  printf '%s\n' "$list"
872
876
  return
package/cli/lib/tests.sh CHANGED
@@ -107,9 +107,8 @@ tests_set() {
107
107
  # readings is there too. The job's row goes in test_runs as it starts, with
108
108
  # its card, repo, start and the job's pid, and the fingerprint of its
109
109
  # command, cmd: the first 15 hex digits of the SHA-256 of its arguments, each
110
- # ended by a NUL, as a number. It is the same for the same command, so that
111
- # `host report` can set runs of the same command in the same repo against
112
- # each other, and the command's text cannot be read back from it. It is all
110
+ # ended by a NUL, as a number. It is the same for the same command,
111
+ # and the command's text cannot be read back from it. It is all
113
112
  # that is kept of the command line. While the job runs, the sampler adds up
114
113
  # the memory of its processes every second, and writes the most it saw to
115
114
  # the row. When the job ends, the row gets its end and the figures, and what
package/cli/ocnus CHANGED
@@ -92,15 +92,11 @@ Usage:
92
92
  ocnus host say whether how hard this machine works is recorded
93
93
  ocnus host on record it every 10 seconds while an agent is open
94
94
  ocnus host off stop recording, and delete every reading
95
- ocnus host report [<period>] how often CPU, memory and disk were at their limit, how often
96
- CPU or memory was with each number of agents working, and
97
- how much slower test runs were then, the work going in the
98
- 5 longest stretches when it was, the steps, phases and test
99
- runs that used the most CPU and memory, where the steps'
100
- time went, whether the network may be the cause of slow
101
- waits on the model, and a verdict on what to upgrade first:
102
- <n>d or <n>h back from now (7d when none is given), a day
103
- YYYY-MM-DD, or <day>..<day>
95
+ ocnus host report [<period>] how often CPU, memory and disk were at their limit, the
96
+ steps, phases and test runs that used the most CPU and
97
+ memory, and where the steps' time went: <n>d or <n>h back
98
+ from now (7d when none is given), a day YYYY-MM-DD, or
99
+ <day>..<day>
104
100
  ocnus help
105
101
 
106
102
  A space groups repos that belong together, with a SPACE.md saying what
@@ -112,7 +108,15 @@ by the trust question. It needs jq; without it Claude Code asks once.
112
108
  A task is one piece of work in a space, usually a Linear card.
113
109
  `task ls` lists the cards `task new` can be given: every card of the
114
110
  space's Linear teams that is not done, cancelled or a duplicate, under its
115
- status. It needs two things set once. `linear key` asks for a Linear API key
111
+ status. With --json, for programs, each card also says where it stands: its
112
+ parent card, with how many sub-issues the parent has and how many of them
113
+ are done, its place among them in the order they were made, the cards that
114
+ block it, and whether it is held, with the cards it waits on. A card is held
115
+ when it is in a not-started status and a card that blocks it, or its parent,
116
+ is not done, which is when `task start` holds it. That asks Linear up to two
117
+ more questions, for the sub-issues and for the blockers; the plain list asks
118
+ for neither.
119
+ `task ls` needs two things set once. `linear key` asks for a Linear API key
116
120
  and saves it (make one in Linear, under Settings, Account, Security & access,
117
121
  Personal API keys; Read permission is enough to list cards and for
118
122
  `linear read`, which the card skills read a card with, and the card skills'
@@ -288,20 +292,9 @@ at their limit: CPU at least 90% busy across all cores, memory pressure at
288
292
  warning or critical, and under 10% of the home folder's disk free. Time with
289
293
  no reading, such as when no agent was open, is shown as missing, never as
290
294
  idle. It also says how much of the CPU recording used, watching the test
291
- runs included. For each number of agents working at once, it says how long
292
- that many were working and how much of that time CPU or memory was at its
293
- limit, and names the fewest working at which that was at least a quarter of
294
- the time, as the number from which the host was the limit. For each number
295
- from 2 up, it says how much slower test runs were than with one working,
296
- setting only runs of the same command in the same repo against each other,
297
- once a command has run at least 3 times with each; until then, it says it
298
- cannot tell yet. It names the 5 longest stretches when CPU or memory was at
299
- its limit, each with when it started, how long it lasted, which was at its
300
- limit, and every card's step and every test run going then, with its share
301
- of the CPU and the most memory it held, and for each card how much of the
302
- stretch its agent was working. Then it lists the 10 steps and the 10
303
- phases, each one card's own, that used the most CPU time, and that held the
304
- most memory at once, then the 10 test runs that did.
295
+ runs included. Then it lists the 10 steps and the 10 phases, each one
296
+ card's own, that used the most CPU time, and that held the most memory at
297
+ once, then the 10 test runs that did.
305
298
 
306
299
  While the host is recorded, `task new` and `task build` also start claude
307
300
  with hooks that mark when its agent starts and stops, is given a prompt,
@@ -315,22 +308,7 @@ same for the 10 steps open longest, and how many steps had no split, as an
315
308
  agent started in another harness or while recording was off has none.
316
309
 
317
310
  Each wait on the model is kept too, as its start and end alone, for 90
318
- days. A wait is slow when it took over twice the median of every wait
319
- kept. When waits in the period were slow while CPU, memory and disk were
320
- all below their limit, `host report` says the network may be the cause,
321
- with how many were slow and the median.
322
-
323
- Last, `host report` gives its verdict, one line with its numbers. With
324
- fewer than 10 steps with their time split in the period, or under an hour
325
- of the agents' time on the host, the time their tools ran, there is too
326
- little data yet. Otherwise, of CPU, memory and disk, the one at its limit
327
- for the most of the agents' time on the host, when that is at least 10% of
328
- it, is the one to upgrade first, unless over half of its time at its limit
329
- was on battery, in Low Power Mode or with the thermal state at serious or
330
- critical: then the power state was the limit. With none at 10%, the network
331
- was the limit when at least 10% of the period's waits on the model were
332
- slow while CPU, memory and disk were below their limit, and otherwise no
333
- upgrade is needed.
311
+ days.
334
312
 
335
313
  `tests run <command> [<arg>...]` runs a repo's test command, whole suite or
336
314
  part, as in `ocnus tests run npm test`: its output goes straight
package/herdr/README.md CHANGED
@@ -325,8 +325,28 @@ ocnus task ls <space> [--json]
325
325
  `HTTPS_PROXY`, is still used.
326
326
  - **`--json` prints the list as one line for programs**: the space, under the
327
327
  key `space`, its teams, and each status with its `name`, its `type`
328
- (`triage`, `backlog`, `unstarted` or `started`) and its `cards`, each with an
329
- `id`, a `title` and a `url`. When it fails it prints nothing on stdout.
328
+ (`triage`, `backlog`, `unstarted` or `started`) and its `cards`. Each card
329
+ has an `id`, a `title` and a `url`, and then where it stands, which the
330
+ plain list does not show:
331
+
332
+ | Key | What it is |
333
+ |---|---|
334
+ | `parent` | The card it is a sub-issue of, as `{"id", "title", "subIssues", "done"}`, or `null` for a card with none. The parent is named whatever its status and its team: one that is done or canceled, or in a team the space does not list, is not in the list itself, and is still named here. `subIssues` is how many sub-issues the parent has, and `done` is how many of them are done. Every sub-issue counts towards `subIssues`, whatever its status and its team, a canceled one too. Only one in a completed status counts towards `done`, which is where a card is once its pull requests have merged. |
335
+ | `place` | Where the card comes among its parent's sub-issues, from 1, in the order they were made. That is the order `ocnus linear read` lists a card's sub-issues in, so the place agrees with the `slice N of M` a brief gives. It is `null` for a card with no parent, and for one that Linear's answer about the sub-issues no longer has, as when its parent changed while the list was read. With the parent's counts, a card can be shown as `place`/`subIssues`, and its parent as `done`/`subIssues` merged. |
336
+ | `blockedBy` | The cards that block it, each with its `id`, its `title` and its `status`, which is the `name` and the `type` of the status it is in: `[{"id", "title", "status": {"name", "type"}}]`, the form `linear read --json` gives them in. A blocker is listed done or not, and whatever team it is in. A card that is only related to it is not a blocker. A card nothing blocks has an empty list. |
337
+ | `held` | `true` when the card is in a not-started status, such as Todo, and a card that blocks it, or that blocks its parent, is not done. That is when `task start` holds a card (see [Starting the work](#starting-the-work)): a blocker that is canceled holds it, and one that is done does not. A card in any other status is never held, whatever blocks it. |
338
+ | `waitsOn` | For a card that is held, the blockers that are not done, its own and then its parent's, each once, in the form of `blockedBy`. Empty for a card that is not held. |
339
+ | `blockersCut` | `true` when the card may have blockers that were not read, so that `blockedBy` and `waitsOn` may not be all of them and `held` goes by the ones that were read. That is so when Linear has more than 20 relations from other cards to the card, or to the parent of a card in a not-started status, or when Linear's answer left the card or that parent out. |
340
+
341
+ To say this, `--json` asks Linear up to two more questions after the
342
+ list, each only when the list has something to ask about. The first is for
343
+ the sub-issues of every parent the cards name, all in one question. It is
344
+ read page by page to the last sub-issue, so a place or a count never stops
345
+ short. The second is for the blockers of the cards that another card is
346
+ related to, and of the parents of the cards in a not-started status, 50
347
+ cards at a time. When either fails, or cannot be read to its end, the
348
+ command fails rather than print a list without it. When it fails it prints
349
+ nothing on stdout.
330
350
  - **Two teams' cards share a group when their statuses have the same name and
331
351
  the same type**, such as a Backlog of type `backlog` in each. A status only
332
352
  one team has is a group of its own, and so is one whose name another team
@@ -1635,7 +1655,7 @@ turn it on, and works on macOS only.
1635
1655
  ocnus host # whether recording is on, and what it has
1636
1656
  ocnus host on # turn recording on
1637
1657
  ocnus host off # turn it off, and delete every reading
1638
- ocnus host report [<period>] # how often CPU, memory and disk were at their limit, with how many agents working and how much slower test runs were, what was going then, what used the most, where the steps' time went, whether the network may be the cause, and what to upgrade first
1658
+ ocnus host report [<period>] # how often CPU, memory and disk were at their limit, what used the most, and where the steps' time went
1639
1659
  ocnus tests run <command> # run a test command, and record the test run
1640
1660
  ```
1641
1661
 
@@ -1864,8 +1884,7 @@ ocnus tests run <command> # run a test command, and record the test run
1864
1884
  - **The fingerprint of its command.** Before the job starts,
1865
1885
  `/usr/bin/shasum -a 256` hashes the command's arguments, each ended by a
1866
1886
  NUL, and the first 15 hex digits of the hash, as a number, are the run's
1867
- `cmd`. The same arguments give the same number, so `host report` can set
1868
- runs of the same command in the same repo against each other, and the
1887
+ `cmd`. The same arguments give the same number, and the
1869
1888
  command's text cannot be read back from it. It is all that is kept of
1870
1889
  the command line. `shasum` runs as part of watching the run, so its CPU
1871
1890
  is in the run's `watch_secs`; without it, `cmd` is empty and the run is
@@ -1979,68 +1998,6 @@ figures.
1979
1998
  time no agent was open, as well as when the machine slept or recording was
1980
1999
  off. A period with no readings at all says so.
1981
2000
 
1982
- Then come the agents working at once, under `Agents working at once:`, to
1983
- tell how many agents to run at once:
1984
-
1985
- - **A line for each number of agents working** in the period, from none
1986
- up: how long that many were working, and how long and how much of that
1987
- time the CPU or the memory was at its limit. Each reading counts for the
1988
- part of it in the period, as above.
1989
- - **Readings from before the agents working were counted** hold no count.
1990
- They are left out of these lines, never counted as none working, and
1991
- their time is on a line of its own, `not counted`.
1992
- - **How much slower test runs were.** Under each number from 2 up comes
1993
- how much slower test runs were than with one agent working, as
1994
- `test runs 30% slower than with 1 working, from 3 runs of 1 command
1995
- against 3 with 1 working`, or as `faster` when they were faster:
1996
- - **A test run counts at one number of agents working**: the one that
1997
- covers most of its time, from when it started for as long as it took,
1998
- over the readings that counted them, and the larger number on a tie. A
1999
- run under 10 seconds, shorter than a reading, counts at the number of
2000
- the reading that holds most of it. Runs that started in the period
2001
- count, but a run cut short, one still going, one with no `cmd`, from
2002
- before the fingerprints were kept, and one that overlaps no reading
2003
- with a count of the agents working are left out.
2004
- - **A command is a repo and a `cmd`**, so only runs of the same command
2005
- in the same repo are set against each other. A command counts at a
2006
- number when it ran at least 3 times with that many working and 3 times
2007
- with one. Its ratio is the median time of its runs at that number over
2008
- the median of its runs at one, and the figure is the median of those
2009
- commands' ratios, with the runs and the commands it rests on, and the
2010
- runs with one working. Medians keep one odd run, such as one that
2011
- failed early, from moving the figure.
2012
- - **With no such command**, it says it cannot tell yet for that number.
2013
- - **A store from before the fingerprints** has no `cmd`, and the report
2014
- leaves these lines out. It never alters the store: the next test run or
2015
- recorder start adds the column.
2016
- - **The last line names the number from which the host was the limit**:
2017
- the fewest working at which the CPU or memory was at its limit for at
2018
- least a quarter of the time. With no such number, it says the host was
2019
- not the limit at any number of working agents in the period, and with no
2020
- reading that counted them, it says so.
2021
-
2022
- Then come the longest stretches when the CPU or the memory was at its limit:
2023
-
2024
- - **A stretch** is readings in a row, each starting where the one before
2025
- ended, each with the CPU or memory at its limit. A reading under the
2026
- limit, or time with no reading, ends it. Each reading counts for the part
2027
- of it in the period.
2028
- - **The 5 longest** in the period are listed, longest first, or fewer when
2029
- there are fewer. Each says when it started, how long it lasted, and
2030
- whether the CPU, the memory or both were at their limit in it.
2031
- - **Under each, the work going then**: every card, with its step, or its
2032
- phase when its card was in none of that phase's steps, then every test
2033
- run, by its card, its repo and when it started. Each has its share of all
2034
- cores over the stretch, each reading's share counted for that reading's
2035
- seconds, and the most memory it held in one reading. Each card also says
2036
- for how much of the stretch its agent was working, as `working 50% of
2037
- it`, or `working not read` for shares from before that was read. A share
2038
- that names no card is left out, and a stretch with no card or test run
2039
- going says so.
2040
- - **With none**, the report says the host was never at its limit for CPU or
2041
- memory in the period. Disk is not among the stretches: under 10% free is
2042
- not caused by a moment's work.
2043
-
2044
2001
  Then come the steps, the phases and the test runs that used the most:
2045
2002
 
2046
2003
  - **The 10 steps and the 10 phases that used the most CPU time** in the
@@ -2074,66 +2031,6 @@ Then comes where the steps' time went:
2074
2031
  With no split in the period, or a store made before the splits, the
2075
2032
  report says no step was split.
2076
2033
 
2077
- Then, after a blank line, it says whether the network may be the cause, as
2078
- a slow wait on the model can be the network rather than the host:
2079
-
2080
- - **A slow wait** took over twice the median of every wait in
2081
- `model_waits`, so 90 days at most. The median is the wait halfway in order
2082
- of length, the later of the two for an even count. A wait of exactly twice
2083
- it is not slow.
2084
- - **It counts for the network** when there is a reading over it, in whole or
2085
- in part, and every reading over it had the CPU, memory and disk below
2086
- their limit, as above. A slow wait with no reading over it does not count.
2087
- - **The period's waits** are those that ended in it, whenever they started.
2088
- - **With any that count**, it says how many of the period's waits on the
2089
- model were slow while the host was below its limit, and the median, to a
2090
- tenth of a second under a minute: `The network may be the cause: 14 of 412
2091
- waits on the model were slow (over twice the median of 6.2s) while CPU,
2092
- memory and disk were below their limit.` With none, or a store made before
2093
- the waits on the model, it says nothing.
2094
- - **It cannot tell a slow network from a slow model**: the line says only
2095
- that the network may be the cause.
2096
-
2097
- Last comes the verdict on the host, one line after a blank one, with the
2098
- numbers behind it, so that money goes on what slows the agents' work on the
2099
- host. It is the first of these that holds:
2100
-
2101
- - **Too little data yet**, with fewer than 10 steps with their time split in
2102
- the period, each one card's own, or under 1 hour of the agents' time on
2103
- the host. It says how many steps and how long, against the 10 and the
2104
- hour. With no split in the period, or a store made before the splits,
2105
- both are none.
2106
- - **The one to upgrade first**: of CPU, memory and disk, the one at its
2107
- limit, as above, for the most of the agents' time on the host, when that
2108
- is at least 10% of it; the CPU before memory, and memory before the disk,
2109
- when two were at their limit as long. The line gives its share of the
2110
- agents' time on the host, that time, and the other two's shares:
2111
- `upgrade memory first: it was at its limit for 23.0% of the agents' 6h
2112
- 10m on the host (CPU 8.0%, disk 0.0%)`.
2113
- - **The power state was the limit**, in place of an upgrade, when over half
2114
- of that one's time at its limit was on battery, in Low Power Mode, or with
2115
- the thermal state at serious or critical: plugging in, turning Low Power
2116
- Mode off or letting the machine cool costs nothing. The line gives how
2117
- much of that time it was, too. At exactly half it is an upgrade. A
2118
- reading from before the power state was read counts as on power.
2119
- - **The network was the limit**, when none of the three was at its limit
2120
- for 10% of the agents' time on the host, and the slow waits that count for
2121
- the network, as above, are at least 10% of the period's waits on the
2122
- model: `the network was the limit: 12.0% of the 100 waits on the model
2123
- were slow (over twice the median of 6.2s) while CPU, memory and disk were
2124
- below their limit, and each was at its limit for under 10% of the agents'
2125
- 2h 46m on the host (CPU 0.0%, memory 4.0%, disk 0.0%)`. Then no host
2126
- upgrade is bought that would not have helped. A store made before the
2127
- waits on the model never has it.
2128
- - **No upgrade is needed**, otherwise, with the three shares.
2129
-
2130
- The agents' time on the host is the seconds their tools ran, from the
2131
- splits, an agent's second each: two agents on the host for a second are two
2132
- seconds of it. A reading counts for the verdict by the agents' time on the
2133
- host in it, each split counted for the part of its reading in the period,
2134
- so time at the limit while the agents waited on the model or on you, or
2135
- with no split, counts for none of it.
2136
-
2137
2034
  ```
2138
2035
  The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
2139
2036
  recorded 9h 41m of 7d 00h
@@ -2146,15 +2043,6 @@ The host from 2026-11-22 17:20 to 2026-11-29 17:20 (7d)
2146
2043
  By day:
2147
2044
  ...
2148
2045
 
2149
- Longest stretches with CPU or memory at its limit:
2150
- 2026-11-29 14:02:40 for 12m 30s, CPU at its limit
2151
- LAB-150 build step CPU 61.4%, memory 3412 MB
2152
- LAB-151 write-up phase CPU 4.2%, memory 1204 MB
2153
- LAB-150 ocnus test run 2026-11-29 14:02 CPU 52.8%, memory 1830 MB
2154
- 2026-11-28 10:41:10 for 4m 20s, CPU and memory at their limit
2155
- LAB-149 review step CPU 48.0%, memory 1890 MB
2156
- LAB-149 ocnus test run 2026-11-28 10:41 CPU 41.5%, memory 1795 MB
2157
-
2158
2046
  Steps that used the most CPU time:
2159
2047
  LAB-150 build step CPU time 1h 12m, ran 2h 40m
2160
2048
  LAB-149 review step CPU time 22m 05s, ran 51m 10s
@@ -2179,10 +2067,6 @@ Where the steps' time went:
2179
2067
  LAB-150 build step open 2h 40m: on the host 51m 20s, waiting on the model 1h 22m, the rest 26m 40s
2180
2068
  LAB-149 review step open 51m 10s: on the host 10m 40s, waiting on the model 27m 00s, the rest 13m 30s
2181
2069
  1 step had no split, as an agent's time is split only when it starts in Claude Code while recording is on
2182
-
2183
- The network may be the cause: 14 of 412 waits on the model were slow (over twice the median of 6.2s) while CPU, memory and disk were below their limit.
2184
-
2185
- Verdict: too little data yet: 2 steps had their time split, with 1h 02m of the agents' time on the host, and a verdict takes at least 10 steps and 1h 00m.
2186
2070
  ```
2187
2071
 
2188
2072
  - **In a worktree**, `./cli/ocnus host` and `./cli/ocnus host report`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@johngaynor/ocnus",
3
- "version": "2.0.1-next.20",
3
+ "version": "2.0.1-next.24",
4
4
  "description": "A software factory: agent skills and the Herdr setup to run them, installed with one command.",
5
5
  "license": "MIT",
6
6
  "bin": {