@scotthuang/agent-knock-knock 0.13.18 → 0.14.1

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.
Files changed (289) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/CONTRIBUTING.md +212 -0
  3. package/README.md +106 -166
  4. package/connectors/deepseek-harness/LICENSE +21 -0
  5. package/connectors/deepseek-harness/README.md +406 -0
  6. package/connectors/pi/LICENSE +21 -0
  7. package/connectors/pi/README.md +446 -0
  8. package/dist/src/backend-public-progress.d.ts +38 -0
  9. package/dist/src/backend-public-progress.js +106 -0
  10. package/dist/src/backend-public-progress.js.map +1 -0
  11. package/dist/src/backend-recovery-semantic.d.ts +16 -0
  12. package/dist/src/backend-recovery-semantic.js +113 -0
  13. package/dist/src/backend-recovery-semantic.js.map +1 -0
  14. package/dist/src/backend-task-recovery.d.ts +103 -0
  15. package/dist/src/backend-task-recovery.js +143 -0
  16. package/dist/src/backend-task-recovery.js.map +1 -0
  17. package/dist/src/callback-transport.d.ts +8 -0
  18. package/dist/src/callback-transport.js +14 -0
  19. package/dist/src/callback-transport.js.map +1 -1
  20. package/dist/src/cli-core.js +20 -10
  21. package/dist/src/cli-core.js.map +1 -1
  22. package/dist/src/cli-runtime-context.d.ts +5 -0
  23. package/dist/src/cli-runtime-context.js.map +1 -1
  24. package/dist/src/codex-app-server-read-client.d.ts +3 -0
  25. package/dist/src/codex-app-server-read-client.js.map +1 -1
  26. package/dist/src/codex-native-cli-adapter.d.ts +6 -0
  27. package/dist/src/codex-native-cli-adapter.js +303 -0
  28. package/dist/src/codex-native-cli-adapter.js.map +1 -0
  29. package/dist/src/codex-native-client-interactions.d.ts +6 -0
  30. package/dist/src/codex-native-client-interactions.js +124 -0
  31. package/dist/src/codex-native-client-interactions.js.map +1 -0
  32. package/dist/src/codex-native-client-rpc.d.ts +21 -0
  33. package/dist/src/codex-native-client-rpc.js +137 -0
  34. package/dist/src/codex-native-client-rpc.js.map +1 -0
  35. package/dist/src/codex-native-client.d.ts +42 -0
  36. package/dist/src/codex-native-client.js +331 -0
  37. package/dist/src/codex-native-client.js.map +1 -0
  38. package/dist/src/codex-native-identity.d.ts +6 -0
  39. package/dist/src/codex-native-identity.js +42 -0
  40. package/dist/src/codex-native-identity.js.map +1 -0
  41. package/dist/src/codex-native-monitor.d.ts +4 -0
  42. package/dist/src/codex-native-monitor.js +92 -0
  43. package/dist/src/codex-native-monitor.js.map +1 -0
  44. package/dist/src/codex-native-outbox.d.ts +16 -0
  45. package/dist/src/codex-native-outbox.js +120 -0
  46. package/dist/src/codex-native-outbox.js.map +1 -0
  47. package/dist/src/codex-native-public-projection.d.ts +545 -0
  48. package/dist/src/codex-native-public-projection.js +182 -0
  49. package/dist/src/codex-native-public-projection.js.map +1 -0
  50. package/dist/src/codex-native-record-store.d.ts +27 -0
  51. package/dist/src/codex-native-record-store.js +111 -0
  52. package/dist/src/codex-native-record-store.js.map +1 -0
  53. package/dist/src/codex-native-response-service.d.ts +69 -0
  54. package/dist/src/codex-native-response-service.js +244 -0
  55. package/dist/src/codex-native-response-service.js.map +1 -0
  56. package/dist/src/codex-native-runtime.d.ts +46 -0
  57. package/dist/src/codex-native-runtime.js +112 -0
  58. package/dist/src/codex-native-runtime.js.map +1 -0
  59. package/dist/src/codex-native-semantic.d.ts +17 -0
  60. package/dist/src/codex-native-semantic.js +175 -0
  61. package/dist/src/codex-native-semantic.js.map +1 -0
  62. package/dist/src/codex-native-snapshot.d.ts +19 -0
  63. package/dist/src/codex-native-snapshot.js +160 -0
  64. package/dist/src/codex-native-snapshot.js.map +1 -0
  65. package/dist/src/codex-native-state-store.d.ts +61 -0
  66. package/dist/src/codex-native-state-store.js +132 -0
  67. package/dist/src/codex-native-state-store.js.map +1 -0
  68. package/dist/src/codex-native-task-service.d.ts +71 -0
  69. package/dist/src/codex-native-task-service.js +503 -0
  70. package/dist/src/codex-native-task-service.js.map +1 -0
  71. package/dist/src/codex-native-types.d.ts +92 -0
  72. package/dist/src/codex-native-types.js +15 -0
  73. package/dist/src/codex-native-types.js.map +1 -0
  74. package/dist/src/conversation-list.d.ts +12 -0
  75. package/dist/src/conversation-list.js +30 -0
  76. package/dist/src/conversation-list.js.map +1 -0
  77. package/dist/src/conversation-route-dispatch.d.ts +13 -0
  78. package/dist/src/conversation-route-dispatch.js +66 -0
  79. package/dist/src/conversation-route-dispatch.js.map +1 -0
  80. package/dist/src/conversation-route-legacy.d.ts +18 -0
  81. package/dist/src/conversation-route-legacy.js +54 -0
  82. package/dist/src/conversation-route-legacy.js.map +1 -0
  83. package/dist/src/conversation-route-store.d.ts +51 -0
  84. package/dist/src/conversation-route-store.js +126 -0
  85. package/dist/src/conversation-route-store.js.map +1 -0
  86. package/dist/src/conversation-routing-cli-adapter.d.ts +12 -0
  87. package/dist/src/conversation-routing-cli-adapter.js +211 -0
  88. package/dist/src/conversation-routing-cli-adapter.js.map +1 -0
  89. package/dist/src/conversation-routing-commands.d.ts +11 -0
  90. package/dist/src/conversation-routing-commands.js +85 -0
  91. package/dist/src/conversation-routing-commands.js.map +1 -0
  92. package/dist/src/conversation-routing-home.d.ts +26 -0
  93. package/dist/src/conversation-routing-home.js +105 -0
  94. package/dist/src/conversation-routing-home.js.map +1 -0
  95. package/dist/src/conversation-routing-identity.d.ts +40 -0
  96. package/dist/src/conversation-routing-identity.js +174 -0
  97. package/dist/src/conversation-routing-identity.js.map +1 -0
  98. package/dist/src/conversation-runtime-route-store.d.ts +11 -0
  99. package/dist/src/conversation-runtime-route-store.js +118 -0
  100. package/dist/src/conversation-runtime-route-store.js.map +1 -0
  101. package/dist/src/desktop-async-interactions.d.ts +15 -0
  102. package/dist/src/desktop-async-interactions.js +88 -0
  103. package/dist/src/desktop-async-interactions.js.map +1 -0
  104. package/dist/src/desktop-async-state.d.ts +5 -0
  105. package/dist/src/desktop-async-state.js +53 -0
  106. package/dist/src/desktop-async-state.js.map +1 -0
  107. package/dist/src/desktop-cli-adapter.d.ts +7 -0
  108. package/dist/src/desktop-cli-adapter.js +343 -0
  109. package/dist/src/desktop-cli-adapter.js.map +1 -0
  110. package/dist/src/desktop-cli-controls.d.ts +9 -0
  111. package/dist/src/desktop-cli-controls.js +45 -0
  112. package/dist/src/desktop-cli-controls.js.map +1 -0
  113. package/dist/src/desktop-command-presentation.d.ts +2 -0
  114. package/dist/src/desktop-command-presentation.js +31 -0
  115. package/dist/src/desktop-command-presentation.js.map +1 -0
  116. package/dist/src/desktop-control-semantic.d.ts +8 -0
  117. package/dist/src/desktop-control-semantic.js +68 -0
  118. package/dist/src/desktop-control-semantic.js.map +1 -0
  119. package/dist/src/desktop-identity.d.ts +5 -0
  120. package/dist/src/desktop-identity.js +40 -0
  121. package/dist/src/desktop-identity.js.map +1 -0
  122. package/dist/src/desktop-interaction-projection.d.ts +57 -0
  123. package/dist/src/desktop-interaction-projection.js +196 -0
  124. package/dist/src/desktop-interaction-projection.js.map +1 -0
  125. package/dist/src/desktop-interaction-state.d.ts +3 -0
  126. package/dist/src/desktop-interaction-state.js +48 -0
  127. package/dist/src/desktop-interaction-state.js.map +1 -0
  128. package/dist/src/desktop-ipc-async-answer.d.ts +9 -0
  129. package/dist/src/desktop-ipc-async-answer.js +71 -0
  130. package/dist/src/desktop-ipc-async-answer.js.map +1 -0
  131. package/dist/src/desktop-ipc-client.d.ts +47 -0
  132. package/dist/src/desktop-ipc-client.js +400 -0
  133. package/dist/src/desktop-ipc-client.js.map +1 -0
  134. package/dist/src/desktop-ipc-native-operations.d.ts +11 -0
  135. package/dist/src/desktop-ipc-native-operations.js +126 -0
  136. package/dist/src/desktop-ipc-native-operations.js.map +1 -0
  137. package/dist/src/desktop-ipc-transport.d.ts +13 -0
  138. package/dist/src/desktop-ipc-transport.js +123 -0
  139. package/dist/src/desktop-ipc-transport.js.map +1 -0
  140. package/dist/src/desktop-list.d.ts +25 -0
  141. package/dist/src/desktop-list.js +55 -0
  142. package/dist/src/desktop-list.js.map +1 -0
  143. package/dist/src/desktop-metadata-reader.d.ts +30 -0
  144. package/dist/src/desktop-metadata-reader.js +182 -0
  145. package/dist/src/desktop-metadata-reader.js.map +1 -0
  146. package/dist/src/desktop-monitor.d.ts +4 -0
  147. package/dist/src/desktop-monitor.js +101 -0
  148. package/dist/src/desktop-monitor.js.map +1 -0
  149. package/dist/src/desktop-public-projection.d.ts +6 -0
  150. package/dist/src/desktop-public-projection.js +134 -0
  151. package/dist/src/desktop-public-projection.js.map +1 -0
  152. package/dist/src/desktop-request-interactions.d.ts +14 -0
  153. package/dist/src/desktop-request-interactions.js +144 -0
  154. package/dist/src/desktop-request-interactions.js.map +1 -0
  155. package/dist/src/desktop-response-dispatch.d.ts +14 -0
  156. package/dist/src/desktop-response-dispatch.js +19 -0
  157. package/dist/src/desktop-response-dispatch.js.map +1 -0
  158. package/dist/src/desktop-response-evidence.d.ts +4 -0
  159. package/dist/src/desktop-response-evidence.js +19 -0
  160. package/dist/src/desktop-response-evidence.js.map +1 -0
  161. package/dist/src/desktop-response-service.d.ts +11 -0
  162. package/dist/src/desktop-response-service.js +188 -0
  163. package/dist/src/desktop-response-service.js.map +1 -0
  164. package/dist/src/desktop-response-store.d.ts +35 -0
  165. package/dist/src/desktop-response-store.js +58 -0
  166. package/dist/src/desktop-response-store.js.map +1 -0
  167. package/dist/src/desktop-response-types.d.ts +20 -0
  168. package/dist/src/desktop-response-types.js +2 -0
  169. package/dist/src/desktop-response-types.js.map +1 -0
  170. package/dist/src/desktop-response-value.d.ts +6 -0
  171. package/dist/src/desktop-response-value.js +31 -0
  172. package/dist/src/desktop-response-value.js.map +1 -0
  173. package/dist/src/desktop-runtime.d.ts +153 -0
  174. package/dist/src/desktop-runtime.js +88 -0
  175. package/dist/src/desktop-runtime.js.map +1 -0
  176. package/dist/src/desktop-semantic.d.ts +21 -0
  177. package/dist/src/desktop-semantic.js +140 -0
  178. package/dist/src/desktop-semantic.js.map +1 -0
  179. package/dist/src/desktop-session-catalog.d.ts +68 -0
  180. package/dist/src/desktop-session-catalog.js +225 -0
  181. package/dist/src/desktop-session-catalog.js.map +1 -0
  182. package/dist/src/desktop-session-controls.d.ts +145 -0
  183. package/dist/src/desktop-session-controls.js +176 -0
  184. package/dist/src/desktop-session-controls.js.map +1 -0
  185. package/dist/src/desktop-sidebar-metadata.d.ts +27 -0
  186. package/dist/src/desktop-sidebar-metadata.js +83 -0
  187. package/dist/src/desktop-sidebar-metadata.js.map +1 -0
  188. package/dist/src/desktop-sidebar-projects.d.ts +10 -0
  189. package/dist/src/desktop-sidebar-projects.js +31 -0
  190. package/dist/src/desktop-sidebar-projects.js.map +1 -0
  191. package/dist/src/desktop-sidebar-selection.d.ts +28 -0
  192. package/dist/src/desktop-sidebar-selection.js +85 -0
  193. package/dist/src/desktop-sidebar-selection.js.map +1 -0
  194. package/dist/src/desktop-snapshot-details.d.ts +4 -0
  195. package/dist/src/desktop-snapshot-details.js +116 -0
  196. package/dist/src/desktop-snapshot-details.js.map +1 -0
  197. package/dist/src/desktop-snapshot.d.ts +11 -0
  198. package/dist/src/desktop-snapshot.js +281 -0
  199. package/dist/src/desktop-snapshot.js.map +1 -0
  200. package/dist/src/desktop-state-store.d.ts +72 -0
  201. package/dist/src/desktop-state-store.js +269 -0
  202. package/dist/src/desktop-state-store.js.map +1 -0
  203. package/dist/src/desktop-task-interactions.d.ts +10 -0
  204. package/dist/src/desktop-task-interactions.js +93 -0
  205. package/dist/src/desktop-task-interactions.js.map +1 -0
  206. package/dist/src/desktop-task-recovery.d.ts +38 -0
  207. package/dist/src/desktop-task-recovery.js +172 -0
  208. package/dist/src/desktop-task-recovery.js.map +1 -0
  209. package/dist/src/desktop-task-service.d.ts +54 -0
  210. package/dist/src/desktop-task-service.js +442 -0
  211. package/dist/src/desktop-task-service.js.map +1 -0
  212. package/dist/src/desktop-types.d.ts +283 -0
  213. package/dist/src/desktop-types.js +13 -0
  214. package/dist/src/desktop-types.js.map +1 -0
  215. package/dist/src/host-monitor-reconciliation.js +36 -4
  216. package/dist/src/host-monitor-reconciliation.js.map +1 -1
  217. package/dist/src/host-profile-runtime.js +7 -3
  218. package/dist/src/host-profile-runtime.js.map +1 -1
  219. package/dist/src/local-codex-cli-adapter.d.ts +7 -0
  220. package/dist/src/local-codex-cli-adapter.js +13 -0
  221. package/dist/src/local-codex-cli-adapter.js.map +1 -0
  222. package/dist/src/monitor-deadline-policy.d.ts +8 -0
  223. package/dist/src/monitor-deadline-policy.js +16 -0
  224. package/dist/src/monitor-deadline-policy.js.map +1 -0
  225. package/dist/src/openclaw-callback-transport.js +2 -1
  226. package/dist/src/openclaw-callback-transport.js.map +1 -1
  227. package/dist/src/semantic-conversation-target.d.ts +4 -0
  228. package/dist/src/semantic-conversation-target.js +20 -0
  229. package/dist/src/semantic-conversation-target.js.map +1 -0
  230. package/dist/src/semantic-permission-control.js +47 -9
  231. package/dist/src/semantic-permission-control.js.map +1 -1
  232. package/dist/src/semantic-private-authority-offers.d.ts +1 -1
  233. package/dist/src/semantic-private-authority-offers.js +3 -1
  234. package/dist/src/semantic-private-authority-offers.js.map +1 -1
  235. package/dist/src/semantic-tool-command-helpers.d.ts +6 -0
  236. package/dist/src/semantic-tool-command-helpers.js +199 -78
  237. package/dist/src/semantic-tool-command-helpers.js.map +1 -1
  238. package/dist/src/semantic-tool-descriptions.d.ts +2 -1
  239. package/dist/src/semantic-tool-descriptions.js +84 -35
  240. package/dist/src/semantic-tool-descriptions.js.map +1 -1
  241. package/dist/src/semantic-tool-list-projection.js +66 -2
  242. package/dist/src/semantic-tool-list-projection.js.map +1 -1
  243. package/dist/src/semantic-tool-presentation.js +76 -7
  244. package/dist/src/semantic-tool-presentation.js.map +1 -1
  245. package/dist/src/semantic-tool-runtime.js +129 -29
  246. package/dist/src/semantic-tool-runtime.js.map +1 -1
  247. package/dist/src/semantic-tool-schemas.d.ts +410 -27
  248. package/dist/src/semantic-tool-schemas.js +176 -88
  249. package/dist/src/semantic-tool-schemas.js.map +1 -1
  250. package/dist/src/terminal-action-contracts.js +10 -6
  251. package/dist/src/terminal-action-contracts.js.map +1 -1
  252. package/dist/src/terminal-command-cli-adapter.js +4 -4
  253. package/dist/src/terminal-command-cli-adapter.js.map +1 -1
  254. package/dist/src/terminal-command-dispatch-preparation.js +2 -1
  255. package/dist/src/terminal-command-dispatch-preparation.js.map +1 -1
  256. package/dist/src/terminal-list-cli-adapter.d.ts +1 -0
  257. package/dist/src/terminal-list-cli-adapter.js +6 -3
  258. package/dist/src/terminal-list-cli-adapter.js.map +1 -1
  259. package/dist/src/terminal-monitor-decision-policy.d.ts +1 -1
  260. package/dist/src/terminal-monitor-launch-plan.js +3 -2
  261. package/dist/src/terminal-monitor-launch-plan.js.map +1 -1
  262. package/dist/src/terminal-monitor-supervision-cli-adapter.js +2 -2
  263. package/dist/src/terminal-monitor-supervision-cli-adapter.js.map +1 -1
  264. package/dist/src/terminal-submission-retry-reconciliation.js +2 -2
  265. package/dist/src/terminal-submission-retry-reconciliation.js.map +1 -1
  266. package/dist/src/terminal-user-send-intent.d.ts +2 -0
  267. package/dist/src/terminal-user-send-intent.js +11 -3
  268. package/dist/src/terminal-user-send-intent.js.map +1 -1
  269. package/dist/src/terminal-watch-cli-adapter.js +4 -4
  270. package/dist/src/terminal-watch-cli-adapter.js.map +1 -1
  271. package/docs/architecture/current-architecture.md +313 -0
  272. package/docs/architecture/interactive-terminal-response.md +276 -0
  273. package/docs/architecture/issue-126-final-report.md +248 -0
  274. package/docs/architecture/orchestration-refactor-history.md +2987 -0
  275. package/docs/architecture/orchestration-refactor.md +21 -0
  276. package/docs/backend-task-recovery.md +98 -0
  277. package/docs/bidirectional-agent-protocol.md +260 -0
  278. package/docs/codex-cli-native-compatibility.md +246 -0
  279. package/docs/codex-desktop-compatibility.md +414 -0
  280. package/docs/openclaw-operations.md +281 -0
  281. package/docs/openclaw-session-turn-delivery-requirement.md +45 -0
  282. package/docs/operator-guide.md +572 -0
  283. package/docs/storage-and-logging.md +91 -0
  284. package/docs/test-performance-issue-108.md +80 -0
  285. package/docs/test-performance-issue-120.md +226 -0
  286. package/docs/testing.md +628 -0
  287. package/openclaw.plugin.json +8 -4
  288. package/package.json +6 -13
  289. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +66 -15
