pi-harness-runtime 1.1.472 → 1.1.474
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 +103 -0
- package/harness/honcho-init.ts +46 -4
- package/harness/mcp-connector.ts +95 -9
- package/harness/service-diagnostics.ts +8 -1
- package/index.ts +79 -6
- package/package.json +1 -1
- package/packages/agent-policy/package.json +1 -1
- package/packages/auth/package.json +1 -1
- package/packages/autonomous-runtime/package.json +1 -1
- package/packages/checkpoint/package.json +1 -1
- package/packages/clipboard/package.json +1 -1
- package/packages/codex-watcher/package.json +1 -1
- package/packages/config-capture/package.json +1 -1
- package/packages/contracts/package.json +1 -1
- package/packages/cookie-sanitizer/package.json +1 -1
- package/packages/evaluation-engine/package.json +1 -1
- package/packages/event-bus/package.json +1 -1
- package/packages/event-store/package.json +1 -1
- package/packages/experience-replay/package.json +1 -1
- package/packages/file-copy-helper/package.json +1 -1
- package/packages/intent-analyzer/package.json +1 -1
- package/packages/jev-judge/package.json +1 -1
- package/packages/knowledge-retrieval/package.json +1 -1
- package/packages/learning-engine/package.json +1 -1
- package/packages/logging/package.json +1 -1
- package/packages/memory-engine/package.json +1 -1
- package/packages/notification/package.json +1 -1
- package/packages/paperclip-integration/package.json +1 -1
- package/packages/performance-optimizer/package.json +1 -1
- package/packages/privilege-broker/package.json +1 -1
- package/packages/prompt-compiler/package.json +1 -1
- package/packages/providers/package.json +1 -1
- package/packages/qdrant-skills/package.json +1 -1
- package/packages/quota-manager/package.json +1 -1
- package/packages/relay/package.json +1 -1
- package/packages/skill-mcp-client/package.json +1 -1
- package/packages/skills/package.json +1 -1
- package/packages/todo-bd-sync/package.json +1 -1
- package/packages/token-estimation/package.json +1 -1
- package/packages/tooling-preference/package.json +1 -1
- package/packages/trajectory/package.json +1 -1
- package/packages/tui/package.json +1 -1
- package/packages/two-phase-review/package.json +1 -1
- package/packages/types/package.json +1 -1
- package/packages/webmcp-tester/package.json +1 -1
- package/packages/wiki/package.json +1 -1
- package/packages/write-review/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,109 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [1.1.474](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.474) (2026-11-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
11
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
12
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
13
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
14
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
15
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
16
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
17
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
18
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
19
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
20
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
21
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
22
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
23
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
24
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
25
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
26
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### Bug Fixes
|
|
30
|
+
|
|
31
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
32
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
33
|
+
* **honcho:** a probe that the end of the session cuts off is not a failure ([493fd93](https://github.com/ManotLuijiu/pi-harness-runtime/commit/493fd938ba09fdcf57bed4aaf259d81c4040909e))
|
|
34
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
35
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
36
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
37
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
38
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
39
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
40
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
41
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
42
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
43
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
44
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
45
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
46
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
47
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
48
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
49
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
50
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
51
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
52
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
53
|
+
* **workspace:** a strong bench signal decides, and the question is not a fact of an option ([303a828](https://github.com/ManotLuijiu/pi-harness-runtime/commit/303a828f55aa7c4e0a611231f482489b530ff5a3))
|
|
54
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
55
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
56
|
+
|
|
57
|
+
### [1.1.473](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.473) (2026-11-08)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
### Features
|
|
61
|
+
|
|
62
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
63
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
64
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
65
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
66
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
67
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
68
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
69
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
70
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
71
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
72
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
73
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
74
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
75
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
76
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
77
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
78
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
### Bug Fixes
|
|
82
|
+
|
|
83
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
84
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
85
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
86
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
87
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
88
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
89
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
90
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
91
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
92
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
93
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
94
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
95
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
96
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
97
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
98
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
99
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
100
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
101
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
102
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
103
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
104
|
+
* **workspace:** a strong bench signal decides, and the question is not a fact of an option ([303a828](https://github.com/ManotLuijiu/pi-harness-runtime/commit/303a828f55aa7c4e0a611231f482489b530ff5a3))
|
|
105
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
106
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
107
|
+
|
|
5
108
|
### [1.1.472](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.472) (2026-11-08)
|
|
6
109
|
|
|
7
110
|
|
package/harness/honcho-init.ts
CHANGED
|
@@ -44,7 +44,8 @@ export type HonchoInitStatus =
|
|
|
44
44
|
| "ready"
|
|
45
45
|
| "missing_key"
|
|
46
46
|
| "mcp_unavailable"
|
|
47
|
-
| "registration_rejected"
|
|
47
|
+
| "registration_rejected"
|
|
48
|
+
| "session_ended";
|
|
48
49
|
|
|
49
50
|
export interface HonchoInitResult {
|
|
50
51
|
/** What happened. */
|
|
@@ -1280,11 +1281,13 @@ function isTimeoutOutcome(
|
|
|
1280
1281
|
type CredentialVerdict =
|
|
1281
1282
|
| { verdict: "accepted" }
|
|
1282
1283
|
| { verdict: "rejected"; reason: string; httpStatus?: number }
|
|
1283
|
-
| { verdict: "unavailable"; reason: string }
|
|
1284
|
+
| { verdict: "unavailable"; reason: string }
|
|
1285
|
+
| { verdict: "session_ended" };
|
|
1284
1286
|
|
|
1285
1287
|
async function probeCredential(
|
|
1286
1288
|
client: HonchoMcpClient,
|
|
1287
|
-
timeoutMs: number = CREDENTIAL_PROBE_TIMEOUT_MS
|
|
1289
|
+
timeoutMs: number = CREDENTIAL_PROBE_TIMEOUT_MS,
|
|
1290
|
+
isSessionEnded?: () => boolean
|
|
1288
1291
|
): Promise<CredentialVerdict> {
|
|
1289
1292
|
const persisted = loadPersistedWorkspace();
|
|
1290
1293
|
const workspaceId = persisted?.workspaceId ?? DEFAULT_WORKSPACE_NAME;
|
|
@@ -1314,6 +1317,12 @@ async function probeCredential(
|
|
|
1314
1317
|
...(status ? { httpStatus: status } : {}),
|
|
1315
1318
|
};
|
|
1316
1319
|
}
|
|
1320
|
+
// The session may have ended while the probe was running. The client
|
|
1321
|
+
// of the session is closed then, and the closed connection is not a
|
|
1322
|
+
// refusal of the server: there was no session left to ask.
|
|
1323
|
+
if (isSessionEnded?.()) {
|
|
1324
|
+
return { verdict: "session_ended" };
|
|
1325
|
+
}
|
|
1317
1326
|
// The probe did not get an answer. A workspace that does not exist is
|
|
1318
1327
|
// answered with a result (the server creates it), so an exception here
|
|
1319
1328
|
// is a transport failure - never a proof that the credential is good.
|
|
@@ -1330,6 +1339,9 @@ async function probeCredential(
|
|
|
1330
1339
|
|
|
1331
1340
|
if (isTimeoutOutcome(outcome)) {
|
|
1332
1341
|
controller.abort();
|
|
1342
|
+
if (isSessionEnded?.()) {
|
|
1343
|
+
return { verdict: "session_ended" };
|
|
1344
|
+
}
|
|
1333
1345
|
return {
|
|
1334
1346
|
verdict: "unavailable",
|
|
1335
1347
|
reason: `the server did not answer the credential probe within ${timeoutMs}ms`,
|
|
@@ -1382,6 +1394,13 @@ export async function initHoncho(options?: {
|
|
|
1382
1394
|
loadMcpLibrary?: HonchoMcpLibraryLoader;
|
|
1383
1395
|
/** The timeout of the credential probe. The tests shorten it. */
|
|
1384
1396
|
probeTimeoutMs?: number;
|
|
1397
|
+
/**
|
|
1398
|
+
* Whether the session is over.
|
|
1399
|
+
*
|
|
1400
|
+
* A probe that runs while the session ends is cut off by the closing of
|
|
1401
|
+
* the session, and the cut-off connection says nothing about the server.
|
|
1402
|
+
*/
|
|
1403
|
+
isSessionEnded?: () => boolean;
|
|
1385
1404
|
}): Promise<HonchoInitResult> {
|
|
1386
1405
|
const result = await runInit(options);
|
|
1387
1406
|
// The diagnostics commands report the outcome of the last attempt, so
|
|
@@ -1407,6 +1426,8 @@ async function runInit(options?: {
|
|
|
1407
1426
|
createClient?: HonchoMcpClientFactory;
|
|
1408
1427
|
loadMcpLibrary?: HonchoMcpLibraryLoader;
|
|
1409
1428
|
probeTimeoutMs?: number;
|
|
1429
|
+
/** Whether the session is over. The probe then stops with it. */
|
|
1430
|
+
isSessionEnded?: () => boolean;
|
|
1410
1431
|
}): Promise<HonchoInitResult> {
|
|
1411
1432
|
if (_disposed) {
|
|
1412
1433
|
logServiceEvent({ ts: new Date().toISOString(), level: "error", service: "honcho", operation: "dispose", phase: "failed", reason: "integration has been disposed, cannot reinitialize" });
|
|
@@ -1524,7 +1545,28 @@ async function runInit(options?: {
|
|
|
1524
1545
|
|
|
1525
1546
|
// The handshake does not check the credential: the verdict arrives with
|
|
1526
1547
|
// the first tool call. The probe asks for it, with a short timeout.
|
|
1527
|
-
const probe = await probeCredential(
|
|
1548
|
+
const probe = await probeCredential(
|
|
1549
|
+
client,
|
|
1550
|
+
options?.probeTimeoutMs ?? CREDENTIAL_PROBE_TIMEOUT_MS,
|
|
1551
|
+
options?.isSessionEnded
|
|
1552
|
+
);
|
|
1553
|
+
if (probe.verdict === "session_ended") {
|
|
1554
|
+
// The session ended while the probe was running. The server was never
|
|
1555
|
+
// asked, so nothing is claimed about it.
|
|
1556
|
+
logServiceEvent({
|
|
1557
|
+
ts: new Date().toISOString(),
|
|
1558
|
+
level: "info",
|
|
1559
|
+
service: "honcho",
|
|
1560
|
+
operation: "credential_probe",
|
|
1561
|
+
phase: "ended",
|
|
1562
|
+
});
|
|
1563
|
+
await closeUnusedClient(client);
|
|
1564
|
+
return {
|
|
1565
|
+
status: "session_ended",
|
|
1566
|
+
memory: null,
|
|
1567
|
+
reason: "the session ended before the Honcho MCP was checked",
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1528
1570
|
if (probe.verdict === "rejected") {
|
|
1529
1571
|
logServiceEvent({ ts: new Date().toISOString(), level: "error", service: "honcho", operation: "credential_probe", phase: "failed", reason: redact(probe.reason) });
|
|
1530
1572
|
honchoStatus.setConnected(false);
|
package/harness/mcp-connector.ts
CHANGED
|
@@ -151,11 +151,13 @@ export interface McpServerStatus {
|
|
|
151
151
|
* - "skipped": another connector connected the server.
|
|
152
152
|
* - "failed": the connector could not connect the server, and the
|
|
153
153
|
* reason says why.
|
|
154
|
+
* - "ended": the session ended before the connection was made. The
|
|
155
|
+
* server was not refused; there was no session left to connect it to.
|
|
154
156
|
*/
|
|
155
|
-
state: "connected" | "skipped" | "failed";
|
|
157
|
+
state: "connected" | "skipped" | "failed" | "ended";
|
|
156
158
|
/** The names of the tools of the server. */
|
|
157
159
|
tools: string[];
|
|
158
|
-
/** The reason of a failure or of
|
|
160
|
+
/** The reason of a failure, of a skip or of an end. */
|
|
159
161
|
reason?: string;
|
|
160
162
|
}
|
|
161
163
|
|
|
@@ -167,6 +169,11 @@ export interface McpConnector {
|
|
|
167
169
|
readonly statuses: Map<string, McpServerStatus>;
|
|
168
170
|
/** Close the connections of the connector. */
|
|
169
171
|
close(): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Stop the connector: the session is over, so nothing that is still
|
|
174
|
+
* pending may touch the runtime any more.
|
|
175
|
+
*/
|
|
176
|
+
stop(): Promise<void>;
|
|
170
177
|
}
|
|
171
178
|
|
|
172
179
|
/** The default wait before the connector connects a server. */
|
|
@@ -407,6 +414,26 @@ export function createMcpConnector(
|
|
|
407
414
|
const log = options.log ?? ((): void => {});
|
|
408
415
|
const statuses = new Map<string, McpServerStatus>();
|
|
409
416
|
const clients = new Map<string, McpClientLike>();
|
|
417
|
+
/** Whether the session is over. A stopped connector touches nothing. */
|
|
418
|
+
let stopped = false;
|
|
419
|
+
/** The attempts that are running, so a server is connected only once. */
|
|
420
|
+
const inFlight = new Map<string, Promise<McpServerStatus>>();
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Whether the error says that the session the connector works in is
|
|
424
|
+
* gone.
|
|
425
|
+
*
|
|
426
|
+
* The runtime refuses every call through a session that was replaced or
|
|
427
|
+
* reloaded. The refusal is not a broken server: the connector was talking
|
|
428
|
+
* to a session that no longer exists, and the truth is that the session
|
|
429
|
+
* ended before the server was connected.
|
|
430
|
+
*
|
|
431
|
+
* @param message The message of the error
|
|
432
|
+
* @returns Whether the error names a session that is gone
|
|
433
|
+
*/
|
|
434
|
+
function isStaleSessionError(message: string): boolean {
|
|
435
|
+
return message.includes("ctx is stale") || message.includes("session replacement");
|
|
436
|
+
}
|
|
410
437
|
|
|
411
438
|
async function connectServer(
|
|
412
439
|
server: RegisteredMcpServerLike,
|
|
@@ -454,15 +481,45 @@ export function createMcpConnector(
|
|
|
454
481
|
} catch {
|
|
455
482
|
// The connection is already broken: the reason is the error.
|
|
456
483
|
}
|
|
484
|
+
if (stopped || isStaleSessionError(reason)) {
|
|
485
|
+
// The session is over. The server was not refused, and there
|
|
486
|
+
// was no session left to connect it to.
|
|
487
|
+
log(
|
|
488
|
+
`the session ended before the MCP server "${server.name}" was connected`,
|
|
489
|
+
);
|
|
490
|
+
return {
|
|
491
|
+
state: "ended",
|
|
492
|
+
tools: [],
|
|
493
|
+
reason: "the session ended before the connection was made",
|
|
494
|
+
};
|
|
495
|
+
}
|
|
457
496
|
log(`MCP server "${server.name}" could not be connected: ${reason}`);
|
|
458
497
|
return { state: "failed", tools: [], reason };
|
|
459
498
|
}
|
|
460
499
|
}
|
|
461
500
|
|
|
501
|
+
/**
|
|
502
|
+
* Close the connections of the connector.
|
|
503
|
+
*
|
|
504
|
+
* Only the connections the connector owns are closed. A connection of
|
|
505
|
+
* another connector is not in the map and stays untouched.
|
|
506
|
+
*/
|
|
507
|
+
async function closeClients(): Promise<void> {
|
|
508
|
+
for (const [name, client] of clients) {
|
|
509
|
+
try {
|
|
510
|
+
await client.close();
|
|
511
|
+
} catch {
|
|
512
|
+
// A broken connection needs no closing.
|
|
513
|
+
}
|
|
514
|
+
clients.delete(name);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
|
|
462
518
|
return {
|
|
463
519
|
statuses,
|
|
464
520
|
|
|
465
521
|
async connectPending(): Promise<void> {
|
|
522
|
+
if (stopped) return;
|
|
466
523
|
let servers: RegisteredMcpServerLike[] = [];
|
|
467
524
|
try {
|
|
468
525
|
servers = api.getMcpServers?.() ?? [];
|
|
@@ -482,6 +539,10 @@ export function createMcpConnector(
|
|
|
482
539
|
// Another connector may be at work. The wait gives it the time,
|
|
483
540
|
// and its work is visible in the tools of the session.
|
|
484
541
|
await delay(graceMs);
|
|
542
|
+
// The session may have ended during the wait. A connector that
|
|
543
|
+
// works on a session that is gone reports a failure that never
|
|
544
|
+
// happened, so the work stops here.
|
|
545
|
+
if (stopped) return;
|
|
485
546
|
for (const server of wanted) {
|
|
486
547
|
const known = statuses.get(server.name);
|
|
487
548
|
// A server that was connected is done, and a server that
|
|
@@ -500,19 +561,44 @@ export function createMcpConnector(
|
|
|
500
561
|
);
|
|
501
562
|
continue;
|
|
502
563
|
}
|
|
503
|
-
|
|
564
|
+
// Two calls may be at work (the start of the session and a
|
|
565
|
+
// change of the servers). The server is connected once: the
|
|
566
|
+
// second call waits for the attempt of the first one.
|
|
567
|
+
const running = inFlight.get(server.name);
|
|
568
|
+
if (running) {
|
|
569
|
+
statuses.set(server.name, await running);
|
|
570
|
+
continue;
|
|
571
|
+
}
|
|
572
|
+
const attempt = connectServer(server);
|
|
573
|
+
inFlight.set(server.name, attempt);
|
|
574
|
+
try {
|
|
575
|
+
statuses.set(server.name, await attempt);
|
|
576
|
+
} finally {
|
|
577
|
+
inFlight.delete(server.name);
|
|
578
|
+
}
|
|
504
579
|
}
|
|
505
580
|
},
|
|
506
581
|
|
|
507
582
|
async close(): Promise<void> {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
583
|
+
await closeClients();
|
|
584
|
+
},
|
|
585
|
+
|
|
586
|
+
async stop(): Promise<void> {
|
|
587
|
+
// The session is over. Nothing that is still pending may touch
|
|
588
|
+
// the runtime: the runtime refuses those calls, and the refusal
|
|
589
|
+
// would be read as a broken server.
|
|
590
|
+
stopped = true;
|
|
591
|
+
for (const [name, status] of statuses) {
|
|
592
|
+
if (status.state === "connected" || status.state === "skipped") {
|
|
593
|
+
continue;
|
|
513
594
|
}
|
|
514
|
-
|
|
595
|
+
statuses.set(name, {
|
|
596
|
+
state: "ended",
|
|
597
|
+
tools: [],
|
|
598
|
+
reason: "the session ended before the connection was made",
|
|
599
|
+
});
|
|
515
600
|
}
|
|
601
|
+
await closeClients();
|
|
516
602
|
},
|
|
517
603
|
};
|
|
518
604
|
}
|
|
@@ -20,7 +20,14 @@ export interface ServiceEvent {
|
|
|
20
20
|
level: ServiceLevel;
|
|
21
21
|
service: ServiceName;
|
|
22
22
|
operation: string;
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The phase of the operation.
|
|
25
|
+
*
|
|
26
|
+
* "ended" is for an operation that was cut off because the session it
|
|
27
|
+
* belonged to is over. It is neither a completion nor a failure of the
|
|
28
|
+
* thing the operation was about.
|
|
29
|
+
*/
|
|
30
|
+
phase: "start" | "completed" | "failed" | "ended";
|
|
24
31
|
sessionId?: string;
|
|
25
32
|
requestId?: string;
|
|
26
33
|
durationMs?: number;
|
package/index.ts
CHANGED
|
@@ -3682,7 +3682,10 @@ function initMcpConnector(pi: ExtensionAPI): void {
|
|
|
3682
3682
|
});
|
|
3683
3683
|
|
|
3684
3684
|
pi.on("session_shutdown", () => {
|
|
3685
|
-
|
|
3685
|
+
// The session is over. The connector stops: nothing that is still
|
|
3686
|
+
// pending may touch the runtime, because the runtime refuses those
|
|
3687
|
+
// calls and the refusal would be read as a broken server.
|
|
3688
|
+
void connector.stop().catch(() => {
|
|
3686
3689
|
// A broken connection needs no closing.
|
|
3687
3690
|
});
|
|
3688
3691
|
});
|
|
@@ -3706,6 +3709,8 @@ interface HonchoModule {
|
|
|
3706
3709
|
initHoncho: (options: {
|
|
3707
3710
|
apiKey?: string;
|
|
3708
3711
|
pi?: HonchoMcpRegistrar;
|
|
3712
|
+
/** Whether the session is over. The probe of the credential stops with it. */
|
|
3713
|
+
isSessionEnded?: () => boolean;
|
|
3709
3714
|
}) => Promise<HonchoInitResult>;
|
|
3710
3715
|
registerHonchoLifecycle: (pi: unknown) => void;
|
|
3711
3716
|
/** The credential: the environment wins over the key file. */
|
|
@@ -3756,6 +3761,24 @@ let mcpConnector: McpConnector | null = null;
|
|
|
3756
3761
|
*/
|
|
3757
3762
|
const HONCHO_MCP_SERVER_NAME = "honcho";
|
|
3758
3763
|
|
|
3764
|
+
/**
|
|
3765
|
+
* Whether the session is over.
|
|
3766
|
+
*
|
|
3767
|
+
* The work of a session stops with it. A work that is cut off by the end of
|
|
3768
|
+
* the session says nothing about the thing it was about: a closed
|
|
3769
|
+
* connection is not a refusal of a server that was never asked.
|
|
3770
|
+
*/
|
|
3771
|
+
let sessionEnded = false;
|
|
3772
|
+
|
|
3773
|
+
/**
|
|
3774
|
+
* The stop of the watcher of the Honcho tools.
|
|
3775
|
+
*
|
|
3776
|
+
* The watcher corrects the report of the startup while the session lives.
|
|
3777
|
+
* When the session ends, the watcher stops: a report that is corrected
|
|
3778
|
+
* after the end belongs to no session.
|
|
3779
|
+
*/
|
|
3780
|
+
let stopHonchoMcpWatcher: (() => void) | null = null;
|
|
3781
|
+
|
|
3759
3782
|
/**
|
|
3760
3783
|
* Correct the report when the tools of the Honcho server appear.
|
|
3761
3784
|
*
|
|
@@ -3763,11 +3786,23 @@ const HONCHO_MCP_SERVER_NAME = "honcho";
|
|
|
3763
3786
|
* the report of the startup is written before the connection happens. The
|
|
3764
3787
|
* wait is bounded and the report is only corrected when the tools are
|
|
3765
3788
|
* really there.
|
|
3789
|
+
*
|
|
3790
|
+
* The watcher stops when the session ends. A watcher that outlives the
|
|
3791
|
+
* session reads the tools of a session that is gone, and the runtime
|
|
3792
|
+
* refuses that read: the report would be corrected by a failure that
|
|
3793
|
+
* belongs to no session.
|
|
3794
|
+
*
|
|
3795
|
+
* @param pi The extension API
|
|
3796
|
+
* @param honcho The Honcho module
|
|
3797
|
+
* @returns The stop of the watcher
|
|
3766
3798
|
*/
|
|
3767
|
-
function watchHonchoMcpTools(pi: ExtensionAPI, honcho: HonchoModule): void {
|
|
3799
|
+
function watchHonchoMcpTools(pi: ExtensionAPI, honcho: HonchoModule): () => void {
|
|
3768
3800
|
const registrar = pi as unknown as HonchoMcpRegistrar;
|
|
3769
3801
|
const deadline = Date.now() + HONCHO_MCP_WAIT_MS;
|
|
3802
|
+
let timer: ReturnType<typeof setTimeout> | undefined;
|
|
3803
|
+
let stopped = false;
|
|
3770
3804
|
const check = (): void => {
|
|
3805
|
+
if (stopped) return;
|
|
3771
3806
|
const state = honcho.honchoMcpState(registrar, true);
|
|
3772
3807
|
if (state === "connected") {
|
|
3773
3808
|
logStartup("[pi-harness] Honcho: native MCP server connected");
|
|
@@ -3791,11 +3826,19 @@ function watchHonchoMcpTools(pi: ExtensionAPI, honcho: HonchoModule): void {
|
|
|
3791
3826
|
}
|
|
3792
3827
|
return;
|
|
3793
3828
|
}
|
|
3794
|
-
const
|
|
3795
|
-
if (typeof
|
|
3829
|
+
const next = setTimeout(check, HONCHO_MCP_WAIT_INTERVAL_MS);
|
|
3830
|
+
if (typeof next.unref === "function") next.unref();
|
|
3831
|
+
timer = next;
|
|
3796
3832
|
};
|
|
3797
|
-
|
|
3833
|
+
timer = setTimeout(check, HONCHO_MCP_WAIT_INTERVAL_MS);
|
|
3798
3834
|
if (typeof timer.unref === "function") timer.unref();
|
|
3835
|
+
return () => {
|
|
3836
|
+
stopped = true;
|
|
3837
|
+
if (timer) {
|
|
3838
|
+
clearTimeout(timer);
|
|
3839
|
+
timer = undefined;
|
|
3840
|
+
}
|
|
3841
|
+
};
|
|
3799
3842
|
}
|
|
3800
3843
|
|
|
3801
3844
|
async function initHoncho(pi: ExtensionAPI): Promise<void> {
|
|
@@ -3853,6 +3896,10 @@ async function initHoncho(pi: ExtensionAPI): Promise<void> {
|
|
|
3853
3896
|
const result = await honcho.initHoncho({
|
|
3854
3897
|
apiKey,
|
|
3855
3898
|
pi: pi as unknown as HonchoMcpRegistrar,
|
|
3899
|
+
// The probe of the credential runs while the session lives. A
|
|
3900
|
+
// session that ends cuts the probe off, and a cut-off probe says
|
|
3901
|
+
// nothing about the server.
|
|
3902
|
+
isSessionEnded: () => sessionEnded,
|
|
3856
3903
|
});
|
|
3857
3904
|
|
|
3858
3905
|
if (!result || !result.status) {
|
|
@@ -3866,6 +3913,14 @@ async function initHoncho(pi: ExtensionAPI): Promise<void> {
|
|
|
3866
3913
|
}
|
|
3867
3914
|
|
|
3868
3915
|
switch (result.status) {
|
|
3916
|
+
case "session_ended": {
|
|
3917
|
+
// The session ended while the Honcho MCP was checked. The
|
|
3918
|
+
// server was never asked, so nothing is claimed about it.
|
|
3919
|
+
logStartup(
|
|
3920
|
+
"[pi-harness] Honcho: the session ended before the Honcho MCP was checked",
|
|
3921
|
+
);
|
|
3922
|
+
return;
|
|
3923
|
+
}
|
|
3869
3924
|
case "ready": {
|
|
3870
3925
|
logStartup("[pi-harness] Honcho integration ready");
|
|
3871
3926
|
if (result.mcpRegistered) {
|
|
@@ -3889,7 +3944,10 @@ async function initHoncho(pi: ExtensionAPI): Promise<void> {
|
|
|
3889
3944
|
addHarnessMessage("Honcho", report.text, report.status, report.details);
|
|
3890
3945
|
// A connector connects the server in the background:
|
|
3891
3946
|
// the report is corrected when the tools appear.
|
|
3892
|
-
|
|
3947
|
+
// A watcher of a session that is gone is stopped
|
|
3948
|
+
// first: only one watcher reads the tools.
|
|
3949
|
+
stopHonchoMcpWatcher?.();
|
|
3950
|
+
stopHonchoMcpWatcher = watchHonchoMcpTools(pi, honcho);
|
|
3893
3951
|
}
|
|
3894
3952
|
} else {
|
|
3895
3953
|
// The memory works, but the model has no Honcho tools: the
|
|
@@ -3985,6 +4043,13 @@ async function initHoncho(pi: ExtensionAPI): Promise<void> {
|
|
|
3985
4043
|
"Honcho memory stays disabled for this session.",
|
|
3986
4044
|
]);
|
|
3987
4045
|
}
|
|
4046
|
+
// The session is over: the watcher of the tools stops. It reads the
|
|
4047
|
+
// tools of the session, and the runtime refuses that read once the
|
|
4048
|
+
// session is gone.
|
|
4049
|
+
pi.on("session_shutdown", () => {
|
|
4050
|
+
stopHonchoMcpWatcher?.();
|
|
4051
|
+
stopHonchoMcpWatcher = null;
|
|
4052
|
+
});
|
|
3988
4053
|
}
|
|
3989
4054
|
|
|
3990
4055
|
// --- langchain-loop: Ping-pong write-review loop via harness/langchain/ -----------
|
|
@@ -5717,6 +5782,14 @@ if (hasReviewMarker) {
|
|
|
5717
5782
|
// because MCP tool calls require an active Pi session.
|
|
5718
5783
|
asyncInitPromises.push(initHoncho(pi));
|
|
5719
5784
|
|
|
5785
|
+
// The session decides how long the work of the session may live.
|
|
5786
|
+
pi.on("session_start", () => {
|
|
5787
|
+
sessionEnded = false;
|
|
5788
|
+
});
|
|
5789
|
+
pi.on("session_shutdown", () => {
|
|
5790
|
+
sessionEnded = true;
|
|
5791
|
+
});
|
|
5792
|
+
|
|
5720
5793
|
// Defer Honcho workspace/identity creation until we have an active session
|
|
5721
5794
|
// Use a ref object so we can check and update atomically
|
|
5722
5795
|
const honchoIdentityState = { done: false, success: false };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pi-harness/two-phase-review",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.474",
|
|
4
4
|
"description": "pi-harness-runtime — two-phase implementation and review workflow (queue review signals, gate the phase, scope the diff)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|