@feigi/fleet-ctl 3.23.36 → 3.23.37
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/package.json +1 -1
- package/scripts/main-checkout.mjs +1 -1
- package/scripts/member-write-guard.mjs +1 -1
- package/scripts/repo-root.mjs +1 -1
- package/skills/run-team/references/reaping.md +1 -1
- package/scripts/agent-test-dir-prose.test.mjs +0 -59
- package/scripts/agent-test.test.mjs +0 -1640
- package/scripts/ambient-git-vars-mjs-prose.test.mjs +0 -397
- package/scripts/ambient-git-vars-prose.test.mjs +0 -192
- package/scripts/ancestry-check-position-prose.test.mjs +0 -175
- package/scripts/apply-ruleset.test.mjs +0 -421
- package/scripts/arg-header-probes-prose.test.mjs +0 -394
- package/scripts/arg.test.mjs +0 -1354
- package/scripts/board-cli.test.mjs +0 -710
- package/scripts/board-identity.test.mjs +0 -429
- package/scripts/board-liveness-banner.test.mjs +0 -119
- package/scripts/board-prev-shape.test.mjs +0 -228
- package/scripts/board-tryparse-null.test.mjs +0 -119
- package/scripts/board.test.mjs +0 -3121
- package/scripts/brief-after-cut-prose.test.mjs +0 -53
- package/scripts/candidates-exit3-prose.test.mjs +0 -302
- package/scripts/candidates.test.mjs +0 -2312
- package/scripts/caveat-unification-prose.test.mjs +0 -98
- package/scripts/cell-readout.test.mjs +0 -615
- package/scripts/ci-comment-rot-prose.test.mjs +0 -2025
- package/scripts/ci-completes-premise-prose.test.mjs +0 -257
- package/scripts/ci-state-prose.test.mjs +0 -113
- package/scripts/ci-state.test.mjs +0 -1933
- package/scripts/ci-vacuous-green.test.mjs +0 -368
- package/scripts/citation-sweep-prose.test.mjs +0 -1712
- package/scripts/claim-lifecycle.test.mjs +0 -187
- package/scripts/claim-ticket.test.mjs +0 -1122
- package/scripts/closing-keyword-prose.test.mjs +0 -193
- package/scripts/cockpit-launch-idempotent-prose.test.mjs +0 -165
- package/scripts/cockpit-tick-nonblocking.test.mjs +0 -210
- package/scripts/compute-board.test.mjs +0 -1214
- package/scripts/compute-spend.test.mjs +0 -517
- package/scripts/consumer-technology-prose.test.mjs +0 -126
- package/scripts/cross-repo-citation-prose.test.mjs +0 -155
- package/scripts/cwd-isolation-pins.mjs +0 -83
- package/scripts/dedupe-guard-prose.test.mjs +0 -243
- package/scripts/delete-merged-branch.test.mjs +0 -576
- package/scripts/derive-testcmd.test.mjs +0 -595
- package/scripts/diff-stats.test.mjs +0 -404
- package/scripts/dispatch-block-golden-prose.test.mjs +0 -1130
- package/scripts/dispatch-block-pins-prose.test.mjs +0 -615
- package/scripts/dispositions-check.test.mjs +0 -936
- package/scripts/dispositions-gate-prose.test.mjs +0 -129
- package/scripts/drop-merged-label.test.mjs +0 -479
- package/scripts/exec-stub.mjs +0 -93
- package/scripts/exec-stub.test.mjs +0 -69
- package/scripts/expected-jobs-prose.test.mjs +0 -80
- package/scripts/fan-out-authorization-prose.test.mjs +0 -80
- package/scripts/filing-bar-seat-prose.test.mjs +0 -242
- package/scripts/filing-claim-bar-prose.test.mjs +0 -166
- package/scripts/finisher-died-prose.test.mjs +0 -31
- package/scripts/finisher-dispatch-premise-prose.test.mjs +0 -312
- package/scripts/finisher-halt-prose.test.mjs +0 -106
- package/scripts/finisher-name-prose.test.mjs +0 -134
- package/scripts/finisher-own-tree-prose.test.mjs +0 -299
- package/scripts/finisher-pin-race-prose.test.mjs +0 -339
- package/scripts/finisher-test-verdict-prose.test.mjs +0 -102
- package/scripts/fix-applier-correction-rules-prose.test.mjs +0 -202
- package/scripts/fix-applier-result-file-prose.test.mjs +0 -149
- package/scripts/fleet-bootstrap.test.mjs +0 -75
- package/scripts/fleet-heartbeat.test.mjs +0 -450
- package/scripts/fleet-provenance.test.mjs +0 -138
- package/scripts/fleet-run.test.mjs +0 -90
- package/scripts/fleet-state.test.mjs +0 -460
- package/scripts/fleet-tick-prose.test.mjs +0 -300
- package/scripts/fleet-tick.test.mjs +0 -2444
- package/scripts/force-with-lease-reason-prose.test.mjs +0 -184
- package/scripts/frontmatter-check.test.mjs +0 -436
- package/scripts/git-env.test.mjs +0 -149
- package/scripts/git-status-untracked-mode-sweep.test.mjs +0 -216
- package/scripts/gone-walk.test.mjs +0 -213
- package/scripts/gp-sep-invariant-prose.test.mjs +0 -188
- package/scripts/head-moved-after-label-prose.test.mjs +0 -233
- package/scripts/immutable-body-claim-prose.test.mjs +0 -204
- package/scripts/implementer-model-tier.test.mjs +0 -235
- package/scripts/inflight-citation-prose.test.mjs +0 -144
- package/scripts/inflight-exit2-prose.test.mjs +0 -81
- package/scripts/inflight-probe-guard-prose.test.mjs +0 -109
- package/scripts/inflight-scan-scope-prose.test.mjs +0 -57
- package/scripts/inflight.test.mjs +0 -2882
- package/scripts/injection-control-prose.test.mjs +0 -404
- package/scripts/install-root-audit.test.mjs +0 -464
- package/scripts/instrument-check-prose.test.mjs +0 -235
- package/scripts/instruments.test.mjs +0 -787
- package/scripts/is-cli.test.mjs +0 -99
- package/scripts/issue-tracker-prose.test.mjs +0 -71
- package/scripts/json.test.mjs +0 -364
- package/scripts/ledger-dispatch.test.mjs +0 -927
- package/scripts/ledger-grammar.test.mjs +0 -227
- package/scripts/ledger-read-require-file.test.mjs +0 -197
- package/scripts/ledger-rotate.test.mjs +0 -142
- package/scripts/ledger.test.mjs +0 -3436
- package/scripts/line-distance-prose.test.mjs +0 -245
- package/scripts/liveness-rationale-prose.test.mjs +0 -83
- package/scripts/locale-pin-prose.test.mjs +0 -189
- package/scripts/main-checkout.test.mjs +0 -332
- package/scripts/member-outcome-prose.test.mjs +0 -167
- package/scripts/member-outcomes-header.test.mjs +0 -129
- package/scripts/member-outcomes-prose.test.mjs +0 -63
- package/scripts/member-outcomes.test.mjs +0 -638
- package/scripts/member-prompt-prose.test.mjs +0 -165
- package/scripts/member-record.test.mjs +0 -541
- package/scripts/member-write-guard.test.mjs +0 -214
- package/scripts/merge-commit-probe-prose.test.mjs +0 -122
- package/scripts/merge-gate.test.mjs +0 -613
- package/scripts/muted-git-guard-sweep.test.mjs +0 -493
- package/scripts/net-ssh-precedence-prose.test.mjs +0 -91
- package/scripts/net-watchdog-prose.test.mjs +0 -79
- package/scripts/net.test.mjs +0 -211
- package/scripts/no-ci-gate-prose.test.mjs +0 -108
- package/scripts/no-undo-audit.test.mjs +0 -3961
- package/scripts/no-wave.test.mjs +0 -138
- package/scripts/node-floor-sweep.test.mjs +0 -611
- package/scripts/pointer-target-prose.test.mjs +0 -186
- package/scripts/pr-cost.test.mjs +0 -521
- package/scripts/pr-overlap.test.mjs +0 -692
- package/scripts/printf-die-sweep.test.mjs +0 -384
- package/scripts/prompt-renderer.mjs +0 -40
- package/scripts/prompt-renderer.test.mjs +0 -68
- package/scripts/prose-pin.mjs +0 -807
- package/scripts/prose-pin.test.mjs +0 -1034
- package/scripts/prove-merge.test.mjs +0 -995
- package/scripts/pull-table-relabel-prose.test.mjs +0 -60
- package/scripts/quiet-payload-prose.test.mjs +0 -222
- package/scripts/reap-cherry-check-prose.test.mjs +0 -80
- package/scripts/reap.test.mjs +0 -4432
- package/scripts/reaping-prose.test.mjs +0 -239
- package/scripts/reaping-reap-authorizers-prose.test.mjs +0 -112
- package/scripts/reaping-release-authorizers-prose.test.mjs +0 -85
- package/scripts/recipe-derivation-prose.test.mjs +0 -112
- package/scripts/recipe-prove.test.mjs +0 -1042
- package/scripts/refuter-scratch-prose.test.mjs +0 -135
- package/scripts/release-label-required-prose.test.mjs +0 -71
- package/scripts/release-label-split-prose.test.mjs +0 -184
- package/scripts/release-ticket-reap-pairing-prose.test.mjs +0 -63
- package/scripts/release-ticket.test.mjs +0 -5099
- package/scripts/renovate-release-contract.test.mjs +0 -379
- package/scripts/repo-root.test.mjs +0 -873
- package/scripts/reporter-output-rule-prose.test.mjs +0 -208
- package/scripts/review-agent-report-only.test.mjs +0 -49
- package/scripts/review-core-booking.test.mjs +0 -35
- package/scripts/review-core-cwd-isolation.test.mjs +0 -374
- package/scripts/review-core-reads.test.mjs +0 -478
- package/scripts/review-core-refuter-scratch.test.mjs +0 -148
- package/scripts/review-core-scratch-refusal.test.mjs +0 -64
- package/scripts/review-core-shared-test-run.test.mjs +0 -275
- package/scripts/review-core-snapshot-path.test.mjs +0 -830
- package/scripts/review-core-specialist-scratch.test.mjs +0 -191
- package/scripts/review-core-testcmd.test.mjs +0 -335
- package/scripts/review-core-unrun.test.mjs +0 -566
- package/scripts/review-core-unverified-discriminant.test.mjs +0 -208
- package/scripts/review-eval-resolver-path.test.mjs +0 -55
- package/scripts/review-host-fixture.mjs +0 -89
- package/scripts/review-in-run-retry.test.mjs +0 -211
- package/scripts/review-no-vendor-dispatch.test.mjs +0 -45
- package/scripts/review-path-default.test.mjs +0 -796
- package/scripts/review-runner-spawns.test.mjs +0 -95
- package/scripts/review-runner.test.mjs +0 -166
- package/scripts/review-tier-audit.test.mjs +0 -140
- package/scripts/run-artifact-pr-prose.test.mjs +0 -341
- package/scripts/run-merge-bot-prose.test.mjs +0 -1413
- package/scripts/run-team-local-hook.test.mjs +0 -442
- package/scripts/scratch-partition-invariant-prose.test.mjs +0 -74
- package/scripts/scripts-path-citation-sweep.test.mjs +0 -73
- package/scripts/section-between-guard-prose.test.mjs +0 -379
- package/scripts/select-dimensions.test.mjs +0 -674
- package/scripts/shared-refusal.test.mjs +0 -388
- package/scripts/shell-traps-prose.test.mjs +0 -504
- package/scripts/shortlist.test.mjs +0 -380
- package/scripts/slow-transport.mjs +0 -72
- package/scripts/snapshot-repo.test.mjs +0 -1006
- package/scripts/snapshot-runner-audience-prose.test.mjs +0 -130
- package/scripts/spend-view.test.mjs +0 -312
- package/scripts/staleness-qualifier-prose.test.mjs +0 -251
- package/scripts/staleness-verdict-prose.test.mjs +0 -142
- package/scripts/staleness.test.mjs +0 -893
- package/scripts/stalled-member-liveness-prose.test.mjs +0 -219
- package/scripts/stash-prohibition-prose.test.mjs +0 -313
- package/scripts/strip-comments.mjs +0 -44
- package/scripts/temp-dir.mjs +0 -47
- package/scripts/ticket-router.test.mjs +0 -981
- package/scripts/tier-check.test.mjs +0 -828
- package/scripts/tier-outcomes-header.test.mjs +0 -518
- package/scripts/tier-outcomes.test.mjs +0 -572
- package/scripts/tier-roles.test.mjs +0 -535
- package/scripts/tracker-block-copy-prose.test.mjs +0 -288
- package/scripts/triage-labels-gloss-prose.test.mjs +0 -97
- package/scripts/unattended-git-sweep.test.mjs +0 -142
- package/scripts/verify-sha-exit2-prose.test.mjs +0 -269
- package/scripts/verify-sha.test.mjs +0 -692
- package/scripts/watcher-degraded-block.test.mjs +0 -369
- package/scripts/watcher-key-prose.test.mjs +0 -106
- package/scripts/within-run-pair-prose.test.mjs +0 -212
- package/scripts/worktree-audit.test.mjs +0 -1408
- package/scripts/worktree-head-prose.test.mjs +0 -276
- package/scripts/worktree-listing-sweep.test.mjs +0 -217
- package/scripts/worktree-model-prose.test.mjs +0 -216
- package/scripts/worktree-porcelain.mjs +0 -35
- package/scripts/worktree-porcelain.test.mjs +0 -102
|
@@ -1,541 +0,0 @@
|
|
|
1
|
-
import { test } from "node:test";
|
|
2
|
-
import assert from "node:assert/strict";
|
|
3
|
-
import { mkdirSync, writeFileSync } from "node:fs";
|
|
4
|
-
import { tempDir } from "./temp-dir.mjs";
|
|
5
|
-
import { join, dirname } from "node:path";
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
encodeProjectDir,
|
|
9
|
-
readOmpMember, readOmpSession, foldOmpTranscript,
|
|
10
|
-
readMembers,
|
|
11
|
-
} from "./member-record.mjs";
|
|
12
|
-
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// cwd encoder, verified against real directory names
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
test("encodeProjectDir: home-relative cwd is `-` + segments joined by `-`, dots preserved", () => {
|
|
18
|
-
// Verified 2026-09-09 against real `~/.omp/agent/sessions/*` directory
|
|
19
|
-
// names on this machine, read out of each transcript's own
|
|
20
|
-
// {"type":"session",...,"cwd":...} line:
|
|
21
|
-
// ~/dev/fleet-plugin -> -dev-fleet-plugin (dir exists on disk)
|
|
22
|
-
// ~/.ssh -> -.ssh (dir exists on disk, dot kept)
|
|
23
|
-
assert.equal(encodeProjectDir("/Users/chris/dev/fleet-plugin", { home: "/Users/chris" }), "-dev-fleet-plugin");
|
|
24
|
-
assert.equal(encodeProjectDir("/Users/chris/.ssh", { home: "/Users/chris" }), "-.ssh");
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test("encodeProjectDir: non-home cwd is realpath-resolved and double-dash wrapped", () => {
|
|
28
|
-
// Verified 2026-09-09 against a real transcript's session line —
|
|
29
|
-
// {"type":"session",...,"cwd":"/tmp/fix685/scratch"} — which lived under
|
|
30
|
-
// ~/.omp/agent/sessions/--private-tmp-fix685-scratch--/. macOS symlinks
|
|
31
|
-
// /tmp -> /private/tmp, which is why the ENCODING follows realpath rather
|
|
32
|
-
// than the raw cwd; `realpath` is injected here so the assertion does not
|
|
33
|
-
// depend on that scratch directory still existing on disk.
|
|
34
|
-
const macRealpath = (p) => p.replace(/^\/tmp\b/, "/private/tmp");
|
|
35
|
-
assert.equal(
|
|
36
|
-
encodeProjectDir("/tmp/fix685/scratch", { home: "/Users/chris", realpath: macRealpath }),
|
|
37
|
-
"--private-tmp-fix685-scratch--",
|
|
38
|
-
);
|
|
39
|
-
// Bare /tmp itself, confirmed against the real `--private-tmp--` directory.
|
|
40
|
-
assert.equal(encodeProjectDir("/tmp", { home: "/Users/chris", realpath: macRealpath }), "--private-tmp--");
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
// ---------------------------------------------------------------------------
|
|
44
|
-
// omp fixtures — shaped like real ~/.omp/agent/sessions/**/*.jsonl lines,
|
|
45
|
-
// measured 2026-09-08/09 (see member-record.mjs's foldOmpTranscript comment).
|
|
46
|
-
// ---------------------------------------------------------------------------
|
|
47
|
-
|
|
48
|
-
const evt = (o) => JSON.stringify(o);
|
|
49
|
-
const sessionEvt = (cwd) => evt({ type: "session", version: 3, id: "s1", timestamp: "2026-09-08T15:11:49.444Z", cwd });
|
|
50
|
-
const thinkingEvt = (level) => evt({ type: "thinking_level_change", id: "t1", parentId: null, timestamp: "2026-09-08T15:11:49.494Z", thinkingLevel: level, configured: null });
|
|
51
|
-
const sessionInitEvt = (task, resolvedModelIdentity, agent) => evt({ type: "session_init", id: "i1", parentId: "t1", timestamp: "2026-09-08T15:11:49.495Z", task, resolvedModelIdentity, agent });
|
|
52
|
-
const assistantEvt = (model, usage, ts = "2026-09-08T15:12:00.000Z") => evt({
|
|
53
|
-
type: "message", id: "m1", parentId: "i1", timestamp: ts,
|
|
54
|
-
message: { role: "assistant", content: [{ type: "text", text: "ok" }], model, usage },
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
function ompSessionFixture(sessionName, files) {
|
|
58
|
-
const root = tempDir("mr-omp-home-");
|
|
59
|
-
const sessionsRoot = join(root, ".omp", "agent", "sessions", "-x");
|
|
60
|
-
const sessionDir = join(sessionsRoot, sessionName);
|
|
61
|
-
mkdirSync(sessionDir, { recursive: true });
|
|
62
|
-
for (const [name, lines] of Object.entries(files)) {
|
|
63
|
-
// `name` may itself carry `/` (a nested member, e.g. "Nested/Reviewer") —
|
|
64
|
-
// create the parent dir so a fixture can exercise readOmpSession's own
|
|
65
|
-
// recursive walk and the spawnDepth it reads off the path.
|
|
66
|
-
mkdirSync(dirname(join(sessionDir, `${name}.jsonl`)), { recursive: true });
|
|
67
|
-
writeFileSync(join(sessionDir, `${name}.jsonl`), lines.join("\n") + "\n");
|
|
68
|
-
}
|
|
69
|
-
return sessionDir;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
test("readOmpMember: cost, tokens and thinking come off real usage/thinking_level_change shapes", () => {
|
|
73
|
-
const lines = [
|
|
74
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
75
|
-
thinkingEvt("xhigh"),
|
|
76
|
-
sessionInitEvt("Implement ticket 580"),
|
|
77
|
-
assistantEvt("claude-sonnet-5", { input: 2, output: 201, cacheRead: 0, cacheWrite: 31319, totalTokens: 31522, cost: { input: 4e-6, output: 0.00201, cacheRead: 0, cacheWrite: 0.0782975, total: 0.0803115 } }),
|
|
78
|
-
];
|
|
79
|
-
const rec = readOmpMember(lines.join("\n"), "/fake/path.jsonl", "Memory1");
|
|
80
|
-
assert.equal(rec.harness, "omp");
|
|
81
|
-
assert.equal(rec.model, "claude-sonnet-5");
|
|
82
|
-
assert.equal(rec.thinking, "xhigh");
|
|
83
|
-
assert.equal(rec.tokens_in, 2);
|
|
84
|
-
assert.equal(rec.tokens_cache_create, 31319);
|
|
85
|
-
assert.equal(rec.tokens_cache_read, 0);
|
|
86
|
-
assert.equal(rec.tokens_out, 201);
|
|
87
|
-
assert.ok(Math.abs(rec.cost - 0.0803115) < 1e-9);
|
|
88
|
-
assert.equal(rec.turns, 1);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test("readOmpMember: tokens_cache_write_1h sums each turn's usage.cttl.ephemeral1h, and is unknown when cache was written with no TTL split", () => {
|
|
92
|
-
const turn = (cacheWrite, cttl, ts) => assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite, ...(cttl ? { cttl } : {}), cost: { total: 0.01 } }, ts);
|
|
93
|
-
const rec = (...turns) => readOmpMember([sessionEvt("/x"), thinkingEvt("high"), ...turns].join("\n"), "/fake/path.jsonl", "impl-1");
|
|
94
|
-
// Measured shapes: `{ephemeral1h:n}` and `{ephemeral5m:n}`, only on a turn that wrote cache.
|
|
95
|
-
const mixed = rec(turn(300, { ephemeral1h: 300 }), turn(0, null, "2026-09-08T15:13:00.000Z"),
|
|
96
|
-
turn(50, { ephemeral5m: 50 }, "2026-09-08T15:14:00.000Z"), turn(20, { ephemeral1h: 20 }, "2026-09-08T15:15:00.000Z"));
|
|
97
|
-
assert.equal(mixed.tokens_cache_create, 370);
|
|
98
|
-
assert.equal(mixed.tokens_cache_write_1h, 320);
|
|
99
|
-
assert.equal(rec(turn(0, null)).tokens_cache_write_1h, 0, "nothing written is a real zero");
|
|
100
|
-
assert.equal(rec(turn(40, null)).tokens_cache_write_1h, null, "cache written with no recorded split is unknown, never zero");
|
|
101
|
-
assert.equal(rec(turn(300, { ephemeral1h: 300 }), turn(700, null, "2026-09-08T15:13:00.000Z")).tokens_cache_write_1h, null,
|
|
102
|
-
"one cache-writing turn with no recorded split makes the whole figure unknown, never the recorded share alone");
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
test("readOmpMember: cost is null, never 0, when no turn carries usage.cost.total", () => {
|
|
106
|
-
const rec = (...turns) => readOmpMember([sessionEvt("/x"), thinkingEvt("high"), ...turns].join("\n"), "/fake/path.jsonl", "impl-1");
|
|
107
|
-
const noCost = assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0 });
|
|
108
|
-
const priced = assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, cost: { total: 0.25 } }, "2026-09-08T15:13:00.000Z");
|
|
109
|
-
assert.equal(rec(noCost).cost, null, "no figure recorded is blank, so pr-cost counts it unpriced instead of booking a free member");
|
|
110
|
-
assert.equal(rec(noCost, noCost).cost, null);
|
|
111
|
-
assert.equal(rec(noCost).turns, 1, "the turn itself still counts");
|
|
112
|
-
assert.equal(rec(priced).cost, 0.25);
|
|
113
|
-
});
|
|
114
|
-
|
|
115
|
-
test("foldOmpTranscript: resolvedModelIdentity comes off session_init, present before any assistant turn (#1345)", () => {
|
|
116
|
-
// Measured shape: always provider-prefixed (`anthropic/claude-opus-5`),
|
|
117
|
-
// written at DISPATCH — before the member's first assistant turn, which
|
|
118
|
-
// is exactly why this is a different field from `model` above rather than
|
|
119
|
-
// a duplicate of it. No assistant turn at all here, so `model` stays null
|
|
120
|
-
// while `resolvedModelIdentity` is already populated.
|
|
121
|
-
const lines = [
|
|
122
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
123
|
-
thinkingEvt("xhigh"),
|
|
124
|
-
sessionInitEvt("Implement ticket 580", "anthropic/claude-opus-5"),
|
|
125
|
-
];
|
|
126
|
-
const folded = foldOmpTranscript(lines.join("\n"), "/fake/path.jsonl");
|
|
127
|
-
assert.equal(folded.model, null, "a member with no assistant turn yet must not fold a model from nowhere");
|
|
128
|
-
assert.equal(folded.resolvedModelIdentity, "anthropic/claude-opus-5");
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
test("foldOmpTranscript: resolvedModelIdentity is null, never guessed, when session_init carries none", () => {
|
|
132
|
-
const lines = [sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("xhigh"), sessionInitEvt("Implement ticket 580")];
|
|
133
|
-
assert.equal(foldOmpTranscript(lines.join("\n"), "/fake/path.jsonl").resolvedModelIdentity, null);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
test("foldOmpTranscript: a malformed line away from the tail is counted, not silently dropped (#1717 review)", () => {
|
|
137
|
-
// The tool-attribution stream (#1717) turned the pre-existing silent
|
|
138
|
-
// per-line drop into a real hazard: losing a middle line can desync a
|
|
139
|
-
// toolCall from its toolResult, not just cost its own turn's totals — the
|
|
140
|
-
// same mid-file-tear shape `malformedNonLastLines` exists to catch.
|
|
141
|
-
const good = assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 100, totalTokens: 0 });
|
|
142
|
-
const torn = '{"type":"message","message":{"role":"ass';
|
|
143
|
-
const folded = foldOmpTranscript([good, torn, good].join("\n") + "\n", "/fake/path.jsonl");
|
|
144
|
-
assert.equal(folded.malformedNonLastLines, 1);
|
|
145
|
-
assert.equal(folded.cacheWrite, 200, "surrounding turns still fold — only the torn line itself is lost");
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test("foldOmpTranscript: a torn LAST line stays uncounted — the tear a live write legitimately produces", () => {
|
|
149
|
-
const good = assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 100, totalTokens: 0 });
|
|
150
|
-
const torn = '{"type":"message","message":{"role":"ass';
|
|
151
|
-
// No trailing newline: the torn write is the final element of the split.
|
|
152
|
-
const folded = foldOmpTranscript([good, torn].join("\n"), "/fake/path.jsonl");
|
|
153
|
-
assert.equal(folded.malformedNonLastLines, 0);
|
|
154
|
-
assert.equal(folded.cacheWrite, 100);
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
test("readOmpMember: resolvedModelIdentity rides alongside `model` as an additive field, never replacing it", () => {
|
|
158
|
-
const lines = [
|
|
159
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
160
|
-
thinkingEvt("xhigh"),
|
|
161
|
-
sessionInitEvt("Implement ticket 580", "anthropic/claude-opus-5"),
|
|
162
|
-
assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2 }),
|
|
163
|
-
];
|
|
164
|
-
const rec = readOmpMember(lines.join("\n"), "/fake/path.jsonl", "Memory1");
|
|
165
|
-
assert.equal(rec.model, "claude-opus-5", "the per-turn model board.mjs/member-outcomes.mjs already key on must stay unchanged");
|
|
166
|
-
assert.equal(rec.resolvedModelIdentity, "anthropic/claude-opus-5");
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
test("readOmpMember: subagent_type is session_init's `agent`, blank when the transcript carries no session_init", () => {
|
|
170
|
-
// #1066: the deliberate alternate-tier pair is identifiable ONLY from
|
|
171
|
-
// what the dispatch named. It cannot ride on `role`: since #1486 both
|
|
172
|
-
// definitions book `role=implementer`, so a role filter selects the
|
|
173
|
-
// pair's members without saying which arm each is. A classification that
|
|
174
|
-
// moved is why the join key is the dispatch RECORD.
|
|
175
|
-
const withAgent = [
|
|
176
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("xhigh"),
|
|
177
|
-
sessionInitEvt("Implement ticket 580", "anthropic/claude-sonnet-5", "fleet-implementer-alt"),
|
|
178
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2 }),
|
|
179
|
-
];
|
|
180
|
-
assert.equal(readOmpMember(withAgent.join("\n"), "/fake/path.jsonl", "Alt1").subagent_type, "fleet-implementer-alt");
|
|
181
|
-
|
|
182
|
-
const noInit = [
|
|
183
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("xhigh"),
|
|
184
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2 }),
|
|
185
|
-
];
|
|
186
|
-
assert.equal(readOmpMember(noInit.join("\n"), "/fake/path.jsonl", "Alt2").subagent_type, "");
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
test("readOmpMember: cost and tokens sum across turns — one usage object per turn, no fold-back", () => {
|
|
190
|
-
const usage = (cw) => ({ input: 1, output: 10, cacheRead: 5, cacheWrite: cw, totalTokens: cw + 16, cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0.01 } });
|
|
191
|
-
const lines = [
|
|
192
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
193
|
-
thinkingEvt("high"),
|
|
194
|
-
assistantEvt("claude-opus-5", usage(100)),
|
|
195
|
-
assistantEvt("claude-opus-5", usage(200)),
|
|
196
|
-
];
|
|
197
|
-
const rec = readOmpMember(lines.join("\n"), "/fake/path.jsonl", "Agent2");
|
|
198
|
-
assert.equal(rec.turns, 2);
|
|
199
|
-
assert.equal(rec.tokens_cache_create, 300);
|
|
200
|
-
assert.equal(rec.tokens_out, 20);
|
|
201
|
-
assert.ok(Math.abs(rec.cost - 0.02) < 1e-9);
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
test("readOmpMember: thinking is `-`, never blank, when no thinking_level_change event exists", () => {
|
|
205
|
-
const lines = [
|
|
206
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
207
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.001 } }),
|
|
208
|
-
];
|
|
209
|
-
const rec = readOmpMember(lines.join("\n"), "/fake/path.jsonl", "Agent3");
|
|
210
|
-
assert.equal(rec.thinking, "-");
|
|
211
|
-
});
|
|
212
|
-
|
|
213
|
-
test("readOmpMember: a transcript with no assistant turn yields no row", () => {
|
|
214
|
-
const lines = [sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high")];
|
|
215
|
-
assert.equal(readOmpMember(lines.join("\n"), "/fake/path.jsonl", "Idle"), null);
|
|
216
|
-
});
|
|
217
|
-
|
|
218
|
-
test("readOmpMember: a nested member whose task reads like a reviewer books as specialist — depth wins over text", () => {
|
|
219
|
-
// The concrete misclassification this pins: a fan-out member dispatched
|
|
220
|
-
// one level deep, whose own `session_init.task` happens to read like a
|
|
221
|
-
// reviewer's ("Review PR 1353 correctness"), must not be read as a
|
|
222
|
-
// top-level reviewer. classifyRole() checks spawnDepth BEFORE any text
|
|
223
|
-
// match for exactly this reason; the fix is passing the real depth
|
|
224
|
-
// through rather than defaulting it to 0.
|
|
225
|
-
const lines = [
|
|
226
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
227
|
-
sessionInitEvt("Review PR 1353 correctness"),
|
|
228
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.001 } }),
|
|
229
|
-
];
|
|
230
|
-
const rec = readOmpMember(lines.join("\n"), "/fake/path.jsonl", "NestedReviewer", 1);
|
|
231
|
-
assert.equal(rec.role, "specialist");
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
test("readOmpMember: role comes off session_init's `agent`, the identity the row already records (#1486)", () => {
|
|
235
|
-
// The defect this closes. `agent` was in scope and written to the row's own
|
|
236
|
-
// `subagent_type` column, but never handed to classifyRole — so classifyRole's
|
|
237
|
-
// FIRST branch, the one whose comment says memory-system work must "never land
|
|
238
|
-
// in review spend", was structurally unreachable and every omp row's role
|
|
239
|
-
// was decided by dispatch-prompt prose alone.
|
|
240
|
-
//
|
|
241
|
-
// Measured 2026-09-16 over the live corpus: 50 omp/memory-proxy rows, none of
|
|
242
|
-
// them role=memory — 47 booked `other`, 2 `finisher`, 1 `reviewer`, entirely
|
|
243
|
-
// on how each dispatch prompt happened to read. The task text below is a real
|
|
244
|
-
// shape of that: prose that says "finish", from a member that is not a
|
|
245
|
-
// finisher.
|
|
246
|
-
const memory = [
|
|
247
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
248
|
-
sessionInitEvt("Save the merge-bot label cycle memory, then finish PR 1485", "anthropic/claude-sonnet-5", "memory-proxy"),
|
|
249
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 41982, totalTokens: 2 }),
|
|
250
|
-
];
|
|
251
|
-
const rec = readOmpMember(memory.join("\n"), "/fake/path.jsonl", "SaveMergeBotLabelCycleMemory", 0);
|
|
252
|
-
assert.equal(rec.role, "memory");
|
|
253
|
-
// The column and the role now read the same dispatch record rather than
|
|
254
|
-
// disagreeing about what the member was.
|
|
255
|
-
assert.equal(rec.subagent_type, "memory-proxy");
|
|
256
|
-
|
|
257
|
-
// The review fan-out is the same defect at depth 0, which is where omp puts
|
|
258
|
-
// it: `review-eval.mjs` runs inside the controller's own session, so a
|
|
259
|
-
// depth-only rule cannot separate it from a top-level dispatch.
|
|
260
|
-
const verifier = [
|
|
261
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
262
|
-
sessionInitEvt("Refute finding unv1 on PR 1353", "anthropic/claude-sonnet-5", "fleet-review-verifier"),
|
|
263
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 2 }),
|
|
264
|
-
];
|
|
265
|
-
assert.equal(readOmpMember(verifier.join("\n"), "/fake/path.jsonl", "RefuteUnvOne", 0).role, "specialist");
|
|
266
|
-
|
|
267
|
-
const impl = [
|
|
268
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("xhigh"),
|
|
269
|
-
sessionInitEvt("Your full dispatch brief is at local://dispatch-1486.md", "anthropic/claude-opus-5", "fleet-implementer"),
|
|
270
|
-
assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 2 }),
|
|
271
|
-
];
|
|
272
|
-
assert.equal(readOmpMember(impl.join("\n"), "/fake/path.jsonl", "InstallVerifySearch", 0).role, "implementer");
|
|
273
|
-
});
|
|
274
|
-
|
|
275
|
-
test("readOmpMember: the agent definition is a role signal in its own right, so a task-less dispatch still classifies", () => {
|
|
276
|
-
// `hasRoleSignal` named two signals because only two existed; `agent` is now a
|
|
277
|
-
// third, and leaving it out would REFUSE a classification to a row that holds
|
|
278
|
-
// a perfectly readable identity. `session_init.task` is documented as present
|
|
279
|
-
// only "when present", so this is a shape the format sanctions rather than one
|
|
280
|
-
// invented here — measured 2026-09-16, 0 of 1,403 transcripts on disk carry
|
|
281
|
-
// `agent` without `task` today, which is exactly why nothing else pins it.
|
|
282
|
-
const lines = [
|
|
283
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
284
|
-
evt({ type: "session_init", id: "i1", parentId: "t1", timestamp: "2026-09-08T15:11:49.495Z", resolvedModelIdentity: "anthropic/claude-sonnet-5", agent: "memory-proxy" }),
|
|
285
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 2 }),
|
|
286
|
-
];
|
|
287
|
-
assert.equal(readOmpMember(lines.join("\n"), "/fake/path.jsonl", "NoTaskMemory", 0).role, "memory");
|
|
288
|
-
|
|
289
|
-
// And the hole stays visible where there genuinely is no signal: a transcript
|
|
290
|
-
// with no session_init line at all still refuses to guess off the AgentId.
|
|
291
|
-
const bare = [
|
|
292
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
293
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 2 }),
|
|
294
|
-
];
|
|
295
|
-
assert.equal(readOmpMember(bare.join("\n"), "/fake/path.jsonl", "InstallVerifySearch", 0).role, "-");
|
|
296
|
-
});
|
|
297
|
-
|
|
298
|
-
test("readOmpMember: role is `-`, never a guess off the bare AgentId, when neither task nor depth gives a real signal", () => {
|
|
299
|
-
// AgentId is a generated CamelCase word pair (`InstallVerifySearch`) — it
|
|
300
|
-
// names nothing classifyRole can read, so guessing from it would invent a
|
|
301
|
-
// classification rather than record one.
|
|
302
|
-
const lines = [
|
|
303
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
304
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.001 } }),
|
|
305
|
-
];
|
|
306
|
-
const rec = readOmpMember(lines.join("\n"), "/fake/path.jsonl", "InstallVerifySearch", 0);
|
|
307
|
-
assert.equal(rec.role, "-");
|
|
308
|
-
});
|
|
309
|
-
|
|
310
|
-
test("readOmpMember: a canonically-named AgentId is itself a role signal under the default `task` definition (#1506)", () => {
|
|
311
|
-
// `fix-pr-1380`, `merge-bot-5`, `impl-1049` and friends are dispatched
|
|
312
|
-
// under run-team's default `task` definition — `session_init.agent` is the
|
|
313
|
-
// literal string `task`, which no definition branch of classifyRole
|
|
314
|
-
// matches. That is a different gap from #1502's: #1502 fixed a forwarding
|
|
315
|
-
// bug where an EXISTING `folded.agent` value wasn't reaching classifyRole;
|
|
316
|
-
// here the recorded definition names no role at all. But the AgentId
|
|
317
|
-
// itself IS the dispatch name (run-team's own naming convention), so it
|
|
318
|
-
// must reach classifyRole as `memberName` and win a real classification
|
|
319
|
-
// even when the dispatch prompt's own prose says nothing role-shaped.
|
|
320
|
-
const noKeywords = [
|
|
321
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
322
|
-
sessionInitEvt("Apply the requested patch set and open a PR.", "anthropic/claude-sonnet-5", "task"),
|
|
323
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 12 }),
|
|
324
|
-
].join("\n");
|
|
325
|
-
assert.equal(readOmpMember(noKeywords, "/fake/path.jsonl", "fix-pr-1380", 0).role, "reviewer");
|
|
326
|
-
assert.equal(readOmpMember(noKeywords, "/fake/path.jsonl", "review-pr-42", 0).role, "reviewer");
|
|
327
|
-
assert.equal(readOmpMember(noKeywords, "/fake/path.jsonl", "finisher-99", 0).role, "finisher");
|
|
328
|
-
assert.equal(readOmpMember(noKeywords, "/fake/path.jsonl", "finish-7", 0).role, "finisher");
|
|
329
|
-
assert.equal(readOmpMember(noKeywords, "/fake/path.jsonl", "impl-1049", 0).role, "implementer");
|
|
330
|
-
assert.equal(readOmpMember(noKeywords, "/fake/path.jsonl", "merge-bot-5", 0).role, "merge-bot");
|
|
331
|
-
});
|
|
332
|
-
|
|
333
|
-
test("readOmpMember: a canonically-named AgentId still classifies with no session_init line at all — the stem widens `hasRoleSignal` itself (#1506)", () => {
|
|
334
|
-
// Unlike the generated-word-pair case above, a canonical name is a
|
|
335
|
-
// readable identity even when the transcript predates #1343 and carries
|
|
336
|
-
// neither `task` nor `agent`. The hole must not swallow a real signal —
|
|
337
|
-
// checked against every prefix `OMP_CANONICAL_STEM_RE` names, not just one,
|
|
338
|
-
// so a mutant that drops a prefix from the gate fails here even though the
|
|
339
|
-
// memberName-reaches-classifyRole test above cannot see it (that fixture's
|
|
340
|
-
// `session_init.task` already satisfies `hasRoleSignal` on its own).
|
|
341
|
-
const bare = [
|
|
342
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
343
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 12 }),
|
|
344
|
-
].join("\n");
|
|
345
|
-
assert.equal(readOmpMember(bare, "/fake/path.jsonl", "fix-pr-1516", 0).role, "reviewer");
|
|
346
|
-
assert.equal(readOmpMember(bare, "/fake/path.jsonl", "review-pr-77", 0).role, "reviewer");
|
|
347
|
-
assert.equal(readOmpMember(bare, "/fake/path.jsonl", "finisher-3", 0).role, "finisher");
|
|
348
|
-
assert.equal(readOmpMember(bare, "/fake/path.jsonl", "finish-3", 0).role, "finisher");
|
|
349
|
-
assert.equal(readOmpMember(bare, "/fake/path.jsonl", "impl-1516", 0).role, "implementer");
|
|
350
|
-
assert.equal(readOmpMember(bare, "/fake/path.jsonl", "merge-bot-3", 0).role, "merge-bot");
|
|
351
|
-
});
|
|
352
|
-
|
|
353
|
-
test("readOmpMember: a real agent definition still wins over a coincidentally name-shaped AgentId (#1506)", () => {
|
|
354
|
-
// Guards the ordering: classifyRole's definition-based branches run BEFORE
|
|
355
|
-
// the name/description patterns, so a member dispatched under a real
|
|
356
|
-
// definition must classify on that definition regardless of what its
|
|
357
|
-
// AgentId happens to look like.
|
|
358
|
-
const lines = [
|
|
359
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
360
|
-
sessionInitEvt("Run the correctness review dimension.", "anthropic/claude-sonnet-5", "fleet-review-verifier"),
|
|
361
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 12 }),
|
|
362
|
-
].join("\n");
|
|
363
|
-
assert.equal(readOmpMember(lines, "/fake/path.jsonl", "review-pr-42", 0).role, "specialist");
|
|
364
|
-
});
|
|
365
|
-
|
|
366
|
-
// #2209: `pr` for a member whose NAME carries none (every implementer) comes
|
|
367
|
-
// from the transcript's own `gh pr create` result. Shapes measured 2026-09-29
|
|
368
|
-
// across every real ~/.omp/agent/sessions/**/*.jsonl: the call is a `bash`
|
|
369
|
-
// toolCall block, the result its own `toolResult` line whose first text block
|
|
370
|
-
// holds gh's stdout — the PR URL on a line of its own — then omp's
|
|
371
|
-
// "Wall time" trailer, sometimes followed by a second injected text block.
|
|
372
|
-
const USAGE = { input: 1, output: 1, cacheRead: 0, cacheWrite: 10, totalTokens: 12 };
|
|
373
|
-
const bashCallEvt = (id, command) => evt({
|
|
374
|
-
type: "message", id: `c-${id}`, parentId: "i1", timestamp: "2026-09-08T15:12:00.000Z",
|
|
375
|
-
message: { role: "assistant", content: [{ type: "toolCall", id, name: "bash", arguments: { command, i: "x" } }], model: "claude-sonnet-5", usage: USAGE },
|
|
376
|
-
});
|
|
377
|
-
const bashResultEvt = (id, text, isError = false) => evt({
|
|
378
|
-
type: "message", id: `r-${id}`, parentId: `c-${id}`, timestamp: "2026-09-08T15:12:01.000Z",
|
|
379
|
-
message: {
|
|
380
|
-
role: "toolResult", toolCallId: id, toolName: "bash",
|
|
381
|
-
content: [{ type: "text", text }, { type: "text", text: "Memory check: skip if nothing notable." }], isError,
|
|
382
|
-
},
|
|
383
|
-
});
|
|
384
|
-
const memberWith = (stem, ...calls) => readOmpMember([
|
|
385
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
386
|
-
sessionInitEvt("Implement ticket 7", "anthropic/claude-sonnet-5"),
|
|
387
|
-
...calls.flat(),
|
|
388
|
-
].join("\n"), "/fake/path.jsonl", stem, 0);
|
|
389
|
-
const created = (id, command, text) => [bashCallEvt(id, command), bashResultEvt(id, text)];
|
|
390
|
-
const CREATE = 'cd /wt && rtk git push -u origin HEAD && rtk gh pr create --base main --title "t" --body-file /tmp/b.md';
|
|
391
|
-
|
|
392
|
-
test("readOmpMember: pr is the PR the member's own `gh pr create` printed; the name-carried ticket stays (#2209)", () => {
|
|
393
|
-
const rec = memberWith("impl-7", created("t1", CREATE, "https://github.com/feigi/fleet-plugin/pull/1528\n\n\nWall time: 2.05 seconds"));
|
|
394
|
-
assert.equal(rec.pr, "1528");
|
|
395
|
-
assert.equal(rec.ticket, "7");
|
|
396
|
-
});
|
|
397
|
-
|
|
398
|
-
test("readOmpMember: the created PR is accepted whatever the member's name shape, host, or chain position (#2209)", () => {
|
|
399
|
-
// A generated or non-canonical AgentId (`Impl676`, `impl1230`) names no
|
|
400
|
-
// ticket, yet those members opened PRs too (Impl1335..Impl1349, impl1230, ...).
|
|
401
|
-
// A GitHub Enterprise host prints the same one-URL line; `gh pr create`
|
|
402
|
-
// first in the command, after `&&`, or on its own line all invoke it.
|
|
403
|
-
assert.equal(memberWith("Impl676", created("t1", "gh pr create --fill", "https://bmw.ghe.com/CoCo/agent-brain/pull/688\n\nWall time: 2.06 seconds")).pr, "688");
|
|
404
|
-
assert.equal(memberWith("impl1230", created("t1", "cat > /tmp/b <<'EOF'\nbody\nEOF\ngh pr create -F /tmp/b", "https://github.com/o/r/pull/1629\n")).pr, "1629");
|
|
405
|
-
// The same PR printed twice (a retried call) is still one PR.
|
|
406
|
-
assert.equal(memberWith("impl-7",
|
|
407
|
-
created("t1", CREATE, "https://github.com/o/r/pull/12\n"),
|
|
408
|
-
created("t2", CREATE, "https://github.com/o/r/pull/12\n")).pr, "12");
|
|
409
|
-
// A non-zero exit AFTER the create (`gh pr create ... && gh pr edit
|
|
410
|
-
// --add-label` where the label write fails) still printed a real, opened PR.
|
|
411
|
-
assert.equal(memberWith("impl-7", [bashCallEvt("t1", `${CREATE} && gh pr edit --add-label patch`),
|
|
412
|
-
bashResultEvt("t1", "https://github.com/o/r/pull/31\nfailed to update: label not found\n", true)]).pr, "31");
|
|
413
|
-
});
|
|
414
|
-
|
|
415
|
-
test("readOmpMember: pr stays blank, never guessed, when no call of the member's own created exactly one PR (#2209)", () => {
|
|
416
|
-
const cases = {
|
|
417
|
-
// A URL line from a command that merely READS a PR.
|
|
418
|
-
"view, not create": created("t1", "gh pr view 5 --json url -q .url", "https://github.com/o/r/pull/5\n"),
|
|
419
|
-
// `gh pr create` quoted as text is not an invocation of it.
|
|
420
|
-
"create only quoted": created("t1", 'echo "next: gh pr create"; gh pr view 5 --json url -q .url', "next: gh pr create\nhttps://github.com/o/r/pull/5\n"),
|
|
421
|
-
// gh's refusal names the PR someone ELSE already opened for the branch.
|
|
422
|
-
"already exists": created("t1", CREATE, 'a pull request for branch "fix/7" into branch "main" already exists:\nhttps://github.com/o/r/pull/9\n'),
|
|
423
|
-
// A URL inside prose is not gh's own output line.
|
|
424
|
-
"url in prose": created("t1", CREATE, "see https://github.com/o/r/pull/9 for context\n"),
|
|
425
|
-
// A create outrunning the tool timeout — the URL never reaches this result.
|
|
426
|
-
"backgrounded": created("t1", CREATE, "Backgrounded as job bg_15; result will be delivered automatically."),
|
|
427
|
-
// Two distinct PRs (a real one plus a throwaway probe, measured on
|
|
428
|
-
// impl-1578): picking either is a guess.
|
|
429
|
-
"two distinct PRs": [
|
|
430
|
-
...created("t1", CREATE, "https://github.com/o/r/pull/1681\n"),
|
|
431
|
-
...created("t2", CREATE, "https://github.com/o/r/pull/1682\n"),
|
|
432
|
-
],
|
|
433
|
-
};
|
|
434
|
-
for (const [label, lines] of Object.entries(cases)) {
|
|
435
|
-
assert.equal(memberWith("impl-7", lines).pr, "", label);
|
|
436
|
-
}
|
|
437
|
-
});
|
|
438
|
-
|
|
439
|
-
test("readOmpMember: a PR-named member keeps the PR its name carries over any PR it created (#2209)", () => {
|
|
440
|
-
// `fix-pr-9` works PR 9 by construction; a PR it opened on the side is not
|
|
441
|
-
// its unit of work and must not repoint its join into tier-outcomes.tsv.
|
|
442
|
-
assert.equal(memberWith("fix-pr-9", created("t1", CREATE, "https://github.com/o/r/pull/12\n")).pr, "9");
|
|
443
|
-
});
|
|
444
|
-
|
|
445
|
-
test("readOmpSession: one row per member file, stamped with the session dir name", () => {
|
|
446
|
-
const dir = ompSessionFixture("2026-09-08T13-13-27-300Z_01a08126-ee04-7095-a695-14e3249f1127", {
|
|
447
|
-
Memory1: [sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"), assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.001 } })],
|
|
448
|
-
Memory2: [sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"), assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.002 } })],
|
|
449
|
-
});
|
|
450
|
-
const rows = readOmpSession(dir);
|
|
451
|
-
assert.equal(rows.length, 2);
|
|
452
|
-
assert.deepEqual(rows.map((r) => r.harness), ["omp", "omp"]);
|
|
453
|
-
assert.deepEqual(new Set(rows.map((r) => r.agent)), new Set(["Memory1", "Memory2"]));
|
|
454
|
-
assert.ok(rows.every((r) => r.session === "2026-09-08T13-13-27-300Z_01a08126-ee04-7095-a695-14e3249f1127"));
|
|
455
|
-
});
|
|
456
|
-
|
|
457
|
-
test("readOmpSession: nesting depth is read off the path and feeds classifyRole's depth-first rule", () => {
|
|
458
|
-
const dir = ompSessionFixture("2026-09-09T02-00-00-000Z_cafef00d-cafe-cafe-cafe-cafef00dcafe", {
|
|
459
|
-
"Nested/Reviewer": [
|
|
460
|
-
sessionEvt("/x"), sessionInitEvt("Review PR 1353 correctness"),
|
|
461
|
-
assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.001 } }),
|
|
462
|
-
],
|
|
463
|
-
});
|
|
464
|
-
const rows = readOmpSession(dir);
|
|
465
|
-
assert.equal(rows.length, 1);
|
|
466
|
-
assert.equal(rows[0].agent, "Nested/Reviewer");
|
|
467
|
-
assert.equal(rows[0].role, "specialist");
|
|
468
|
-
});
|
|
469
|
-
|
|
470
|
-
// ---------------------------------------------------------------------------
|
|
471
|
-
// readMembers — the tree-walking entry point
|
|
472
|
-
// ---------------------------------------------------------------------------
|
|
473
|
-
|
|
474
|
-
test("readMembers: multiple roots merge into one array", () => {
|
|
475
|
-
const dirA = ompSessionFixture("2026-09-09T00-00-00-000Z_deadbeef-dead-dead-dead-deadbeefdead", {
|
|
476
|
-
Solo: [sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"), assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.001 } })],
|
|
477
|
-
});
|
|
478
|
-
const dirB = ompSessionFixture("2026-09-09T03-00-00-000Z_feedface-feed-face-feed-facefeedface", {
|
|
479
|
-
Solo2: [sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"), assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.002 } })],
|
|
480
|
-
});
|
|
481
|
-
const rows = readMembers([dirA, dirB]);
|
|
482
|
-
assert.equal(rows.length, 2);
|
|
483
|
-
assert.deepEqual(new Set(rows.map((r) => r.agent)), new Set(["Solo", "Solo2"]));
|
|
484
|
-
});
|
|
485
|
-
|
|
486
|
-
test("readMembers: a loose top-level session .jsonl FILE beside session directories is not swept in as a member, and `session` is the session directory's own name", () => {
|
|
487
|
-
// Regression fixture for the real tree's shape:
|
|
488
|
-
// ~/.omp/agent/sessions/-dev-fleet-plugin/ holds the project's MAIN-session
|
|
489
|
-
// transcripts as plain FILES sibling to the per-session DIRECTORIES. The
|
|
490
|
-
// old `.jsonl`-presence shortcut in findOmpSessionDirs matched the
|
|
491
|
-
// encoded-cwd directory itself for that reason, stamping every row
|
|
492
|
-
// `session=-dev-fleet-plugin` instead of the `<ISO>_<uuid>` name and
|
|
493
|
-
// booking the loose top-level file as a member.
|
|
494
|
-
const root = tempDir("mr-omp-realshape-");
|
|
495
|
-
const encDir = join(root, ".omp", "agent", "sessions", "-dev-fleet-plugin");
|
|
496
|
-
const sessionName = "2026-09-08T14-14-34-049Z_01a0815e-e141-716c-b2d8-2adf310fbe55";
|
|
497
|
-
const sessionDir = join(encDir, sessionName);
|
|
498
|
-
mkdirSync(sessionDir, { recursive: true });
|
|
499
|
-
writeFileSync(join(encDir, `${sessionName}.jsonl`), [
|
|
500
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"),
|
|
501
|
-
assistantEvt("claude-sonnet-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.999 } }),
|
|
502
|
-
].join("\n") + "\n");
|
|
503
|
-
writeFileSync(join(sessionDir, "Member1.jsonl"), [
|
|
504
|
-
sessionEvt("/Users/chris/dev/fleet-plugin"), thinkingEvt("high"),
|
|
505
|
-
assistantEvt("claude-opus-5", { input: 1, output: 1, cacheRead: 0, cacheWrite: 0, totalTokens: 2, cost: { total: 0.002 } }),
|
|
506
|
-
].join("\n") + "\n");
|
|
507
|
-
const rows = readMembers([encDir]);
|
|
508
|
-
assert.equal(rows.length, 1, "the loose top-level main-session file must not be swept in as a member");
|
|
509
|
-
assert.equal(rows[0].agent, "Member1");
|
|
510
|
-
assert.equal(rows[0].session, sessionName, "session must be the <ISO>_<uuid> DIRECTORY name, not the encoded-cwd dir");
|
|
511
|
-
});
|
|
512
|
-
|
|
513
|
-
test("readMembers: a not-omp-shaped file under an omp root is refused loudly, not silently parsed", () => {
|
|
514
|
-
const ompDir = ompSessionFixture("2026-09-09T01-00-00-000Z_baadf00d-baad-baad-baad-baadf00dbaad", {});
|
|
515
|
-
// `sessionId`/`parentUuid` are assertOmpShaped's own structural check — an
|
|
516
|
-
// omp line never carries either (session id lives in the DIRECTORY name);
|
|
517
|
-
// any line that does is a foreign or corrupted file, not this reader's
|
|
518
|
-
// business to guess at.
|
|
519
|
-
const foreignShaped = JSON.stringify({
|
|
520
|
-
type: "assistant", sessionId: "sess-1", uuid: "u1", timestamp: "2026-08-25T07:14:12.147Z",
|
|
521
|
-
message: { id: "m1", model: "claude-opus-5" },
|
|
522
|
-
});
|
|
523
|
-
writeFileSync(join(ompDir, "wrong-root.jsonl"), foreignShaped + "\n");
|
|
524
|
-
assert.throws(() => readMembers([ompDir]), /wrong-root\.jsonl/);
|
|
525
|
-
});
|
|
526
|
-
|
|
527
|
-
test("readMembers: a line matching NEITHER shape (no `type`, no Claude keys) is refused loudly too, not folded into a fabricated null record", () => {
|
|
528
|
-
// The blocklist half of assertOmpShaped (sessionId/parentUuid absence)
|
|
529
|
-
// only catches a Claude-shaped foreign line. A line that is foreign or
|
|
530
|
-
// corrupted in some OTHER way — missing omp's own `type` field entirely —
|
|
531
|
-
// used to pass that check silently and fold into an all-null/zero member
|
|
532
|
-
// record instead of the refusal the function's own comment promises.
|
|
533
|
-
const ompDir = ompSessionFixture("2026-09-09T02-00-00-000Z_deadbeef-dead-dead-dead-deadbeefdead", {});
|
|
534
|
-
writeFileSync(join(ompDir, "no-envelope.jsonl"), JSON.stringify({ foo: "bar" }) + "\n");
|
|
535
|
-
assert.throws(() => readMembers([ompDir]), /no-envelope\.jsonl/);
|
|
536
|
-
});
|
|
537
|
-
|
|
538
|
-
test("readMembers: a root holding no omp session directory anywhere is refused, not silently empty", () => {
|
|
539
|
-
const stray = tempDir("mr-stray-");
|
|
540
|
-
assert.throws(() => readMembers([stray]), /no omp session directory/);
|
|
541
|
-
});
|