@@ -0,0 +1,80 @@
1
+ # Test performance report for Issue #108
2
+
3
+ This report was recorded on the same maintainer machine on 2026-08-08 with
4
+ Node.js v24.18.0 on Darwin arm64. Both profiles used the checked-in JSON
5
+ reporter, the same warm shared Node compile-cache mode, and all 698 runtime
6
+ tests. The source checkout was dirty only because the profiling implementation
7
+ and sharding were the changes under measurement.
8
+
9
+ ## Summary
10
+
11
+ | Profile | Files | Tests | Concurrency | Result | Wall time | Change |
12
+ | --- | ---: | ---: | ---: | --- | ---: | ---: |
13
+ | Before: one serial `agent-cli.test.ts` | 49 | 698 | Node default | pass | 513.96 s | baseline |
14
+ | Sharded peak throughput | 59 | 698 | Node default | pass | 240.13 s | -53.3% |
15
+ | Final stable default | 59 | 698 | 4 | pass | 301.05 s | -41.4% |
16
+
17
+ The peak-throughput run demonstrated the benefit of sharding, but repeated
18
+ stress runs at concurrency 8 and 6 starved nested CLI/fake-terminal processes:
19
+ test-only 30-second child deadlines fired, and terminal submission fixtures
20
+ could cross production's real bounded deadline. Those runs were rejected even
21
+ though they were faster. The final runner caps concurrency at four and permits
22
+ an explicit `AKK_TEST_CONCURRENCY` override for controlled experiments.
23
+
24
+ The inner loop is separate: the final fast tier contains 27 files and 374 tests
25
+ and completes in under 10 seconds on the same machine.
26
+
27
+ ## Critical path before
28
+
29
+ | File | Tests | Worker duration |
30
+ | --- | ---: | ---: |
31
+ | `test/agent-cli.test.ts` | 69 | 512.91 s |
32
+ | `test/codex-no-rollout-binding-cli.test.ts` | 17 | 167.41 s |
33
+ | `test/native-thread-lifecycle-recovery-cli.test.ts` | 19 | 149.46 s |
34
+ | `test/codex-sticky-rollout-lifecycle-cli.test.ts` | 1 | 124.47 s |
35
+ | `test/native-thread-lifecycle-cli.test.ts` | 1 | 49.19 s |
36
+ | `test/callback-cli.test.ts` | 30 | 46.35 s |
37
+
38
+ The 69 `agent-cli` runtime tests were serialized in one 12,149-line file. The
39
+ refactor moved the exact unchanged test bodies into 11 process-isolated shards;
40
+ their concatenated source hash and runtime count match the original.
41
+
42
+ ## Critical path after
43
+
44
+ | File | Tests | Worker duration |
45
+ | --- | ---: | ---: |
46
+ | `test/codex-no-rollout-binding-cli.test.ts` | 17 | 167.75 s |
47
+ | `test/native-thread-lifecycle-recovery-cli.test.ts` | 19 | 144.00 s |
48
+ | `test/codex-sticky-rollout-lifecycle-cli.test.ts` | 1 | 119.09 s |
49
+ | Slowest `test/shards/agent-cli-*.test.ts` worker | 5 | 55.74 s |
50
+ | `test/native-thread-lifecycle-cli.test.ts` | 1 | 44.10 s |
51
+ | `test/callback-cli.test.ts` | 30 | 35.57 s |
52
+
53
+ ## Why the stable full suite remains above 180 seconds
54
+
55
+ The remaining top three files are real process gates, not obsolete duplicate
56
+ coverage. They repeatedly launch the built CLI plus fake `tmux`, `ps`, `lsof`,
57
+ and SQLite processes to preserve virgin attach/reconcile behavior, exact native
58
+ recovery fences, sticky rollout handling, WAL/checkpoint behavior, and fail-
59
+ closed identity checks. A separate serial verification of only
60
+ `native-thread-lifecycle-recovery-cli.test.ts` and the receipt-fence shard took
61
+ 180.08 seconds for 24 passing tests. That pair alone consumes the issue target
62
+ before the other 674 tests run.
63
+
64
+ Reaching a stable full-suite wall below 180 seconds therefore requires a second
65
+ architectural step: inject CLI handlers/providers and clocks for semantic cases,
66
+ split the sticky lifecycle state chain into independent Store-seeded scenarios,
67
+ and retain a thin black-box process layer. This PR intentionally does not delete
68
+ those recent regression fences, shorten production timing windows, disable
69
+ process isolation, or force-exit child processes merely to hit the number.
70
+
71
+ ## Reproduce
72
+
73
+ ```bash
74
+ npm run test:profile -- --output /tmp/akk-profile.json
75
+ AKK_TEST_CONCURRENCY=8 npm run test:profile -- --output /tmp/akk-profile-c8.json
76
+ ```
77
+
78
+ The JSON contains metadata, totals, every file and test duration, slowest tests,
79
+ and full failure stacks. Compare runs only on the same machine, Node version,
80
+ concurrency, and compile-cache mode.
@@ -0,0 +1,226 @@
1
+ # Test performance report for Issue #120
2
+
3
+ This report records the second test-performance phase described by Issue #120.
4
+ Measurements are comparable only when they use the same maintainer machine,
5
+ Node.js version, file concurrency, and warm compile-cache mode. The v0.11.7
6
+ baseline and final profiles were measured on 2026-08-10 with Node.js v24.18.0
7
+ on Darwin arm64, concurrency 4, and a warm shared compile cache.
8
+
9
+ ## Baseline
10
+
11
+ | Measurement | v0.11.7 baseline |
12
+ | --- | ---: |
13
+ | Test files | 61 |
14
+ | Runtime tests | 769 |
15
+ | Full `npm test` wall time | 432.31 s |
16
+ | Node test duration | 430.99 s |
17
+ | Fast tier | 28 files / 435 tests / 6.94 s including build |
18
+ | Integration tier | 33 files / 334 tests / approximately 98% of wall time |
19
+
20
+ The count itself was not the bottleneck. The 435-test fast tier completed in
21
+ under seven seconds; repeated CLI processes, fake terminal/process/SQLite
22
+ commands, and real polling or composer-settle windows dominated the full run.
23
+ Increasing file concurrency was not used because the concurrency 6/8 results
24
+ from Issue #108 produced nested-process starvation and false bounded-timeout
25
+ failures.
26
+
27
+ ## Critical-path migration inventory
28
+
29
+ | Test family | Before | Migrated shape | Focused after median | Change |
30
+ | --- | ---: | --- | ---: | ---: |
31
+ | `native-thread-lifecycle-recovery-cli.test.ts` | 19 tests / approximately 174 s | 17 in-process semantic cases + 2 process goldens | 25.224 s | -85.5% |
32
+ | `codex-no-rollout-binding-cli.test.ts` | 21 tests / 167.75 s | 18 in-process semantic cases + 3 process goldens | 41.366 s | -75.3% |
33
+ | Sticky rollout lifecycle | 1 stateful process scenario / 119.09 s | 7 independent Store-seeded core cases + 1 process golden | 32.016 s | -73.1% |
34
+
35
+ The sticky semantic cases now live in
36
+ `codex-sticky-rollout-lifecycle-core.test.ts`; the retained executable contract
37
+ remains in `codex-sticky-rollout-lifecycle-cli.test.ts`. The migration changes
38
+ the execution layer, not the safety assertions.
39
+
40
+ The three focused final samples were 25.224/26.437/24.810 seconds for recovery,
41
+ 41.706/41.366/41.264 seconds for no-rollout binding, and
42
+ 32.046/32.016/31.405 seconds for sticky lifecycle. Earlier development checks
43
+ reached 24.36 seconds and 38.33 seconds for the first two families; those
44
+ one-off values are not substituted for the final repeated medians.
45
+
46
+ ## Injectable command boundary
47
+
48
+ The emitted `src/cli.ts` entry is now limited to parsing `process.argv`, calling
49
+ the command core, forwarding stdout, and applying the returned/fatal exit
50
+ status. `src/cli-core.ts` exports `parseCliCommand` and `executeCliCommand`.
51
+ Importing that module does not inspect argv, run a command, write output, or
52
+ exit the process; a dedicated child-process import probe preserves that
53
+ contract.
54
+
55
+ `executeCliCommand` scopes injected dependencies to one asynchronous execution.
56
+ The available seams include:
57
+
58
+ - terminal provider registry and terminal process source;
59
+ - Codex session/rollout and native lifecycle providers plus Claude agent rows;
60
+ - running-agent version and process-birth observations;
61
+ - cwd, environment, pid, wall/monotonic clocks, async/synchronous sleep;
62
+ - stdout, exit handling, and runtime logging.
63
+
64
+ The in-process fixtures use recording terminal providers, mutable process
65
+ snapshots, explicit agent identity adapters, and virtual time. Production
66
+ parsing, lifecycle policy, Store/CAS code, bridge sequencing, and error
67
+ classification still execute; tests no longer pay for a fresh Node CLI plus
68
+ fake executables for every semantic branch.
69
+
70
+ ## Semantic coverage moved in-process
71
+
72
+ ### Native lifecycle recovery
73
+
74
+ The in-process matrix retains:
75
+
76
+ - exact-before rollback and exact-after roll-forward without replaying the
77
+ native lifecycle command;
78
+ - source/target ownership conflicts, target CAS conflict, and partial-detach
79
+ prevention;
80
+ - composer clear failure, non-empty composer refusal, and stale status-screen
81
+ rejection;
82
+ - status-only recorded-before recovery and verified candidate inode drift;
83
+ - third-identity quarantine, later exact-after recovery, and direct recovery
84
+ before a raw send creates one Turn;
85
+ - Codex resolver failure and no-rollout evidence handling;
86
+ - Claude exact-before rollback, third-identity quarantine, ambiguous exact-PID
87
+ rows, and target ownership conflicts.
88
+
89
+ ### Virgin/no-rollout Codex binding
90
+
91
+ The in-process matrix retains:
92
+
93
+ - rejected production preflight cleanup, rollout discovery races, attach setup
94
+ failure, and proved text-dispatch failure before any task input;
95
+ - fenced New/Resume availability after a rejected virgin attach;
96
+ - provisional-orphan reconciliation, external native-thread drift, and PID
97
+ reuse behavior;
98
+ - ambiguous/unverifiable ownership, status-card/rollout disagreement, process
99
+ birth mismatch, and exact status-card binding refinement;
100
+ - suppression of reconcile while Turns, transitions, or dispatch ledgers are
101
+ unresolved;
102
+ - unmanaged lifecycle-token freshness and restorable-origin live-gate fences;
103
+ - native status inspection snapshot, composer, Store-mutation, version, busy
104
+ state, and post-injection process-drift fences.
105
+
106
+ ### Sticky rollout lifecycle
107
+
108
+ The former 1,488-line chained scenario is split into independently seeded
109
+ cases for:
110
+
111
+ - draft rejection both before probing and before lifecycle mutation;
112
+ - A -> New B isolation and exact transition/dispatch-ledger commitment;
113
+ - B send rejection on drafts or wrong status, followed by exact B rollout
114
+ materialization with no A leakage;
115
+ - snapshot-bound `previous` navigation A -> B without creating a Turn;
116
+ - B -> New C companion-root handling and exact C materialization;
117
+ - monitor stall handling while preserving the active C binding; and
118
+ - fail-closed behavior for an unknown fourth open rollout without Store or
119
+ terminal mutation.
120
+
121
+ ## Retained black-box process contracts
122
+
123
+ The following process tests are intentional. Each proves a boundary that the
124
+ in-process layer does not replace:
125
+
126
+ | Domain | Retained executable contract |
127
+ | --- | --- |
128
+ | CLI import/entry | Importing the core is side-effect free; existing CLI UX coverage retains executable argv, output, redaction, and exit behavior. |
129
+ | Virgin Codex attach | The emitted CLI wires real command adapters for tmux/process/SQLite, sends the exact text/Enter vectors, and persists matching Session/Turn binding generations. |
130
+ | Prepared lifecycle crash | A real CLI process exits with the deliberate code 86 after the prepared fence, preserving executable failure classification and recoverable state. |
131
+ | Codex native inspection | The emitted CLI materializes `/status`, waits across the real 121 ms suppression boundary, sends exactly one Enter, redacts status output, and creates no Store artifacts. |
132
+ | Codex recovery | One dispatching exact-before case proves executable wiring, `C-u` composer clearing, `/status` probing, rollback, and no lifecycle replay. |
133
+ | Claude recovery | One submitted exact-after case proves the emitted CLI uses Claude identity evidence to roll the binding forward without replay. |
134
+ | Sticky rollout | One emitted CLI + tmux/process/SQLite-adapter A -> B -> A path proves `/clear`, snapshot-bound previous selection, exact `/resume <uuid>`, and no Turn creation. |
135
+
136
+ Real SQLite WAL/checkpoint, filesystem-lock, Store protocol, compatibility, and
137
+ other process-boundary suites remain in their existing domain files. They were
138
+ not converted or deleted merely to improve this profile.
139
+
140
+ ## Fail-closed affected-test workflow
141
+
142
+ `npm run test:affected` is a build-once local feedback command. It reads NUL-safe
143
+ Git path output and, when supplied, an explicit comparison base:
144
+
145
+ ```bash
146
+ npm run test:affected
147
+ npm run test:affected -- --base origin/main
148
+ ```
149
+
150
+ For a known change it runs the complete fast tier, then the exact mapped
151
+ integration manifest entries. A changed integration test selects itself; a
152
+ fast test or documentation-only change adds no integration worker. Branch
153
+ commits, staged/unstaged work, and untracked files are included when an explicit
154
+ base is used.
155
+
156
+ Selection fails closed to `test:full` when:
157
+
158
+ - the Git diff/base cannot be read or resolved;
159
+ - a mapped test is absent from the integration manifest;
160
+ - a changed path is unknown; or
161
+ - exact Store/protocol, shared production kernel, selector, or architecture
162
+ authority changes.
163
+
164
+ Normal production domains select at most five integration witnesses. Known
165
+ test helpers add their transitive integration consumers. Tier-manifest changes
166
+ require an additive, same-diff content proof, and package plus lockfile changes
167
+ require a synchronized version-only proof; all other manifest semantics remain
168
+ full.
169
+
170
+ The full tier itself contains the complete fast and integration manifests, so
171
+ the fast tier is never omitted. `test:affected` narrows local feedback only;
172
+ `npm test` remains mandatory for merge and release verification.
173
+
174
+ ## Compatibility and safety retained
175
+
176
+ This refactor does not change production timing windows or default test
177
+ concurrency, and it does not weaken or remove:
178
+
179
+ - full native UUID, fresh snapshot/candidate token, binding generation, CAS,
180
+ pane/PID/process-birth, cwd, ownership, and capability fences from #87;
181
+ - no-input versus submission-uncertain classification, composer
182
+ clearing/materialization, or single-Enter evidence;
183
+ - exact-before, exact-after, third-identity, candidate inode, PID ownership,
184
+ reconcile-suppression, and sticky/multiple-root behavior;
185
+ - opt-in #88 native Codex and Claude lifecycle live smoke;
186
+ - Store protocol/migration and v0.11.x artifact compatibility; or
187
+ - Codex 0.146.x/0.147.0 and Claude Code 2.1.218/2.1.226 coverage.
188
+
189
+ No supported product behavior or version contract was removed as test cleanup.
190
+
191
+ ## Final repeated profile
192
+
193
+ Three successful profiles used the same machine, Node.js v24.18.0, concurrency
194
+ 4, and warm compile-cache mode. The profile JSON reports Node test-runner
195
+ duration, so the comparison below uses the baseline Node duration rather than
196
+ mixing it with shell/build wall time.
197
+
198
+ | Measurement | Run 1 | Run 2 | Run 3 | Median |
199
+ | --- | ---: | ---: | ---: | ---: |
200
+ | Files / tests | 65 / 789 | 65 / 789 | 65 / 789 | 65 / 789 |
201
+ | Result | pass | pass | pass | pass |
202
+ | Profile-reported duration | 269.048 s | 262.413 s | 261.837 s | **262.413 s** |
203
+
204
+ The median is 39.1% below the 430.99-second baseline Node duration even though
205
+ the suite grew by four files and 20 tests. A separate ordinary `npm test`
206
+ validation passed 789/789 with 265.392 seconds reported by Node and 266.65
207
+ seconds shell wall time. The final fast tier passed 454/454 in 7.048 seconds of
208
+ Node duration and 8.3 seconds including its build, remaining below the
209
+ 10-second limit.
210
+
211
+ Reproduction commands:
212
+
213
+ ```bash
214
+ npm run test:profile -- --output /tmp/akk-120-profile-1.json
215
+ npm run test:profile -- --output /tmp/akk-120-profile-2.json
216
+ npm run test:profile -- --output /tmp/akk-120-profile-3.json
217
+ npm run test:fast
218
+ ```
219
+
220
+ Phase A is achieved: the stable three-run median is 262.413 seconds, 37.587
221
+ seconds inside the 300-second ceiling, and the fast tier remains below 10
222
+ seconds. Phase B is not achieved by this change. Reaching a stable median at or
223
+ below 180 seconds remains follow-up work on repeated semantic subprocesses in
224
+ the agent CLI shards and other process-heavy integration domains. That work
225
+ must preserve the black-box contracts above; it must not be hidden by increased
226
+ concurrency, shorter production waits, or removed safety coverage.