pi-harness-runtime 1.1.483 → 1.1.485
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 +123 -0
- package/harness/auto-quota-resume.ts +33 -3
- package/harness/glm-quota-countdown.ts +23 -1
- package/harness/pi-retry-visibility.ts +133 -0
- package/harness/provider-failure.ts +23 -0
- package/index.ts +122 -5
- 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/proactive-compact.ts +17 -3
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,129 @@
|
|
|
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.485](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.485) (2026-11-09)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **actions:** register the job resume, the GLM countdown and the queued continuations ([177c964](https://github.com/ManotLuijiu/pi-harness-runtime/commit/177c964555b0057e6bc7d293dafab10c95eabbf9))
|
|
11
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
12
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
13
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
14
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
15
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
16
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
17
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
18
|
+
* **keys:** tell the user what to do about an exposed key file ([7031003](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7031003574307351b7a8f28ee14159b58e17b793))
|
|
19
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
20
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
21
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
22
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
23
|
+
* **providers:** a shared registry of the pending automatic actions and a bounded recovery ([c5f955b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c5f955bc82adcb6999a89d5bc278fa87fccee022))
|
|
24
|
+
* **providers:** one failure has one executor, and the retry bridge is checked ([e73c4c7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e73c4c76ff20a9708083659bdcefe74870a84837))
|
|
25
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
26
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
27
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
28
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
29
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
30
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
### Bug Fixes
|
|
34
|
+
|
|
35
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
36
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
37
|
+
* **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))
|
|
38
|
+
* **honcho:** a tools listing that the end of the session cuts off is not a failure ([62cc8c3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/62cc8c376aade01c953ce2a1c6501ed07b74a1e9))
|
|
39
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
40
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
41
|
+
* **jev:** a prohibition must not hide a destructive action ([78a6cc1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/78a6cc199e647f812e145483f7e94991358d8f34))
|
|
42
|
+
* **jev:** a refusal without punctuation, and only a decline of an action ([ef3dbf8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ef3dbf87a2a1725373281613a0d48881ed5d2239))
|
|
43
|
+
* **jev:** a rejection during the countdown pauses the work ([9b018ce](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9b018ce1152b6724dee73cdc901b8a360ecc91ab))
|
|
44
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
45
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
46
|
+
* **jev:** the action of the question on its own text, and a reply is not an authorization ([7c3fdd6](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7c3fdd6822b58bd6ccfa3bcdf1c5282cb3db52dd))
|
|
47
|
+
* **jev:** the action of the question, and an open question blocks the work ([1f9ff39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1f9ff39efc4ee17464c54c2ca9b583245093dbac))
|
|
48
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
49
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
50
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
51
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
52
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
53
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
54
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
55
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
56
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
57
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
58
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
59
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
60
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
61
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
62
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
63
|
+
* **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))
|
|
64
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
65
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
66
|
+
|
|
67
|
+
### [1.1.484](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.484) (2026-11-09)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
### Features
|
|
71
|
+
|
|
72
|
+
* **actions:** register the job resume, the GLM countdown and the queued continuations ([177c964](https://github.com/ManotLuijiu/pi-harness-runtime/commit/177c964555b0057e6bc7d293dafab10c95eabbf9))
|
|
73
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
74
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
75
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
76
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
77
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
78
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
79
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
80
|
+
* **keys:** tell the user what to do about an exposed key file ([7031003](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7031003574307351b7a8f28ee14159b58e17b793))
|
|
81
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
82
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
83
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
84
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
85
|
+
* **providers:** a shared registry of the pending automatic actions and a bounded recovery ([c5f955b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c5f955bc82adcb6999a89d5bc278fa87fccee022))
|
|
86
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
87
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
88
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
89
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
90
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
91
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### Bug Fixes
|
|
95
|
+
|
|
96
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
97
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
98
|
+
* **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))
|
|
99
|
+
* **honcho:** a tools listing that the end of the session cuts off is not a failure ([62cc8c3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/62cc8c376aade01c953ce2a1c6501ed07b74a1e9))
|
|
100
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
101
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
102
|
+
* **jev:** a prohibition must not hide a destructive action ([78a6cc1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/78a6cc199e647f812e145483f7e94991358d8f34))
|
|
103
|
+
* **jev:** a refusal without punctuation, and only a decline of an action ([ef3dbf8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ef3dbf87a2a1725373281613a0d48881ed5d2239))
|
|
104
|
+
* **jev:** a rejection during the countdown pauses the work ([9b018ce](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9b018ce1152b6724dee73cdc901b8a360ecc91ab))
|
|
105
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
106
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
107
|
+
* **jev:** the action of the question on its own text, and a reply is not an authorization ([7c3fdd6](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7c3fdd6822b58bd6ccfa3bcdf1c5282cb3db52dd))
|
|
108
|
+
* **jev:** the action of the question, and an open question blocks the work ([1f9ff39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1f9ff39efc4ee17464c54c2ca9b583245093dbac))
|
|
109
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
110
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
111
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
112
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
113
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
114
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
115
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
116
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
117
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
118
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
119
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
120
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
121
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
122
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
123
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
124
|
+
* **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))
|
|
125
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
126
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
127
|
+
|
|
5
128
|
### [1.1.483](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.483) (2026-11-09)
|
|
6
129
|
|
|
7
130
|
|
|
@@ -25,9 +25,32 @@ const MIN_RESUME_DELAY_MS = 5_000; // 5 seconds
|
|
|
25
25
|
/** Map of jobId → active auto-resume timer handle. */
|
|
26
26
|
const activeTimers = new Map<
|
|
27
27
|
string,
|
|
28
|
-
{
|
|
28
|
+
{
|
|
29
|
+
timeout: ReturnType<typeof setTimeout>;
|
|
30
|
+
resumeAt: number;
|
|
31
|
+
provider: string;
|
|
32
|
+
observer?: AutoQuotaResumeObserver;
|
|
33
|
+
}
|
|
29
34
|
>();
|
|
30
35
|
|
|
36
|
+
/**
|
|
37
|
+
* The observer of the scheduled resumes.
|
|
38
|
+
*
|
|
39
|
+
* The module stays independent of the status display: it reports the
|
|
40
|
+
* deadline it scheduled and the moment the pending resume ended, and the
|
|
41
|
+
* caller decides how to show it.
|
|
42
|
+
*/
|
|
43
|
+
export interface AutoQuotaResumeObserver {
|
|
44
|
+
/** A resume was scheduled for that deadline. */
|
|
45
|
+
scheduled(jobId: string, provider: string, resumeAt: number): void;
|
|
46
|
+
/**
|
|
47
|
+
* The pending resume of that job ended.
|
|
48
|
+
*
|
|
49
|
+
* It ran, or it was cancelled. Either way there is no countdown left.
|
|
50
|
+
*/
|
|
51
|
+
ended(jobId: string, provider: string): void;
|
|
52
|
+
}
|
|
53
|
+
|
|
31
54
|
/**
|
|
32
55
|
* Schedule an auto-resume for a job that was paused due to quota exhaustion.
|
|
33
56
|
*
|
|
@@ -42,6 +65,7 @@ export function scheduleAutoResume(
|
|
|
42
65
|
provider: string,
|
|
43
66
|
machine: JobStateMachine,
|
|
44
67
|
mirrorStore: MirrorStore,
|
|
68
|
+
observer?: AutoQuotaResumeObserver,
|
|
45
69
|
): string | null {
|
|
46
70
|
const jobId = machine.getCheckpoint()?.jobId;
|
|
47
71
|
if (!jobId) return null;
|
|
@@ -75,6 +99,9 @@ export function scheduleAutoResume(
|
|
|
75
99
|
|
|
76
100
|
const timeout = setTimeout(async () => {
|
|
77
101
|
activeTimers.delete(jobId);
|
|
102
|
+
// The pending resume is over: there is no countdown left, not even
|
|
103
|
+
// when the quota is still exhausted and the resume moves.
|
|
104
|
+
observer?.ended(jobId, provider);
|
|
78
105
|
|
|
79
106
|
const checkpoint = machine.getCheckpoint();
|
|
80
107
|
if (!checkpoint || checkpoint.status !== "paused_quota") {
|
|
@@ -91,7 +118,7 @@ export function scheduleAutoResume(
|
|
|
91
118
|
// `[auto-quota-resume] ${provider} still exhausted at scheduled time.` +
|
|
92
119
|
// ` Re-scheduling...`,
|
|
93
120
|
// );
|
|
94
|
-
scheduleAutoResume(provider, machine, mirrorStore);
|
|
121
|
+
scheduleAutoResume(provider, machine, mirrorStore, observer);
|
|
95
122
|
return;
|
|
96
123
|
}
|
|
97
124
|
}
|
|
@@ -108,7 +135,8 @@ export function scheduleAutoResume(
|
|
|
108
135
|
}
|
|
109
136
|
}, delayMs);
|
|
110
137
|
|
|
111
|
-
activeTimers.set(jobId, { timeout, resumeAt });
|
|
138
|
+
activeTimers.set(jobId, { timeout, resumeAt, provider, observer });
|
|
139
|
+
observer?.scheduled(jobId, provider, resumeAt);
|
|
112
140
|
return resumeAtIso;
|
|
113
141
|
}
|
|
114
142
|
|
|
@@ -121,6 +149,8 @@ export function cancelAutoResume(jobId: string): void {
|
|
|
121
149
|
if (existing) {
|
|
122
150
|
clearTimeout(existing.timeout);
|
|
123
151
|
activeTimers.delete(jobId);
|
|
152
|
+
// The pending resume is cancelled: the countdown leaves with it.
|
|
153
|
+
existing.observer?.ended(jobId, existing.provider);
|
|
124
154
|
}
|
|
125
155
|
}
|
|
126
156
|
|
|
@@ -171,6 +171,7 @@ export class GLMQuotaCountdown {
|
|
|
171
171
|
private activeCountdowns: Map<string, GLMQuotaCountdownState> = new Map();
|
|
172
172
|
private timers: Map<string, NodeJS.Timeout> = new Map();
|
|
173
173
|
private tickCallbacks: Set<CountdownCallback> = new Set();
|
|
174
|
+
private endCallbacks: Set<(jobId: string) => void> = new Set();
|
|
174
175
|
private notificationCenter: NotificationCenter | null = null;
|
|
175
176
|
private jobContext: { jobId: string; requirement: string } | null = null;
|
|
176
177
|
|
|
@@ -196,6 +197,18 @@ export class GLMQuotaCountdown {
|
|
|
196
197
|
return () => this.tickCallbacks.delete(callback);
|
|
197
198
|
}
|
|
198
199
|
|
|
200
|
+
/**
|
|
201
|
+
* Register a callback that runs when a countdown ends.
|
|
202
|
+
*
|
|
203
|
+
* A countdown ends when it reaches the reset, and when it is
|
|
204
|
+
* cancelled. The caller uses it to drop the row of the countdown: a
|
|
205
|
+
* countdown that is over must not stay at 00:00.
|
|
206
|
+
*/
|
|
207
|
+
onEnd(callback: (jobId: string) => void): () => void {
|
|
208
|
+
this.endCallbacks.add(callback);
|
|
209
|
+
return () => this.endCallbacks.delete(callback);
|
|
210
|
+
}
|
|
211
|
+
|
|
199
212
|
/**
|
|
200
213
|
* Check if there's an active countdown for a job
|
|
201
214
|
*/
|
|
@@ -295,8 +308,17 @@ export class GLMQuotaCountdown {
|
|
|
295
308
|
clearTimeout(existingTimer);
|
|
296
309
|
this.timers.delete(jobId);
|
|
297
310
|
}
|
|
298
|
-
this.
|
|
311
|
+
const resumeTimer = this.timers.get(`${jobId}:resume`);
|
|
312
|
+
if (resumeTimer) {
|
|
313
|
+
clearTimeout(resumeTimer);
|
|
314
|
+
this.timers.delete(`${jobId}:resume`);
|
|
315
|
+
}
|
|
316
|
+
const had = this.activeCountdowns.delete(jobId);
|
|
299
317
|
logCountdownCancelled(jobId);
|
|
318
|
+
// The countdown is over: the row of the countdown leaves with it.
|
|
319
|
+
if (had) {
|
|
320
|
+
for (const callback of [...this.endCallbacks]) callback(jobId);
|
|
321
|
+
}
|
|
300
322
|
}
|
|
301
323
|
|
|
302
324
|
/**
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The visibility of the automatic retries of the core of Pi.
|
|
3
|
+
*
|
|
4
|
+
* The core of Pi declares the events of its own retry of a provider
|
|
5
|
+
* (`auto_retry_start` and `auto_retry_end`) and the interactive mode
|
|
6
|
+
* consumes them. The extension API of the core does not expose them, and
|
|
7
|
+
* the extension context has no handle of the agent session, so an
|
|
8
|
+
* extension cannot subscribe to them.
|
|
9
|
+
*
|
|
10
|
+
* The consequence is narrow and honest: the harness does not observe the
|
|
11
|
+
* countdown of the internal retry of Pi. Its own bounded recovery is
|
|
12
|
+
* *additional* to that retry, never a replacement for it.
|
|
13
|
+
*
|
|
14
|
+
* This module reads the declarations of the installed core, so the finding
|
|
15
|
+
* stays a checked fact instead of a belief. A newer core that exposes the
|
|
16
|
+
* events changes the verdict, and the harness can wire the bridge.
|
|
17
|
+
*/
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
import { join, sep } from "node:path";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The events of the core of Pi that describe an automatic retry.
|
|
23
|
+
*/
|
|
24
|
+
export const CORE_RETRY_EVENTS = [
|
|
25
|
+
"auto_retry_start",
|
|
26
|
+
"auto_retry_end",
|
|
27
|
+
] as const;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* What the installed core allows an extension to see.
|
|
31
|
+
*/
|
|
32
|
+
export type RetryVisibilityVerdict =
|
|
33
|
+
/** The extension API of the core exposes the retry events. */
|
|
34
|
+
| "exposed"
|
|
35
|
+
/** The core declares the events, but the extension API hides them. */
|
|
36
|
+
| "not-exposed"
|
|
37
|
+
/** The declarations of the core could not be read. */
|
|
38
|
+
| "unknown";
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The verdict about the internal retries of the core of Pi.
|
|
42
|
+
*/
|
|
43
|
+
export interface RetryVisibility {
|
|
44
|
+
/** The verdict. */
|
|
45
|
+
verdict: RetryVisibilityVerdict;
|
|
46
|
+
/** The events that the extension API does not expose. */
|
|
47
|
+
hidden: string[];
|
|
48
|
+
/** The reason of the verdict, in one sentence. */
|
|
49
|
+
reason: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Inspect the declarations of the extension API of the core of Pi.
|
|
54
|
+
*
|
|
55
|
+
* The declarations are the source of truth: the runtime of the extension
|
|
56
|
+
* cannot tell which events the API accepts.
|
|
57
|
+
*/
|
|
58
|
+
export function inspectRetryVisibility(
|
|
59
|
+
extensionTypesSource: string | undefined,
|
|
60
|
+
): RetryVisibility {
|
|
61
|
+
if (
|
|
62
|
+
typeof extensionTypesSource !== "string" ||
|
|
63
|
+
extensionTypesSource.length === 0
|
|
64
|
+
) {
|
|
65
|
+
return {
|
|
66
|
+
verdict: "unknown",
|
|
67
|
+
hidden: [],
|
|
68
|
+
reason:
|
|
69
|
+
"the declarations of the extension API of the core could not be read",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const hidden = CORE_RETRY_EVENTS.filter(
|
|
74
|
+
(event) => !extensionTypesSource.includes(`on(event: "${event}"`),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
if (hidden.length === 0) {
|
|
78
|
+
return {
|
|
79
|
+
verdict: "exposed",
|
|
80
|
+
hidden: [],
|
|
81
|
+
reason: "the extension API of the core exposes the retry events",
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
verdict: "not-exposed",
|
|
87
|
+
hidden: [...hidden],
|
|
88
|
+
reason:
|
|
89
|
+
"the extension API of the core does not expose the retry events, so the countdown of the internal retry is not visible to an extension",
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The path of the declarations of the extension API of the installed core.
|
|
95
|
+
*
|
|
96
|
+
* The core is loaded by the process that runs the extension, so its entry
|
|
97
|
+
* point is in the arguments of the process.
|
|
98
|
+
*/
|
|
99
|
+
export function resolveExtensionTypesPath(
|
|
100
|
+
argv: string[] = process.argv,
|
|
101
|
+
): string | undefined {
|
|
102
|
+
for (const value of argv) {
|
|
103
|
+
const marker = `${sep}pi-coding-agent${sep}`;
|
|
104
|
+
const index = value.indexOf(marker);
|
|
105
|
+
if (index === -1) continue;
|
|
106
|
+
const root = value.slice(0, index + marker.length - 1);
|
|
107
|
+
return join(root, "dist", "core", "extensions", "types.d.ts");
|
|
108
|
+
}
|
|
109
|
+
return undefined;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Read the declarations of the extension API of the installed core.
|
|
114
|
+
*
|
|
115
|
+
* A core that cannot be found is not a failure: the verdict is then
|
|
116
|
+
* "unknown", and the harness says so.
|
|
117
|
+
*/
|
|
118
|
+
export function readInstalledExtensionTypes(): string | undefined {
|
|
119
|
+
const path = resolveExtensionTypesPath();
|
|
120
|
+
if (!path) return undefined;
|
|
121
|
+
try {
|
|
122
|
+
return readFileSync(path, "utf8");
|
|
123
|
+
} catch {
|
|
124
|
+
return undefined;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* The visibility of the internal retries of the installed core.
|
|
130
|
+
*/
|
|
131
|
+
export function installedRetryVisibility(): RetryVisibility {
|
|
132
|
+
return inspectRetryVisibility(readInstalledExtensionTypes());
|
|
133
|
+
}
|
|
@@ -328,6 +328,29 @@ export function classifyProviderFailure(text: string | undefined): ProviderFailu
|
|
|
328
328
|
};
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
+
/**
|
|
332
|
+
* Whether the bounded recovery cycle of the harness owns the failure.
|
|
333
|
+
*
|
|
334
|
+
* The cycle is the backoff of the harness: a rate limit and an exhausted
|
|
335
|
+
* plan are retried by it, whether the evidence names a deadline or not.
|
|
336
|
+
* A rate limit without a `Retry-After` therefore still gets a finite
|
|
337
|
+
* number of attempts, instead of nothing at all.
|
|
338
|
+
*
|
|
339
|
+
* An overload does not belong to the cycle: the provider says to come
|
|
340
|
+
* back shortly, and the existing overload executor already retries with a
|
|
341
|
+
* short delay and has its own limit. Two executors for one failure would
|
|
342
|
+
* be two resume loops.
|
|
343
|
+
*/
|
|
344
|
+
export function usesBoundedRecovery(failure: ProviderFailure): boolean {
|
|
345
|
+
if (failure.kind === "overload") return false;
|
|
346
|
+
if (failure.kind === "credentials" || failure.kind === "unknown") return false;
|
|
347
|
+
return (
|
|
348
|
+
failure.recovery === "bounded-recovery" ||
|
|
349
|
+
failure.recovery === "retry-after" ||
|
|
350
|
+
failure.recovery === "backoff"
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
|
|
331
354
|
/**
|
|
332
355
|
* Does the text look like a failure at all?
|
|
333
356
|
*/
|
package/index.ts
CHANGED
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
createPendingActionRegistry,
|
|
60
60
|
createPendingActionTicker,
|
|
61
61
|
} from "./harness/pending-actions.ts";
|
|
62
|
-
import { classifyProviderFailure } from "./harness/provider-failure.ts";
|
|
62
|
+
import { classifyProviderFailure, usesBoundedRecovery } from "./harness/provider-failure.ts";
|
|
63
63
|
import type { ProviderFailure } from "./harness/provider-failure.ts";
|
|
64
64
|
import {
|
|
65
65
|
createProviderRecoveryController,
|
|
@@ -113,6 +113,7 @@ import {
|
|
|
113
113
|
PROACTIVE_COMPACT_COOLDOWN_MS,
|
|
114
114
|
shouldQueueOutputLimitResume,
|
|
115
115
|
shouldQueueProviderOverloadResume,
|
|
116
|
+
isProviderRetryFailedReport,
|
|
116
117
|
shouldQueuePostCompactionResume,
|
|
117
118
|
shouldTriggerProactiveCompact,
|
|
118
119
|
} from "./proactive-compact.ts";
|
|
@@ -427,6 +428,95 @@ function jevDecisionActionId(requestId: string): string {
|
|
|
427
428
|
return `jev-decision:${requestId}`;
|
|
428
429
|
}
|
|
429
430
|
|
|
431
|
+
/**
|
|
432
|
+
* The identity of the pending action of the resume of a job.
|
|
433
|
+
*
|
|
434
|
+
* The job is part of the identity: two jobs have two resumes.
|
|
435
|
+
*/
|
|
436
|
+
function jobQuotaResumeActionId(jobId: string): string {
|
|
437
|
+
return `job-quota-resume:${jobId}`;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* The identity of the pending action of the countdown of the GLM quota.
|
|
442
|
+
*/
|
|
443
|
+
function glmQuotaActionId(jobId: string): string {
|
|
444
|
+
return `glm-quota:${jobId}`;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* The identities of the continuations that have no scheduled deadline.
|
|
449
|
+
*
|
|
450
|
+
* The output limit and the compaction continue the work right away, so
|
|
451
|
+
* there is no countdown to show for them.
|
|
452
|
+
*/
|
|
453
|
+
const OUTPUT_LIMIT_CONTINUATION_ID = "continuation:output-limit";
|
|
454
|
+
const POST_COMPACTION_CONTINUATION_ID = "continuation:post-compaction";
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Register a continuation that runs right away.
|
|
458
|
+
*
|
|
459
|
+
* The row says that the continuation is queued. It never shows a
|
|
460
|
+
* countdown, because there is no deadline: a continuation that runs
|
|
461
|
+
* immediately has no deadline to wait for.
|
|
462
|
+
*/
|
|
463
|
+
function registerQueuedContinuation(id: string, reason: string): void {
|
|
464
|
+
pendingActions.register({
|
|
465
|
+
id,
|
|
466
|
+
sessionId: activeSessionId,
|
|
467
|
+
owner: "continuation",
|
|
468
|
+
kind: "resume",
|
|
469
|
+
state: "queued",
|
|
470
|
+
reason,
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
// The countdown of the GLM quota owns the deadline of the reset, so the
|
|
475
|
+
// row shows the reset it really waits for. The row leaves when the
|
|
476
|
+
// countdown ends, so it never stays at 00:00.
|
|
477
|
+
getGLMQuotaCountdown().onTick((event) => {
|
|
478
|
+
const countdown = getGLMQuotaCountdown().getCountdown(event.jobId);
|
|
479
|
+
const resetAtEpoch =
|
|
480
|
+
countdown?.resetAtEpoch ?? Date.now() + event.remainingSeconds * 1000;
|
|
481
|
+
pendingActions.register({
|
|
482
|
+
id: glmQuotaActionId(event.jobId),
|
|
483
|
+
sessionId: activeSessionId,
|
|
484
|
+
owner: "glm-quota",
|
|
485
|
+
kind: "quota-check",
|
|
486
|
+
state: "scheduled",
|
|
487
|
+
dueAt: resetAtEpoch,
|
|
488
|
+
provider: "GLM",
|
|
489
|
+
reason: "the quota of GLM is exhausted",
|
|
490
|
+
});
|
|
491
|
+
});
|
|
492
|
+
getGLMQuotaCountdown().onEnd((jobId) => {
|
|
493
|
+
pendingActions.remove(glmQuotaActionId(jobId));
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* The observer of the scheduled job resumes.
|
|
498
|
+
*
|
|
499
|
+
* The job resume registers the deadline it really schedules, so the row
|
|
500
|
+
* shows the moment the resume runs and not the reset of the quota.
|
|
501
|
+
*/
|
|
502
|
+
const quotaResumeObserver = {
|
|
503
|
+
scheduled(jobId: string, provider: string, resumeAt: number): void {
|
|
504
|
+
pendingActions.register({
|
|
505
|
+
id: jobQuotaResumeActionId(jobId),
|
|
506
|
+
sessionId: activeSessionId,
|
|
507
|
+
owner: "job-quota",
|
|
508
|
+
kind: "resume",
|
|
509
|
+
state: "scheduled",
|
|
510
|
+
dueAt: resumeAt,
|
|
511
|
+
provider,
|
|
512
|
+
reason: "the quota of the job is exhausted",
|
|
513
|
+
});
|
|
514
|
+
},
|
|
515
|
+
ended(jobId: string, _provider: string): void {
|
|
516
|
+
pendingActions.remove(jobQuotaResumeActionId(jobId));
|
|
517
|
+
},
|
|
518
|
+
};
|
|
519
|
+
|
|
430
520
|
// Shared state for callback handlers (accessible across init functions)
|
|
431
521
|
const sharedState = {
|
|
432
522
|
/**
|
|
@@ -6296,6 +6386,12 @@ Run \`bd ready\` to see current bd issues.
|
|
|
6296
6386
|
}
|
|
6297
6387
|
if (event.message.role !== "assistant") return;
|
|
6298
6388
|
|
|
6389
|
+
// A turn ran: a continuation that was queued is no longer queued.
|
|
6390
|
+
// The row leaves with it, so it never stays behind as a promise.
|
|
6391
|
+
pendingActions.removeWhere(
|
|
6392
|
+
(action) => action.owner === "continuation" && action.state === "queued",
|
|
6393
|
+
);
|
|
6394
|
+
|
|
6299
6395
|
// DEBUG: Log model ID
|
|
6300
6396
|
|
|
6301
6397
|
const m = event.message as {
|
|
@@ -6328,10 +6424,10 @@ Run \`bd ready\` to see current bd issues.
|
|
|
6328
6424
|
})();
|
|
6329
6425
|
|
|
6330
6426
|
if (providerFailure) {
|
|
6331
|
-
|
|
6332
|
-
|
|
6333
|
-
|
|
6334
|
-
if (
|
|
6427
|
+
// The bounded recovery cycle owns the rate limit and the exhausted
|
|
6428
|
+
// plan. An overload keeps its own executor, so one failure never
|
|
6429
|
+
// ends up with two resume loops.
|
|
6430
|
+
if (usesBoundedRecovery(providerFailure)) {
|
|
6335
6431
|
// The bounded recovery cycle decides the deadline of the next
|
|
6336
6432
|
// attempt. The identity of the failure keeps a repeated copy
|
|
6337
6433
|
// of the same error from starting a second cycle.
|
|
@@ -6370,6 +6466,10 @@ Run \`bd ready\` to see current bd issues.
|
|
|
6370
6466
|
outputLimitResumeAttempts += 1;
|
|
6371
6467
|
pendingOutputLimitResumeAfterCompact = true;
|
|
6372
6468
|
pendingOutputLimitResumeAfterSettled = true;
|
|
6469
|
+
registerQueuedContinuation(
|
|
6470
|
+
OUTPUT_LIMIT_CONTINUATION_ID,
|
|
6471
|
+
"the output limit continues the turn",
|
|
6472
|
+
);
|
|
6373
6473
|
await queueAutoResume("output-limit", OUTPUT_LIMIT_RESUME_PROMPT, "steer");
|
|
6374
6474
|
// Emit OutputLimitContinued to Telegram
|
|
6375
6475
|
await nc("OutputLimitContinued", {
|
|
@@ -6381,6 +6481,14 @@ Run \`bd ready\` to see current bd issues.
|
|
|
6381
6481
|
m,
|
|
6382
6482
|
providerOverloadResumeAttempts,
|
|
6383
6483
|
ctx.hasPendingMessages(),
|
|
6484
|
+
{
|
|
6485
|
+
// The classification may know an overload that the text
|
|
6486
|
+
// of the answer does not repeat. A report of exhausted
|
|
6487
|
+
// retries of the SDK is not a fresh failure.
|
|
6488
|
+
detected:
|
|
6489
|
+
providerFailure?.kind === "overload" &&
|
|
6490
|
+
!isProviderRetryFailedReport(readMessageText(event.message)),
|
|
6491
|
+
},
|
|
6384
6492
|
)
|
|
6385
6493
|
) {
|
|
6386
6494
|
providerOverloadResumeAttempts += 1;
|
|
@@ -7417,6 +7525,7 @@ Run \`bd ready\` to see current bd issues.
|
|
|
7417
7525
|
"minimax",
|
|
7418
7526
|
currentSession.machine,
|
|
7419
7527
|
mirrorStore,
|
|
7528
|
+
quotaResumeObserver,
|
|
7420
7529
|
);
|
|
7421
7530
|
ctx.ui.notify(
|
|
7422
7531
|
`Job paused.\n` +
|
|
@@ -7804,6 +7913,10 @@ Run \`bd ready\` to see current bd issues.
|
|
|
7804
7913
|
}
|
|
7805
7914
|
|
|
7806
7915
|
if (forceOutputLimitResume) {
|
|
7916
|
+
registerQueuedContinuation(
|
|
7917
|
+
POST_COMPACTION_CONTINUATION_ID,
|
|
7918
|
+
"the compaction continues the turn",
|
|
7919
|
+
);
|
|
7807
7920
|
await queueAutoResume(
|
|
7808
7921
|
"post-compact-output-limit",
|
|
7809
7922
|
OUTPUT_LIMIT_RESUME_PROMPT,
|
|
@@ -7813,6 +7926,10 @@ Run \`bd ready\` to see current bd issues.
|
|
|
7813
7926
|
}
|
|
7814
7927
|
|
|
7815
7928
|
outputLimitResumeAttempts = 0;
|
|
7929
|
+
registerQueuedContinuation(
|
|
7930
|
+
POST_COMPACTION_CONTINUATION_ID,
|
|
7931
|
+
"the compaction continues the turn",
|
|
7932
|
+
);
|
|
7816
7933
|
// pi.dev expects the literal "resume" command to continue after compaction.
|
|
7817
7934
|
await queueAutoResume("post-compact", "resume", "followUp");
|
|
7818
7935
|
});
|
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.485",
|
|
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",
|
package/proactive-compact.ts
CHANGED
|
@@ -123,7 +123,7 @@ export function isFreshProviderOverloadError(
|
|
|
123
123
|
text.includes("server is temporarily busy") ||
|
|
124
124
|
text.includes("try again shortly") || /timed.s*out/i.test(text); // timeout errors are retryable
|
|
125
125
|
// But NOT if it's a "Retry failed" report (that means our retry already failed)
|
|
126
|
-
const isRetryFailedReport =
|
|
126
|
+
const isRetryFailedReport = isProviderRetryFailedReport(text);
|
|
127
127
|
// request_id extracted for future logging use
|
|
128
128
|
// const requestIdMatch = text.match(/request_id[^"]*"([^"]+)"/i) || text.match(/request_id[^"]*([a-f0-9]+)/i);
|
|
129
129
|
if (isFreshOverload) {
|
|
@@ -134,6 +134,17 @@ export function isFreshProviderOverloadError(
|
|
|
134
134
|
return isFreshOverload && !isRetryFailedReport;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Whether the text is the report of an exhausted retry of the provider SDK.
|
|
139
|
+
*
|
|
140
|
+
* The SDK already made its own attempts. The harness does not start
|
|
141
|
+
* another attempt on top of them, and it does not report a fresh failure
|
|
142
|
+
* for them either.
|
|
143
|
+
*/
|
|
144
|
+
export function isProviderRetryFailedReport(text: string): boolean {
|
|
145
|
+
return /Retry failed after \d+ attempts:/i.test(text);
|
|
146
|
+
}
|
|
147
|
+
|
|
137
148
|
/**
|
|
138
149
|
* Legacy check - returns true for BOTH fresh overloads AND "Retry failed" reports
|
|
139
150
|
* @deprecated Use isFreshProviderOverloadError for retry logic
|
|
@@ -154,11 +165,14 @@ export function shouldQueueProviderOverloadResume(
|
|
|
154
165
|
message: AssistantStopLike,
|
|
155
166
|
resumeAttempts: number,
|
|
156
167
|
hasPendingMessages: boolean,
|
|
157
|
-
options?: { maxAttempts?: number },
|
|
168
|
+
options?: { maxAttempts?: number; detected?: boolean },
|
|
158
169
|
): boolean {
|
|
159
170
|
const maxAttempts =
|
|
160
171
|
options?.maxAttempts ?? PROVIDER_OVERLOAD_AUTO_RESUME_LIMIT;
|
|
161
|
-
|
|
172
|
+
// The classification of the failure may know an overload that the text
|
|
173
|
+
// of the answer does not mention: the error of the turn is not always
|
|
174
|
+
// repeated in the answer.
|
|
175
|
+
const isFresh = options?.detected ?? isFreshProviderOverloadError(message);
|
|
162
176
|
const underLimit = resumeAttempts < maxAttempts;
|
|
163
177
|
const noPending = !hasPendingMessages;
|
|
164
178
|
const shouldQueue = isFresh && underLimit && noPending;
|