@staix/agent-hub 0.48.1 → 0.48.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ Issue and pull request numbers in the entries for 0.7.7 and earlier refer to the
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## 0.48.2
8
+
9
+ - The daemon no longer stalls on a roadmap check, on task lists or on status (#1741, #1738). A roadmap check runs one working-tree spec check per call instead of two per GitHub issue it reads (about a second of synchronous git each). A task without a risk receipt no longer reads the whole board for each row of a task list. Status reuses the main checkout's branch answer while git's HEAD and origin/HEAD files are unchanged, instead of two git processes per request.
10
+ - A roadmap check rebuilds its milestone views only when a task, milestone, link or release changed during the check, instead of before and after every GitHub issue it reads (#1741). On a 1156-task board with 52 linked issues, one check fell from about 15 s of main-thread work and 107 whole-board reads to under 0.2 s and one. The transient allocation it caused is what kept the daemon's RSS high: its physical footprint stays small, and the rest is reclaimable heap pages.
11
+
7
12
  ## 0.48.1
8
13
 
9
14
  - A large board no longer blocks the daemon's event loop (#1738). The supervision round check, run every second and on every task change, skips its full board read while the board status revision, the conductor, the scope and the stored round are unchanged, and per-task supervision notices read one task instead of the whole board. The hub's own roadmap pass (the five-minute sweep and each task change's notice) reuses one working-tree spec check for up to 60 s instead of running one per `milestoneList` call. On a 1156-task board the two paths held the loop about 2.5 s of every 3 s and for 28-38 s every five minutes.
package/README.md CHANGED
@@ -5,7 +5,7 @@ Code, Codex, Kimi Code, Pi and a hub-owned local worker (plus Qwen Code, Jcode a
5
5
  Antigravity if you want them) share a message bus, a task board and a memory, each
6
6
  connected through its own native interface.
7
7
 
8
- Status: 0.48.1, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
8
+ Status: 0.48.2, control protocol 17 (accepts 16). Bun + TypeScript, one loopback daemon per
9
9
  project. Site: [agent-hub.staix.net](https://agent-hub.staix.net).
10
10
 
11
11
  Inspect bounded task and attempt metadata with `ahub lineage show`; admit external
@@ -49,6 +49,7 @@ Scope: the task flow, assignment, the state machine and the hub's MCP tools. Rea
49
49
  - A guard in `tasks.ts` or `conductor.ts` passes `preEffect` (throws `PreEffectToolRefusal`, `src/hub/tool-refusal.ts`) only before the operation's first board or hold write; a throw after a write, a readback failure or a wrapped error stays a plain `Error` (#254). The Pi side of the rule is in `adapters.md`.
50
50
  - Supervision reasons use structured enums, never history notes, check output or approval titles. Round signatures survive restart; later summaries count only newly joined tasks.
51
51
  - Supervision on a timer or per task change (#1738): `checkRound` skips the board read while its key (conductor, scope, `board.statusRevision()`, stored round) matches the last check that sent nothing, and it never keeps a key after a refused send. Per-task notices read through the `task(id)` port. Never add a `board.list()` to a supervision path that runs every second or on every task write.
52
+ - Roadmap check and task views (#1741): `roadmapCheck` takes one spec check per call and passes it to every `milestoneList` it runs; never let `current()` or a per-issue step start another, since an uncached working-tree check is about a second of synchronous git. `current()` rebuilds the views only when its board key (`statusRevision`, milestones, links, releases, the caller's planner role) moved; add any new input of `roadmapSnapshot` to that key; building them scans every board task's text. `riskViewFor` returns before `riskCards` when the task has no risk receipt for the head; a task list calls it once per row.
52
53
  - Supervision rules and proposals (#1362, #1368, #1374: `src/hub/supervision-rules.ts`, `src/hub/supervision-proposals.ts`): the reading stage has no effect path, `supervision-proposals.ts` reaches the board and bus only through ports, and a proposal runs its existing action only on an explicit `accept` by a present role with that action's own authority (`escalate`: conductor or person), never automatically and never retried; `Tasks.supervisionNotice` refuses a private task. Read `docs/design/supervision.md` before changing these paths.
53
54
  - Guidance variants (#1363, #1367, #1376: `src/hub/guidance-variants.ts`, `Tasks.guidanceVariant*`): lifecycle writes go only through `Tasks.guidanceVariantCreate` and `guidanceVariantWithdraw`; the `guidance_experiments` and `guidance_variants` tables are private local state, never copied into `Task`, refs, history, public views, bus notices or memory, and the guidance tools stay out of capture (`GUIDANCE_TOOL_NAMES`). Read `docs/design/guidance-experiments.md` before changing these paths.
54
55
 
@@ -308,7 +308,7 @@ A local milestone has at most one remote number per repository. R3's `milestone_
308
308
 
309
309
  `ahub roadmap export` renders deterministic JSON and Markdown from screened milestone views. `--write` writes only `docs/roadmap.md` and `docs/roadmap.json` in the caller's Git worktree after proving it shares the selected repository, enforcing its current deny, read-only and PII path policy and refusing symlinks or hardlinks. A partially completed two-file write is reported. `--issue <n> --apply --confirm <fingerprint>` updates that issue body only after a matching preview, under the same person/conductor policy. The fingerprint binds repository, issue and rendered body.
310
310
 
311
- Task state and merge changes schedule affected public milestones for an ids-only supervision notice. The existing five-minute merge-readback sweep rechecks unresolved findings, including the close-lag boundary. The hub's own pass reuses one working-tree spec check for up to 60 s across its milestone reads (#1738), so spec freshness in a finding can be up to a minute old. Reads by the person and peers check again. A durable marker suppresses a finding already delivered; an unavailable feed or evidence is retried on a later change or sweep. Private tasks are never named. `scripts/check-roadmap.mjs` is a standalone Node validator: it checks the generated JSON's schema, linked spec IDs and tracked spec paths, and checks known issue states when a GitHub token is available. `scripts/check.sh` and the hosted docs step run it. Only `docs/roadmap.md` is exempt from the documentation stamp because this validation covers the generated page; the standalone release docs checker retains its Node-only contract.
311
+ Task state and merge changes schedule affected public milestones for an ids-only supervision notice. The existing five-minute merge-readback sweep rechecks unresolved findings, including the close-lag boundary. The hub's own pass reuses one working-tree spec check for up to 60 s across its milestone reads (#1738), so spec freshness in a finding can be up to a minute old. Reads by the person and peers check again, once per read: a roadmap check keeps the one spec check it started with across all of its issue reads. A durable marker suppresses a finding already delivered; an unavailable feed or evidence is retried on a later change or sweep. Private tasks are never named. `scripts/check-roadmap.mjs` is a standalone Node validator: it checks the generated JSON's schema, linked spec IDs and tracked spec paths, and checks known issue states when a GitHub token is available. `scripts/check.sh` and the hosted docs step run it. Only `docs/roadmap.md` is exempt from the documentation stamp because this validation covers the generated page; the standalone release docs checker retains its Node-only contract.
312
312
 
313
313
  ## Dashboard and console surfaces (R5)
314
314
 
@@ -18,7 +18,7 @@ Or use the matching GitHub release:
18
18
 
19
19
  <!-- facts:install-tag -->
20
20
  ```bash
21
- bun add -g github:STAIxBWLB/agent-hub#v0.48.1
21
+ bun add -g github:STAIxBWLB/agent-hub#v0.48.2
22
22
  ahub setup
23
23
  ```
24
24
  <!-- /facts:install-tag -->
@@ -54,6 +54,12 @@ A project whose hub is stopped is upgraded without starting it: `ahub upgrade
54
54
  --all-stopped --to <version>` does that for every stopped project at once
55
55
  (`--dry-run` lists each one first).
56
56
 
57
+ ## Upgrading to 0.48.2
58
+
59
+ Nothing to do beyond the upgrade. The daemon stops stalling on roadmap checks, task lists and status (#1741). A roadmap check now runs one spec check and builds its milestone views once, unless the board changes during the check; before, it repeated both around every GitHub issue it read. A task list no longer reads the whole board for every row. Status no longer starts two git processes per request. The daemon's RSS also stays lower, because those repeats caused most of its transient allocation. 0.48.2 raises no store, sync or agent-mem floor.
60
+
61
+ `ahub upgrade` does not update the global CLI or the shared Claude plugin: run `bun add -g @staix/agent-hub@0.48.2` and then `ahub setup` yourself, and `ahub doctor` warns while either is older than a running daemon.
62
+
57
63
  ## Upgrading to 0.48.1
58
64
 
59
65
  Nothing to do beyond the upgrade. A hub on a large board stops blocking its event loop (#1738): the supervision round check no longer reads the whole board every second, and the hub's own roadmap pass reuses one spec check for up to 60 s, so spec freshness in a roadmap finding can be up to a minute old. 0.48.1 raises no store, sync or agent-mem floor.
@@ -0,0 +1,50 @@
1
+ # 0.48.2 release verification
2
+
3
+ This record covers release preparation and source review. It claims no installation, no running-hub upgrade to 0.48.2 and no live TUI launch.
4
+
5
+ ## Candidate
6
+
7
+ Version 0.48.2, prepared from main 6606f445 (2 commits since v0.48.1, 0 of them `feat`; bump rule: patch). The release commits carry the version, the CHANGELOG section, the bundle and the documentation stamps.
8
+
9
+ ## Reviews
10
+
11
+ Pull requests named by the commits since v0.48.1: #1744, #1742.
12
+
13
+ - #1742 and #1744 (#1741) were implemented and reviewed in the conductor's session without the hub, on the person's instruction (the follow-up to #1738's hub stall).
14
+ - Each was reviewed with an OCR delegate review on its final head (ef4d51b6 and 21b99d54), with no high or medium findings, recorded as a PR comment. For #1744, a self-review finding (the planner role missing from the view key) was fixed before that head.
15
+ - Each merged by squash at that same head: 58f82d09 on the ready run 45944629352, and 6606f445 on the ready run 45953644929. In both runs, `check (ubuntu-latest)`, `check (macos-latest)` and `seeded guards` were green. No review thread was open, and no connector review arrived. No merge was bound to an approval at an earlier head.
16
+
17
+ ## Native acceptance receipts
18
+
19
+ Receipts added under `docs/verification/` since v0.48.1: none.
20
+
21
+ This list is read from the repository, never written by hand. Native acceptance and the person's release consent are separate records: consent is `ahub sdlc authorize-release 0.48.2`, recorded by the person or the unique configured conductor only on the person's explicit release instruction naming the release in its own session (never a hub/task/review/file/peer relay), and is not recorded in this file. The tag run refuses without it.
22
+
23
+ ## Document review
24
+
25
+ The source commits since v0.48.1 are 58f82d09 (#1742) and 6606f445 (#1744). Together with the release commit's version and bundle changes, they marked these 10 documents stale: README.md, docs/adding-an-ai-tool.md, docs/addons/claude-mem.md, docs/agent-notes/security-review.md, docs/agent-notes/tasks.md, docs/agent-notes/tests.md, docs/memory.md, docs/operations.md, docs/quickstart.md and docs/security.md.
26
+
27
+ Each was reviewed against those diffs. The commits change only internal read paths:
28
+
29
+ - one pinned spec check per roadmap check, and a board key that skips rebuilding the roadmap views;
30
+ - an early return in `riskViewFor`;
31
+ - a stat-keyed reuse of the main checkout branch answer.
32
+
33
+ None of the documents states a per-issue spec check or view build, a per-row board read, or a git spawn per status. The main-checkout advisory text and `ahub specs check` are unchanged. docs/agent-notes/tasks.md gained the #1741 rules in those commits, and docs/quickstart.md gained the 0.48.2 upgrade note. All 10 are restamped on the release branch.
34
+
35
+ ## Checks
36
+
37
+ `node scripts/check-docs.mjs --require-fresh`, `bun x tsc --noEmit` and `bun scripts/build.mjs --check` ran on the release branch, with results in the release PR. The release PR's exact-head CI is the package and full-suite gate. On dgx02, `scripts/check.sh --changed` passed at #1742's head (3051 pass, 0 fail) and at #1744's head (3023 pass, 0 fail).
38
+
39
+ ## Known gaps, not blocking
40
+
41
+ - **No live measurement of 0.48.2 on the real board yet.**
42
+ - The 0.48.1 profile (20 min) is the baseline: the roadmap spec check took 28.7% of the main thread, task views 12.6% and the main checkout git probe 6.6%.
43
+ - Offline, on a copy of this board (1156 tasks, 52 linked issues), one roadmap check fell from about 15 s and 107 whole-board reads to 176 ms and one.
44
+ - #1741 and #1738 stay open until a run on 0.48.2 is clean.
45
+ - **Memory.**
46
+ - The running agent-hwp hub on 0.48.1 showed a 124 MB physical footprint against 971 MB RSS; 781 MB of the RSS was reclaimable JSC heap pages.
47
+ - An idle 0.48.1 heap profile held 23 MB of JS heap.
48
+ - RSS is the high-water mark of transient allocation, which these fixes reduce. No retained-object leak was found.
49
+ - The 2.2 GB RSS right after start was not reproduced offline: it needs the real `~/.agenthub` data. Recheck it with `footprint` on 0.48.2.
50
+ - **agent-mem sync placement** (11% of the 0.48.1 profile) belongs to that repository and is not changed here.
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "documents": {
4
4
  "README.md": {
5
- "verifiedAgainst": "19b5ae2859acd182d43d7bb3441ee19d9f15981a",
5
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
6
6
  "paths": [
7
7
  "package.json",
8
8
  "src/",
@@ -11,14 +11,14 @@
11
11
  ]
12
12
  },
13
13
  "docs/security.md": {
14
- "verifiedAgainst": "4ef41748e0ae28e1f2854eac0c4d317e199971c0",
14
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
15
15
  "paths": [
16
16
  "src/",
17
17
  "templates/"
18
18
  ]
19
19
  },
20
20
  "docs/operations.md": {
21
- "verifiedAgainst": "19b5ae2859acd182d43d7bb3441ee19d9f15981a",
21
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
22
22
  "paths": [
23
23
  "package.json",
24
24
  "src/",
@@ -35,7 +35,7 @@
35
35
  ]
36
36
  },
37
37
  "docs/quickstart.md": {
38
- "verifiedAgainst": "d7c733817dbfc2c640d3749a921a7f9e5eda1fbd",
38
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
39
39
  "paths": [
40
40
  "package.json",
41
41
  "src/",
@@ -43,7 +43,7 @@
43
43
  ]
44
44
  },
45
45
  "docs/adding-an-ai-tool.md": {
46
- "verifiedAgainst": "19b5ae2859acd182d43d7bb3441ee19d9f15981a",
46
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
47
47
  "paths": [
48
48
  "src/adapters/registry-types.ts",
49
49
  "src/adapters/registry.ts",
@@ -62,7 +62,7 @@
62
62
  ]
63
63
  },
64
64
  "docs/addons/claude-mem.md": {
65
- "verifiedAgainst": "19b5ae2859acd182d43d7bb3441ee19d9f15981a",
65
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
66
66
  "paths": [
67
67
  "src/hub/tooling.ts",
68
68
  "src/adapters/definitions/native-policy-aux.ts",
@@ -189,7 +189,7 @@
189
189
  ]
190
190
  },
191
191
  "docs/memory.md": {
192
- "verifiedAgainst": "19b5ae2859acd182d43d7bb3441ee19d9f15981a",
192
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
193
193
  "paths": [
194
194
  "package.json",
195
195
  "src/memory/",
@@ -488,7 +488,7 @@
488
488
  ]
489
489
  },
490
490
  "docs/agent-notes/tasks.md": {
491
- "verifiedAgainst": "4ef41748e0ae28e1f2854eac0c4d317e199971c0",
491
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
492
492
  "paths": [
493
493
  "src/hub/tasks.ts",
494
494
  "src/hub/board.ts",
@@ -539,7 +539,7 @@
539
539
  ]
540
540
  },
541
541
  "docs/agent-notes/tests.md": {
542
- "verifiedAgainst": "4ef41748e0ae28e1f2854eac0c4d317e199971c0",
542
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
543
543
  "paths": [
544
544
  "test/",
545
545
  "scripts/check.sh",
@@ -596,7 +596,7 @@
596
596
  ]
597
597
  },
598
598
  "docs/agent-notes/security-review.md": {
599
- "verifiedAgainst": "4ef41748e0ae28e1f2854eac0c4d317e199971c0",
599
+ "verifiedAgainst": "ada52f8d4dd718b96d45089ce176f86139a6dd43",
600
600
  "paths": [
601
601
  "src/hub/envelope.ts",
602
602
  "src/hub/conductor.ts",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staix/agent-hub",
3
- "version": "0.48.1",
3
+ "version": "0.48.2",
4
4
  "description": "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-hub",
3
- "version": "0.48.1",
3
+ "version": "0.48.2",
4
4
  "description": "Channel between Claude Code and the agent-hub daemon: peer messages from Codex, Kimi and the local worker arrive as channel events; hub_send replies.",
5
5
  "author": {
6
6
  "name": "Young Joon Lee",
@@ -14817,7 +14817,7 @@ var package_default;
14817
14817
  var init_package = __esm(() => {
14818
14818
  package_default = {
14819
14819
  name: "@staix/agent-hub",
14820
- version: "0.48.1",
14820
+ version: "0.48.2",
14821
14821
  description: "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
14822
14822
  license: "MIT",
14823
14823
  type: "module",
@@ -14799,7 +14799,7 @@ var package_default;
14799
14799
  var init_package = __esm(() => {
14800
14800
  package_default = {
14801
14801
  name: "@staix/agent-hub",
14802
- version: "0.48.1",
14802
+ version: "0.48.2",
14803
14803
  description: "Native multi-agent hub: Claude Code, Codex, Kimi Code, Pi and local inference as peers in one project",
14804
14804
  license: "MIT",
14805
14805
  type: "module",
@@ -1,3 +1,5 @@
1
+ import { statSync } from "node:fs";
2
+ import { join } from "node:path";
1
3
  import { childEnv } from "./child-process.ts";
2
4
  import { hubGitSync } from "./git.ts";
3
5
 
@@ -9,7 +11,33 @@ import { hubGitSync } from "./git.ts";
9
11
  */
10
12
  const git = (cwd: string, args: string[]) => hubGitSync(["-C", cwd, ...args], { encoding: "utf8", env: childEnv(process.env), maxBuffer: 64 * 1024, timeout: 3000 });
11
13
 
12
- export function mainCheckoutBranch(cwd: string): { branch: string; defaultBranch: string } | undefined {
14
+ type CheckoutBranch = { branch: string; defaultBranch: string } | undefined;
15
+ const stamp = (path: string): string => { try { const s = statSync(path); return `${s.ino}:${s.mtimeMs}:${s.size}`; } catch { return "-"; } };
16
+ let lastCheckout: { cwd: string; dirs: { git: string; common: string }; key: string; value: CheckoutBranch } | undefined;
17
+
18
+ /**
19
+ * #1741: status asks on every write and every control request, and each answer was two git spawns. The answer is reused while HEAD,
20
+ * origin/HEAD and a reftable repository's table list keep the same inode, mtime and size; git replaces each of them through a lock file and a
21
+ * rename. The git directories are resolved once per cwd, and a cwd that is not a repository is asked every time.
22
+ */
23
+ export function mainCheckoutBranch(cwd: string): CheckoutBranch {
24
+ let dirs = lastCheckout?.cwd === cwd ? lastCheckout.dirs : undefined;
25
+ if (!dirs) {
26
+ try {
27
+ const found = git(cwd, ["rev-parse", "--path-format=absolute", "--absolute-git-dir", "--git-common-dir"]);
28
+ const [gitDir, common] = found.status === 0 && typeof found.stdout === "string" ? found.stdout.split("\n") : [];
29
+ if (gitDir && common) dirs = { git: gitDir, common };
30
+ } catch { /* not a repository: no reuse */ }
31
+ }
32
+ if (!dirs) return readCheckoutBranch(cwd);
33
+ const key = [stamp(join(dirs.git, "HEAD")), stamp(join(dirs.common, "refs/remotes/origin/HEAD")), stamp(join(dirs.common, "reftable/tables.list"))].join("|");
34
+ if (lastCheckout?.cwd === cwd && lastCheckout.key === key) return lastCheckout.value;
35
+ const value = readCheckoutBranch(cwd);
36
+ lastCheckout = { cwd, dirs, key, value };
37
+ return value;
38
+ }
39
+
40
+ function readCheckoutBranch(cwd: string): CheckoutBranch {
13
41
  try {
14
42
  const head = git(cwd, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
15
43
  if (head.status !== 0 || typeof head.stdout !== "string" || !head.stdout.trim()) return undefined;
package/src/hub/tasks.ts CHANGED
@@ -3795,9 +3795,13 @@ export class Tasks {
3795
3795
  return report;
3796
3796
  }
3797
3797
 
3798
- private roadmapSnapshot(by: PeerId): RoadmapSnapshot {
3798
+ private roadmapSpecsFor(by: PeerId): SpecsCheckReport | SpecsCoverReport | undefined {
3799
+ return by === HUB ? this.roadmapSpecsCheck() : this.d.specsRead?.("check", []);
3800
+ }
3801
+
3802
+ private roadmapSnapshot(by: PeerId, specs = () => this.roadmapSpecsFor(by)): RoadmapSnapshot {
3799
3803
  let freshness: SpecsCheckReport["freshness"] | undefined;
3800
- try { const report = by === HUB ? this.roadmapSpecsCheck() : this.d.specsRead?.("check", []); if (report && "freshness" in report && !report.truncated && report.errors === 0)
3804
+ try { const report = specs(); if (report && "freshness" in report && !report.truncated && report.errors === 0)
3801
3805
  freshness = report.freshness.filter(row => this.publicMetadataText(row.path) && (row.id === undefined || this.publicMetadataText(row.id))); } catch { /* unavailable evidence stays unknown */ }
3802
3806
  return { milestones: this.d.board.milestones(), links: this.d.board.milestoneLinks(), tasks: this.d.board.list(), releases: this.d.board.releases(), freshness,
3803
3807
  issueOf: task => { try { const source = this.planIssueIdentity(task); return source ? `${source.repo.toLowerCase()}#${source.issue}` : undefined; } catch { return undefined; } },
@@ -3806,9 +3810,9 @@ export class Tasks {
3806
3810
  };
3807
3811
  }
3808
3812
 
3809
- milestoneList(by: PeerId): (MilestoneView & { tree: TreeRollup; readyToClose: ReadyToClose })[] {
3813
+ milestoneList(by: PeerId, specs?: () => SpecsCheckReport | SpecsCoverReport | undefined): (MilestoneView & { tree: TreeRollup; readyToClose: ReadyToClose })[] {
3810
3814
  this.roadmapReadAuthority(by);
3811
- const views = withTree(milestoneViews(this.roadmapSnapshot(by)));
3815
+ const views = withTree(milestoneViews(this.roadmapSnapshot(by, specs)));
3812
3816
  this.roadmapReadAuthority(by); return views;
3813
3817
  }
3814
3818
 
@@ -3861,10 +3865,19 @@ export class Tasks {
3861
3865
  /** Build drift only from the same screened views and host-owned evidence as roadmap reads. */
3862
3866
  async roadmapCheck(by: PeerId, include?: (finding: RoadmapDrift) => boolean): Promise<ReturnType<typeof checkRoadmap>> {
3863
3867
  const check = this.requestCheck(by); check(); this.roadmapReadAuthority(by);
3864
- const views = this.milestoneList(by), config = this.d.roadmapConfig?.() ?? { github_mirror: false, github_write: "off" as const }, privacy = JSON.stringify([this.d.routing(), this.d.piiPaths, this.d.deny]);
3868
+ // #1741: one spec check per roadmap check. current() rebuilds the views before and after every issue read, and an uncached working-tree check is a
3869
+ // synchronous git per spec path (about a second on this repository), so it ran up to 200 times per call. A thrown check is kept as unavailable.
3870
+ let pinned: { report: SpecsCheckReport | SpecsCoverReport | undefined } | undefined;
3871
+ const specs = () => { if (!pinned) { pinned = { report: undefined }; pinned.report = this.roadmapSpecsFor(by); } return pinned.report; };
3872
+ const boardKey = () => JSON.stringify([this.d.board.statusRevision(), this.d.board.milestones(), this.d.board.milestoneLinks(), this.d.board.releases(), this.isConfiguredPlanner(by)]);
3873
+ let checkedKey = boardKey(); // taken before the views, so a write between the two is compared, not skipped
3874
+ const views = this.milestoneList(by, specs), config = this.d.roadmapConfig?.() ?? { github_mirror: false, github_write: "off" as const }, privacy = JSON.stringify([this.d.routing(), this.d.piiPaths, this.d.deny]);
3865
3875
  const snapshot = (rows: typeof views) => JSON.stringify([rows, rows.flatMap(view => view.tasks.map(member => this.d.board.get(member.id)))]);
3866
3876
  const evidence = snapshot(views);
3867
- const current = () => { check(); this.roadmapReadAuthority(by); if (snapshot(this.milestoneList(by)) !== evidence || JSON.stringify(this.d.roadmapConfig?.() ?? { github_mirror: false, github_write: "off" }) !== JSON.stringify(config) || JSON.stringify([this.d.routing(), this.d.piiPaths, this.d.deny]) !== privacy) throw new PreEffectToolRefusal("roadmap or privacy policy changed while checking; retry ahub roadmap check"); };
3877
+ // #1741: building the views runs issueOf over every board task (a regex scan of its text), about 140 ms on a 1156-task board, and current() runs before
3878
+ // and after each issue read. Rebuild only when a task write (statusRevision), a milestone, link or release row, or the caller's planner role (it screens backlog tasks) says the views can differ; config and privacy are compared on every call below.
3879
+ const sameViews = () => { const key = boardKey(); if (key === checkedKey) return true; if (snapshot(this.milestoneList(by, specs)) !== evidence) return false; checkedKey = key; return true; };
3880
+ const current = () => { check(); this.roadmapReadAuthority(by); if (!sameViews() || JSON.stringify(this.d.roadmapConfig?.() ?? { github_mirror: false, github_write: "off" }) !== JSON.stringify(config) || JSON.stringify([this.d.routing(), this.d.piiPaths, this.d.deny]) !== privacy) throw new PreEffectToolRefusal("roadmap or privacy policy changed while checking; retry ahub roadmap check"); };
3868
3881
  const rendered = roadmapExport(views), exportStates: (boolean | undefined)[] = [];
3869
3882
  for (const [path, expected] of [["docs/roadmap.json", rendered.json], ["docs/roadmap.md", rendered.markdown]] as const) {
3870
3883
  try {
@@ -9061,6 +9074,8 @@ export class Tasks {
9061
9074
  * retroactive, because the verdict that already passed is a statement about the board it saw.
9062
9075
  */
9063
9076
  private riskViewFor(task: Task, head: string | undefined): RiskView | undefined {
9077
+ // #1741: riskView answers undefined without a receipt for this head, so skip the whole-board card read. A task list renders one view per row.
9078
+ if (!task.sdlc?.risk || task.sdlc.risk.head !== head) return undefined;
9064
9079
  const repo = task.sdlc?.repo ?? task.refs.repo;
9065
9080
  return riskView(task.sdlc?.risk, this.riskCards(), { ...(repo ? { repo } : {}), ...(task.refs.branch ? { branch: task.refs.branch } : {}), head, implementer: task.owner });
9066
9081
  }