The introduction of vyos-op-run causes a false negative in the in_session test when running under vyos-http-api via the vyatta-op-cmd-wrapper. For example, the generate function will not be able to take advantage of the install_into_config functionality in the op-mode pki script. This can be addressed by injecting the appropriate env variable in vyos-op-run, after ruling out a possible simpler bug in execution:
curl -k -X POST -d '{"key": "baz", "op": "generate", "path": ["pki", "wireguard", "key-pair", "install", "interface", "wg0"]}' https://192.168.122.31/generate
{"success": true, "data": "You are not in configure mode, commands to install manually from configure mode:\nset interfaces wireguard wg0 private-key 'UP3TXQCoexDTDnbmuNdjzR/y1HjQUFAnJs9tyVpzh1k='\nCorresponding public-key to use on peer system is: '8ER4u63NkO489Rcm9zY2BOs6bkADFnVjL2G8bdN3LDM='\n", "error": null}