pi-harness-runtime 1.1.516 → 1.1.518
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 +194 -0
- package/harness/delegated-approval-runtime.ts +142 -19
- package/harness/delegated-approval-types.ts +194 -13
- package/harness/exploration-guard-runtime.ts +41 -30
- package/harness/jev-rejection-escalation.ts +146 -8
- package/harness/pending-countdown.ts +59 -6
- package/harness/plan-handoff-receiver.ts +162 -13
- package/index.ts +323 -24
- 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/exploration-guard/dist/budget.d.ts +8 -0
- package/packages/exploration-guard/dist/budget.d.ts.map +1 -1
- package/packages/exploration-guard/dist/budget.js +25 -0
- package/packages/exploration-guard/dist/budget.js.map +1 -1
- package/packages/exploration-guard/dist/index.d.ts +1 -1
- package/packages/exploration-guard/dist/index.d.ts.map +1 -1
- package/packages/exploration-guard/dist/index.js +1 -1
- package/packages/exploration-guard/dist/index.js.map +1 -1
- package/packages/exploration-guard/dist/state.d.ts.map +1 -1
- package/packages/exploration-guard/dist/state.js +2 -0
- package/packages/exploration-guard/dist/state.js.map +1 -1
- package/packages/exploration-guard/dist/tracker.d.ts +12 -7
- package/packages/exploration-guard/dist/tracker.d.ts.map +1 -1
- package/packages/exploration-guard/dist/tracker.js +47 -10
- package/packages/exploration-guard/dist/tracker.js.map +1 -1
- package/packages/exploration-guard/dist/types.d.ts +12 -0
- package/packages/exploration-guard/dist/types.d.ts.map +1 -1
- package/packages/exploration-guard/package.json +1 -1
- package/packages/exploration-guard/src/budget.ts +27 -0
- package/packages/exploration-guard/src/index.ts +1 -0
- package/packages/exploration-guard/src/state.ts +4 -0
- package/packages/exploration-guard/src/tracker.ts +51 -9
- package/packages/exploration-guard/src/types.ts +12 -0
- 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/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/plan-handoff/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,200 @@
|
|
|
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.518](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.518) (2026-11-18)
|
|
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
|
+
* **approval:** the refusal of the judge is asked of the human ([8cc14cd](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8cc14cd46fec1fa5ea2b2e5f8b6675a38673bee9))
|
|
12
|
+
* **cookies:** the space-separated export is imported, the quota refresh is shared ([85e01dc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/85e01dcc3836fc08ba33ea4aee9cc946c559bcb3))
|
|
13
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
14
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
15
|
+
* **guard:** the exploration is bounded, the repeated reads are seen ([f14d51a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f14d51aa8aa2b664994d78313c13c6fdd7c0ee08))
|
|
16
|
+
* **harness:** the startup tells the user that the session keeps its issues with bd ([81d63c5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/81d63c5dc2452b9f08001756866db80046a2532a))
|
|
17
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
18
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
19
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
20
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
21
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
22
|
+
* **keys:** tell the user what to do about an exposed key file ([7031003](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7031003574307351b7a8f28ee14159b58e17b793))
|
|
23
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
24
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
25
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
26
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
27
|
+
* **providers:** a shared registry of the pending automatic actions and a bounded recovery ([c5f955b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c5f955bc82adcb6999a89d5bc278fa87fccee022))
|
|
28
|
+
* **providers:** one failure has one executor, and the retry bridge is checked ([e73c4c7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e73c4c76ff20a9708083659bdcefe74870a84837))
|
|
29
|
+
* **questions:** refuse the deletion of a temporary path without the judge ([ab29694](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ab29694f36c1ff020b3b19ca542a27b37847055c))
|
|
30
|
+
* **quota:** a fresh capture and a low allowance decide the MiniMax recovery ([06d7b8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/06d7b8e971e0da58a344f75778c98edb442562bd))
|
|
31
|
+
* **quota:** the empty week waits for the human, the overload of a compaction shares the executor ([bbb0c39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/bbb0c3909b11735343e84be690c4c47e67a563bb))
|
|
32
|
+
* **recovery:** a MiniMax quota exhaustion waits for the captured reset plus ten minutes ([5af08a0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5af08a0e86c8c93fa5b7ff64a7b08e4514bc68f3))
|
|
33
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
34
|
+
* **scope:** a marked resume and a backlog that only an approval starts ([19d3320](https://github.com/ManotLuijiu/pi-harness-runtime/commit/19d33204819cf05e678996fddf4c4621f0dd7d2f))
|
|
35
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
36
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
37
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
38
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
39
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
### Bug Fixes
|
|
43
|
+
|
|
44
|
+
* **approval:** the corrections of the review of the seven findings ([4f13f49](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4f13f49beadf2957acf3a9dd3fc4201bd38d3104))
|
|
45
|
+
* **approval:** the seven findings of the task diff ([7825b1d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7825b1dc04c54294b6ef474a01bc528bfa399154))
|
|
46
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
47
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
48
|
+
* **harness:** a raw control byte hid the request scope from the review ([852b1ff](https://github.com/ManotLuijiu/pi-harness-runtime/commit/852b1ff3afc21adb71e92b85d21ff1c88e14816a))
|
|
49
|
+
* **honcho:** a handshake that never finishes is named instead of hanging the startup ([d66005f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d66005f928a4f8df5de5b8a0579cbd4f8df37ff9))
|
|
50
|
+
* **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))
|
|
51
|
+
* **honcho:** a slow connector is not a failed one, the row is corrected when the tools appear ([b62ac5b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b62ac5b16ad93e2bfb10cbec589b80a09b7e20b3))
|
|
52
|
+
* **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))
|
|
53
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
54
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
55
|
+
* **jev:** a completion question, a stale check and a pending validation ([827120b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/827120b4138b6f5ae253e69154de190085703de8))
|
|
56
|
+
* **jev:** a new request does not inherit the completion of the old one ([0f863c7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0f863c7fcaf35e261beabebef15b8ab634132fdc))
|
|
57
|
+
* **jev:** a prohibition must not hide a destructive action ([78a6cc1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/78a6cc199e647f812e145483f7e94991358d8f34))
|
|
58
|
+
* **jev:** a refusal without punctuation, and only a decline of an action ([ef3dbf8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ef3dbf87a2a1725373281613a0d48881ed5d2239))
|
|
59
|
+
* **jev:** a rejection during the countdown pauses the work ([9b018ce](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9b018ce1152b6724dee73cdc901b8a360ecc91ab))
|
|
60
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
61
|
+
* **jev:** an open question is not a permission to answer it ([e20eca2](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e20eca24bb88d385198bb12ee3ebf573af9aea86))
|
|
62
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
63
|
+
* **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))
|
|
64
|
+
* **jev:** the action of the question, and an open question blocks the work ([1f9ff39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1f9ff39efc4ee17464c54c2ca9b583245093dbac))
|
|
65
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
66
|
+
* **jev:** the countdown of an obsolete question does not outlive the work ([fe78b29](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fe78b29e6fc513b11a6993bc68fd9418dc77f79b))
|
|
67
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
68
|
+
* **jev:** the scope decides the question, the identity guards the awaits ([ed348b2](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ed348b2f94460a3b3ac11c01afd4420ee4ec1020))
|
|
69
|
+
* **jev:** the scope of a request on every human path, and the todos it touched ([cec8f36](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cec8f3644333b1d13a203340df80a30fef5c1ac0))
|
|
70
|
+
* **jev:** the subject of the scope decides, a clarification is preserved ([faf6a0f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/faf6a0fe7d0dce94d4fa48d0d7a57d126556ba6d))
|
|
71
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
72
|
+
* **logging:** the query window no longer rots with the wall clock ([cd3f5b1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cd3f5b18d8a4b8850a201d060699e18bf789a647))
|
|
73
|
+
* **logging:** the sanitizer of a message writes its control characters as escapes ([f4bbdb9](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f4bbdb94bc1801d4228142bc1a1b31505c42a575))
|
|
74
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
75
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
76
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
77
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
78
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
79
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
80
|
+
* **providers:** the escape of the user stops the recovery, and a permanent failure clears it ([cfe5797](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cfe57976bf463c327e45b874fd297c3e942246b8))
|
|
81
|
+
* **providers:** the pause wins over a retry, and the retry starts when the run settles ([e016dd2](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e016dd2a5add5b0f3c848a225a28a59e0f5fc7f3))
|
|
82
|
+
* **recovery:** a cancelled countdown does not own the next attempt ([7b79f30](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7b79f301389fae48201e696d3086d257ed722fb9))
|
|
83
|
+
* **recovery:** a cancelled retry of Pi is a cancelled decision, a spent budget is not ([7e13f15](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7e13f156a279cded2b2d4b0c99358100b3d5e038))
|
|
84
|
+
* **recovery:** a manual request takes the work back from the countdown ([fa81d8f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa81d8fd9d6160166a095e07bdf17049bbafa32d))
|
|
85
|
+
* **recovery:** the predicate of Pi decides the retry, the provider identity is normalized ([6c8c17b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/6c8c17b53302cea1602d192251eacd0ebbd3e8c9))
|
|
86
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
87
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
88
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
89
|
+
* **release:** the lockfile knows the new workspace package ([6d0a143](https://github.com/ManotLuijiu/pi-harness-runtime/commit/6d0a143fe9853deafbaa8a04433a53da36355c43))
|
|
90
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
91
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
92
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
93
|
+
* **scope:** a session that ends leaves no proposal behind ([9aad01e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9aad01e1f13446da1d01032e9967cadf66772792))
|
|
94
|
+
* **scope:** the findings of the review of the scope expansion ([92372e5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/92372e51ca31198593025ce8671b226d2ca7182e))
|
|
95
|
+
* **scope:** the question of a proposal is not obsolete and a rejection is named ([d4c58c3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d4c58c3e63e27449ef1de0f8e4e55ebbf342ff7d))
|
|
96
|
+
* **test:** a slow module is not a module that blocks ([296d5c8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/296d5c8aae4f324fbae372c872a7450bf2f60926))
|
|
97
|
+
* **test:** the host of the API is compared, not a fragment of the URL ([539fb8a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/539fb8a772fe203d6eb8703cc84eba8be475f2a7))
|
|
98
|
+
* **test:** the quota capture integration needs the runtime of bun ([86fae7d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/86fae7de31e76414aa31bb75eb136155f62d7a40))
|
|
99
|
+
* **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))
|
|
100
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
101
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
102
|
+
|
|
103
|
+
### [1.1.517](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.517) (2026-11-17)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Features
|
|
107
|
+
|
|
108
|
+
* **actions:** register the job resume, the GLM countdown and the queued continuations ([177c964](https://github.com/ManotLuijiu/pi-harness-runtime/commit/177c964555b0057e6bc7d293dafab10c95eabbf9))
|
|
109
|
+
* **approval:** the refusal of the judge is asked of the human ([8cc14cd](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8cc14cd46fec1fa5ea2b2e5f8b6675a38673bee9))
|
|
110
|
+
* **cookies:** the space-separated export is imported, the quota refresh is shared ([85e01dc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/85e01dcc3836fc08ba33ea4aee9cc946c559bcb3))
|
|
111
|
+
* **delegation:** a child is only a child when it really ran ([ac4e678](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ac4e6782d7d4bc4941e458425c8a9f38a51fc9d4))
|
|
112
|
+
* **delegation:** the scope of a request is measured before it is judged ([684b6a5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/684b6a55184f63d3be24c48dcecfb0b13410dc15))
|
|
113
|
+
* **guard:** the exploration is bounded, the repeated reads are seen ([f14d51a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f14d51aa8aa2b664994d78313c13c6fdd7c0ee08))
|
|
114
|
+
* **harness:** the startup tells the user that the session keeps its issues with bd ([81d63c5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/81d63c5dc2452b9f08001756866db80046a2532a))
|
|
115
|
+
* **honcho:** the memory service speaks the native MCP of Pi ([f9f740c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f9f740c12869bae4c4380afbe8c76e12388bb744))
|
|
116
|
+
* **jev:** one decision per question, bound to the question it was evaluated for ([03448aa](https://github.com/ManotLuijiu/pi-harness-runtime/commit/03448aaa17f2d0c3bcf644b0b1d5949727dfff8c))
|
|
117
|
+
* **jev:** the evaluation of a choice sees what the options mean ([f0c207e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f0c207e074701e6b7dab0965170ec39453d9d502))
|
|
118
|
+
* **jev:** the pending question carries the ask and the answer ([a792133](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a792133e517fb8c12d3363e98942f3af30270f27))
|
|
119
|
+
* **jev:** the pending question counts down to the decision ([d0cc171](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0cc171223986b2d32c670b6c1c74712fe0a4ad8))
|
|
120
|
+
* **keys:** tell the user what to do about an exposed key file ([7031003](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7031003574307351b7a8f28ee14159b58e17b793))
|
|
121
|
+
* **keys:** the key files are repaired when their permissions are unsafe ([e9c2c26](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e9c2c26b287665b56ed749de269737e8403bb8af))
|
|
122
|
+
* **mcp:** the harness connects the registered servers when nobody else does ([7fef951](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7fef95137ad4664df57f045cd91b7d233315b0bc))
|
|
123
|
+
* **merge:** a manual run can leave the merge to the pull request event ([b3d1950](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b3d1950b5941c78ccd56951acdafd1d4afbe1bff))
|
|
124
|
+
* **phase:** the agent owns the todo list and the harness says so ([c489370](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c489370bd7926aece8cb1a77aa20ca2d2672f1fb))
|
|
125
|
+
* **providers:** a shared registry of the pending automatic actions and a bounded recovery ([c5f955b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c5f955bc82adcb6999a89d5bc278fa87fccee022))
|
|
126
|
+
* **providers:** one failure has one executor, and the retry bridge is checked ([e73c4c7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e73c4c76ff20a9708083659bdcefe74870a84837))
|
|
127
|
+
* **questions:** refuse the deletion of a temporary path without the judge ([ab29694](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ab29694f36c1ff020b3b19ca542a27b37847055c))
|
|
128
|
+
* **quota:** a fresh capture and a low allowance decide the MiniMax recovery ([06d7b8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/06d7b8e971e0da58a344f75778c98edb442562bd))
|
|
129
|
+
* **quota:** the empty week waits for the human, the overload of a compaction shares the executor ([bbb0c39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/bbb0c3909b11735343e84be690c4c47e67a563bb))
|
|
130
|
+
* **recovery:** a MiniMax quota exhaustion waits for the captured reset plus ten minutes ([5af08a0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5af08a0e86c8c93fa5b7ff64a7b08e4514bc68f3))
|
|
131
|
+
* **review:** the review starts on its own when the implementation is done ([04f51f5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/04f51f599cd3222b6c74dd8fadb1373bd72d9bd7))
|
|
132
|
+
* **scope:** a marked resume and a backlog that only an approval starts ([19d3320](https://github.com/ManotLuijiu/pi-harness-runtime/commit/19d33204819cf05e678996fddf4c4621f0dd7d2f))
|
|
133
|
+
* **status:** the status line names the phase, the progress and the children ([0167bf3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0167bf396a0b987c1d44f3b869351976a951dd65))
|
|
134
|
+
* **test:** the task waits for the final tier of the validation plan ([fa147db](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa147dbf7d50d56e6ea48c6d8fbb4fcb190caf8a))
|
|
135
|
+
* **validation:** a large job starts with a measured pilot ([425964b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/425964b04a3d4fa02adfabed47ff62c5ec2b9c28))
|
|
136
|
+
* **validation:** the size of a job is a fact, not a phrase ([8aa6c11](https://github.com/ManotLuijiu/pi-harness-runtime/commit/8aa6c119565d0f8412dc8aeafa6b295d47d3f093))
|
|
137
|
+
* **workspace:** a Frappe bench names the mode of the workspace ([9d58517](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d585172063a330992fee933316e268ae9985e3c))
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
### Bug Fixes
|
|
141
|
+
|
|
142
|
+
* **ci:** every run of a required check counts, and the worst one decides ([da9e0da](https://github.com/ManotLuijiu/pi-harness-runtime/commit/da9e0da6b0ca29cb320764fd5fc1b8a8dee8b1e0))
|
|
143
|
+
* **ci:** the newest attempt of a run decides, not the attempt that failed ([9d7adcc](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9d7adcc31cbacc517c3c1a9bcd3956be94c908ef))
|
|
144
|
+
* **harness:** a raw control byte hid the request scope from the review ([852b1ff](https://github.com/ManotLuijiu/pi-harness-runtime/commit/852b1ff3afc21adb71e92b85d21ff1c88e14816a))
|
|
145
|
+
* **honcho:** a handshake that never finishes is named instead of hanging the startup ([d66005f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d66005f928a4f8df5de5b8a0579cbd4f8df37ff9))
|
|
146
|
+
* **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))
|
|
147
|
+
* **honcho:** a slow connector is not a failed one, the row is corrected when the tools appear ([b62ac5b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b62ac5b16ad93e2bfb10cbec589b80a09b7e20b3))
|
|
148
|
+
* **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))
|
|
149
|
+
* **honcho:** the report names the state of the MCP server, not the registration ([762f4d5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/762f4d59e4eabcab9a1c21a61aa522c3267621b3))
|
|
150
|
+
* **hooks:** a tag is checked through the commit behind it ([c823e8e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/c823e8e1f6973c62b5449a97c101759a4d5cbba5))
|
|
151
|
+
* **jev:** a completion question, a stale check and a pending validation ([827120b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/827120b4138b6f5ae253e69154de190085703de8))
|
|
152
|
+
* **jev:** a new request does not inherit the completion of the old one ([0f863c7](https://github.com/ManotLuijiu/pi-harness-runtime/commit/0f863c7fcaf35e261beabebef15b8ab634132fdc))
|
|
153
|
+
* **jev:** a prohibition must not hide a destructive action ([78a6cc1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/78a6cc199e647f812e145483f7e94991358d8f34))
|
|
154
|
+
* **jev:** a refusal without punctuation, and only a decline of an action ([ef3dbf8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ef3dbf87a2a1725373281613a0d48881ed5d2239))
|
|
155
|
+
* **jev:** a rejection during the countdown pauses the work ([9b018ce](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9b018ce1152b6724dee73cdc901b8a360ecc91ab))
|
|
156
|
+
* **jev:** a session switch ends the wait of the old session ([ca03d39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ca03d399c0d4a1b2dd428ac39836ab53c0e51ab6))
|
|
157
|
+
* **jev:** an open question is not a permission to answer it ([e20eca2](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e20eca24bb88d385198bb12ee3ebf573af9aea86))
|
|
158
|
+
* **jev:** keep a comparative caveat with the option it constrains ([7be306b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7be306b0d0872713ebca9386d613ae5a8da9d5b6))
|
|
159
|
+
* **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))
|
|
160
|
+
* **jev:** the action of the question, and an open question blocks the work ([1f9ff39](https://github.com/ManotLuijiu/pi-harness-runtime/commit/1f9ff39efc4ee17464c54c2ca9b583245093dbac))
|
|
161
|
+
* **jev:** the alternatives of a question are parsed without a quadratic pattern ([63016a3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/63016a3f0488acb801990dd46770c00d382b5858))
|
|
162
|
+
* **jev:** the countdown of an obsolete question does not outlive the work ([fe78b29](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fe78b29e6fc513b11a6993bc68fd9418dc77f79b))
|
|
163
|
+
* **jev:** the facts of an option survive the wording of the agent ([5a6250c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5a6250c07aa8d965bc6ae242cccbf519477598f8))
|
|
164
|
+
* **jev:** the scope decides the question, the identity guards the awaits ([ed348b2](https://github.com/ManotLuijiu/pi-harness-runtime/commit/ed348b2f94460a3b3ac11c01afd4420ee4ec1020))
|
|
165
|
+
* **jev:** the scope of a request on every human path, and the todos it touched ([cec8f36](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cec8f3644333b1d13a203340df80a30fef5c1ac0))
|
|
166
|
+
* **jev:** the subject of the scope decides, a clarification is preserved ([faf6a0f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/faf6a0fe7d0dce94d4fa48d0d7a57d126556ba6d))
|
|
167
|
+
* **keys:** the key directory is audited as a tree ([081cc75](https://github.com/ManotLuijiu/pi-harness-runtime/commit/081cc75ac8ceff36b0d619c3f76371dc08459d3c))
|
|
168
|
+
* **logging:** the query window no longer rots with the wall clock ([cd3f5b1](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cd3f5b18d8a4b8850a201d060699e18bf789a647))
|
|
169
|
+
* **logging:** the sanitizer of a message writes its control characters as escapes ([f4bbdb9](https://github.com/ManotLuijiu/pi-harness-runtime/commit/f4bbdb94bc1801d4228142bc1a1b31505c42a575))
|
|
170
|
+
* **mcp:** the connector and the watcher stop with the session ([4d1b87d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/4d1b87d14d015749025b62bf54d6d0b6137295f7))
|
|
171
|
+
* **mcp:** the connector survives a runtime that cannot list the servers ([d0f555f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d0f555fa14f51de33591e572a41ded5b59a3e4dd))
|
|
172
|
+
* **merge:** the boolean input is read as a boolean ([971b716](https://github.com/ManotLuijiu/pi-harness-runtime/commit/971b7169a43db382dbdeb6bb9bab02ab56e0351c))
|
|
173
|
+
* **merge:** the manual job needs the right of the merge ([7ba685e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7ba685ec43d815f90aa35b742579e87e76c69209))
|
|
174
|
+
* **merge:** the merge of the pull request is the GraphQL mutation ([972bab4](https://github.com/ManotLuijiu/pi-harness-runtime/commit/972bab4b0f7faf1b0047f3bb767ef6db3de4b2fa))
|
|
175
|
+
* **merge:** the workflow merges the pull request the gates cleared ([d7639ec](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d7639ec9b83723510acb4a5c4e23d5d6167c3af6))
|
|
176
|
+
* **providers:** the escape of the user stops the recovery, and a permanent failure clears it ([cfe5797](https://github.com/ManotLuijiu/pi-harness-runtime/commit/cfe57976bf463c327e45b874fd297c3e942246b8))
|
|
177
|
+
* **providers:** the pause wins over a retry, and the retry starts when the run settles ([e016dd2](https://github.com/ManotLuijiu/pi-harness-runtime/commit/e016dd2a5add5b0f3c848a225a28a59e0f5fc7f3))
|
|
178
|
+
* **recovery:** a cancelled countdown does not own the next attempt ([7b79f30](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7b79f301389fae48201e696d3086d257ed722fb9))
|
|
179
|
+
* **recovery:** a cancelled retry of Pi is a cancelled decision, a spent budget is not ([7e13f15](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7e13f156a279cded2b2d4b0c99358100b3d5e038))
|
|
180
|
+
* **recovery:** a manual request takes the work back from the countdown ([fa81d8f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/fa81d8fd9d6160166a095e07bdf17049bbafa32d))
|
|
181
|
+
* **recovery:** the predicate of Pi decides the retry, the provider identity is normalized ([6c8c17b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/6c8c17b53302cea1602d192251eacd0ebbd3e8c9))
|
|
182
|
+
* **release:** a manual release keeps the version of its manifest ([122e661](https://github.com/ManotLuijiu/pi-harness-runtime/commit/122e661ea48cb8aff14c71dbd0221a4cf0ba4c8e))
|
|
183
|
+
* **release:** the alignment names the reason of a failure ([5814dd0](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5814dd0b780f5839cf8011ed0cbbbb31e7eb0418))
|
|
184
|
+
* **release:** the channels of the package name the release ([a7a273f](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a7a273ffe8398e2b5b07ef1c321777de41792c6e))
|
|
185
|
+
* **release:** the lockfile knows the new workspace package ([6d0a143](https://github.com/ManotLuijiu/pi-harness-runtime/commit/6d0a143fe9853deafbaa8a04433a53da36355c43))
|
|
186
|
+
* **release:** the release publishes and leaves the channels alone ([5871746](https://github.com/ManotLuijiu/pi-harness-runtime/commit/5871746589c1281d855dbeb591b02419fa43f22e))
|
|
187
|
+
* **release:** the release pull request names the version of its branch ([a846e83](https://github.com/ManotLuijiu/pi-harness-runtime/commit/a846e83e6de6e529f4bca05e869db0b5eebb37c5))
|
|
188
|
+
* **release:** the release scans the tree of the commit it publishes ([7d47a0b](https://github.com/ManotLuijiu/pi-harness-runtime/commit/7d47a0b5406480a1e1d3a52623a76aabd1e2d0ba))
|
|
189
|
+
* **scope:** a session that ends leaves no proposal behind ([9aad01e](https://github.com/ManotLuijiu/pi-harness-runtime/commit/9aad01e1f13446da1d01032e9967cadf66772792))
|
|
190
|
+
* **scope:** the findings of the review of the scope expansion ([92372e5](https://github.com/ManotLuijiu/pi-harness-runtime/commit/92372e51ca31198593025ce8671b226d2ca7182e))
|
|
191
|
+
* **scope:** the question of a proposal is not obsolete and a rejection is named ([d4c58c3](https://github.com/ManotLuijiu/pi-harness-runtime/commit/d4c58c3e63e27449ef1de0f8e4e55ebbf342ff7d))
|
|
192
|
+
* **test:** a slow module is not a module that blocks ([296d5c8](https://github.com/ManotLuijiu/pi-harness-runtime/commit/296d5c8aae4f324fbae372c872a7450bf2f60926))
|
|
193
|
+
* **test:** the host of the API is compared, not a fragment of the URL ([539fb8a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/539fb8a772fe203d6eb8703cc84eba8be475f2a7))
|
|
194
|
+
* **test:** the quota capture integration needs the runtime of bun ([86fae7d](https://github.com/ManotLuijiu/pi-harness-runtime/commit/86fae7de31e76414aa31bb75eb136155f62d7a40))
|
|
195
|
+
* **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))
|
|
196
|
+
* **workspace:** keep a client name out of the comment about the search depth ([b572e0a](https://github.com/ManotLuijiu/pi-harness-runtime/commit/b572e0af16ff562203bda2b5c47b41807cff5a95))
|
|
197
|
+
* **workspace:** the repository names the mode before the mode stays unknown ([188a32c](https://github.com/ManotLuijiu/pi-harness-runtime/commit/188a32c7a6af1465dd24714278fccc73d06f6477))
|
|
198
|
+
|
|
5
199
|
### [1.1.516](https://github.com/ManotLuijiu/pi-harness-runtime/compare/v1.1.448...v1.1.516) (2026-11-17)
|
|
6
200
|
|
|
7
201
|
|
|
@@ -31,6 +31,15 @@ import type {
|
|
|
31
31
|
} from "./delegated-approval-types.ts";
|
|
32
32
|
import { delegationCovers } from "./delegated-approval-types.ts";
|
|
33
33
|
|
|
34
|
+
/**
|
|
35
|
+
* The delay before a request whose deadline passed is tried again.
|
|
36
|
+
*
|
|
37
|
+
* The work can be paused or busy at the moment the deadline passes. The
|
|
38
|
+
* decision of the delegation waits for the work to run again: a delegation
|
|
39
|
+
* of the user must not be lost because the session was not free.
|
|
40
|
+
*/
|
|
41
|
+
const RETRY_DELAY_MS = 60_000;
|
|
42
|
+
|
|
34
43
|
/** What the caller wants to ask the human. */
|
|
35
44
|
export interface OpenApprovalInput {
|
|
36
45
|
/** The canonical id of the request. It is the id of the pending question. */
|
|
@@ -85,6 +94,15 @@ export interface DelegatedApprovalDeps {
|
|
|
85
94
|
* what guarantees it.
|
|
86
95
|
*/
|
|
87
96
|
resume(request: ApprovalRequest, decision: ApprovalDecision): void;
|
|
97
|
+
/**
|
|
98
|
+
* The request was decided by the deadline.
|
|
99
|
+
*
|
|
100
|
+
* The caller settles the request here: it resolves the question of the
|
|
101
|
+
* request and ends the wait of the judge. The hook runs before the
|
|
102
|
+
* resume is queued, so the continuation never starts while the
|
|
103
|
+
* question is still open.
|
|
104
|
+
*/
|
|
105
|
+
onDecided?(request: ApprovalRequest, decision: ApprovalDecision): void;
|
|
88
106
|
/**
|
|
89
107
|
* Is the work of the request still active?
|
|
90
108
|
*
|
|
@@ -107,7 +125,6 @@ export class DelegatedApprovalRuntime {
|
|
|
107
125
|
private readonly requests = new Map<string, ApprovalRequest>();
|
|
108
126
|
/** The timer of the earliest deadline. */
|
|
109
127
|
private timer: ReturnType<typeof setTimeout> | null = null;
|
|
110
|
-
|
|
111
128
|
constructor(deps: DelegatedApprovalDeps) {
|
|
112
129
|
this.deps = deps;
|
|
113
130
|
}
|
|
@@ -140,16 +157,46 @@ export class DelegatedApprovalRuntime {
|
|
|
140
157
|
private armTimer(): void {
|
|
141
158
|
this.stop();
|
|
142
159
|
const now = this.deps.now();
|
|
143
|
-
const
|
|
160
|
+
const pending = this.pending();
|
|
161
|
+
const next = pending
|
|
144
162
|
.filter((request) => request.deadlineAt > now)
|
|
145
163
|
.sort((a, b) => a.deadlineAt - b.deadlineAt)[0];
|
|
146
|
-
if (
|
|
147
|
-
|
|
164
|
+
if (next) {
|
|
165
|
+
this.arm(Math.max(0, next.deadlineAt - now), next.requestId);
|
|
166
|
+
return;
|
|
167
|
+
}
|
|
168
|
+
// A request whose deadline passed but that could not be decided -
|
|
169
|
+
// the work was paused, or the session was busy - is tried again:
|
|
170
|
+
// the delegation of the user must not be lost because the session
|
|
171
|
+
// was not free at that moment.
|
|
172
|
+
const overdue = pending
|
|
173
|
+
.filter((request) => request.deadlineAt <= now)
|
|
174
|
+
.sort((a, b) => a.deadlineAt - b.deadlineAt)[0];
|
|
175
|
+
if (overdue) {
|
|
176
|
+
this.arm(RETRY_DELAY_MS, overdue.requestId);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Arm one timer for one request.
|
|
182
|
+
*
|
|
183
|
+
* The timer never throws: a decision that fails must not take the
|
|
184
|
+
* timer chain of the other requests with it.
|
|
185
|
+
*/
|
|
186
|
+
private arm(delay: number, requestId: string): void {
|
|
148
187
|
const timer = setTimeout(() => {
|
|
149
188
|
this.timer = null;
|
|
150
|
-
|
|
189
|
+
try {
|
|
190
|
+
this.expire(requestId);
|
|
191
|
+
} catch (error) {
|
|
192
|
+
this.deps.log?.(
|
|
193
|
+
`The deadline of the approval request ${requestId} failed: ${
|
|
194
|
+
error instanceof Error ? error.message : String(error)
|
|
195
|
+
}`,
|
|
196
|
+
);
|
|
197
|
+
}
|
|
151
198
|
this.armTimer();
|
|
152
|
-
}, delay);
|
|
199
|
+
}, Math.max(0, delay));
|
|
153
200
|
// The timer must not hold the process of the harness open.
|
|
154
201
|
(timer as { unref?: () => void }).unref?.();
|
|
155
202
|
this.timer = timer;
|
|
@@ -227,7 +274,10 @@ export class DelegatedApprovalRuntime {
|
|
|
227
274
|
): ApprovalDecision | null {
|
|
228
275
|
const request = this.requests.get(requestId);
|
|
229
276
|
if (!request) return null;
|
|
230
|
-
|
|
277
|
+
// A request that is not decided yet may still be answered: a
|
|
278
|
+
// request that was not delivered, or whose deadline passed without
|
|
279
|
+
// an authorization, is still a question of the human.
|
|
280
|
+
if (request.state !== "pending" && request.state !== "expired") {
|
|
231
281
|
this.deps.log?.(
|
|
232
282
|
`The approval request ${requestId} was answered already - the answer is stale.`,
|
|
233
283
|
);
|
|
@@ -243,10 +293,22 @@ export class DelegatedApprovalRuntime {
|
|
|
243
293
|
// The claim is atomic: two answers that arrive at the same moment
|
|
244
294
|
// still produce one decision.
|
|
245
295
|
if (!this.deps.decisions.claim(decision)) {
|
|
296
|
+
// The decision was made already. The durable record is the
|
|
297
|
+
// truth: the answer of the human is stale, and the work must
|
|
298
|
+
// not continue a second time.
|
|
299
|
+
const known = this.deps.decisions.get(requestId);
|
|
246
300
|
this.deps.log?.(
|
|
247
|
-
`The approval request ${requestId} was
|
|
301
|
+
`The approval request ${requestId} was decided already - the answer of the human is stale.`,
|
|
248
302
|
);
|
|
249
|
-
|
|
303
|
+
if (known) {
|
|
304
|
+
request.state = "claimed";
|
|
305
|
+
request.answer = {
|
|
306
|
+
outcome: known.outcome,
|
|
307
|
+
source: known.source,
|
|
308
|
+
at: known.at,
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
return known ?? null;
|
|
250
312
|
}
|
|
251
313
|
request.state = "answered";
|
|
252
314
|
request.answer = { outcome, source: "human", at: decision.at };
|
|
@@ -260,47 +322,84 @@ export class DelegatedApprovalRuntime {
|
|
|
260
322
|
*
|
|
261
323
|
* The state of the work is checked before the claim, the claim is
|
|
262
324
|
* atomic, and the resume is queued at most once.
|
|
325
|
+
*
|
|
326
|
+
* The caller settles the request before the resume is queued: the
|
|
327
|
+
* decision is handed to `onDecided` first, so the question of the
|
|
328
|
+
* request is resolved and the wait of the judge ends before the
|
|
329
|
+
* continuation starts.
|
|
263
330
|
*/
|
|
264
331
|
expire(requestId: string): ApprovalDecision | null {
|
|
265
332
|
const request = this.requests.get(requestId);
|
|
266
333
|
if (!request) return null;
|
|
267
334
|
// The human wins: an answer that arrived before the claim is kept,
|
|
268
335
|
// and the deadline never overrides it.
|
|
269
|
-
if (request.state === "answered") {
|
|
336
|
+
if (request.state === "answered" || request.state === "claimed") {
|
|
270
337
|
this.deps.log?.(
|
|
271
|
-
`The approval request ${requestId} was
|
|
338
|
+
`The approval request ${requestId} was decided already - the deadline does not override it.`,
|
|
272
339
|
);
|
|
273
340
|
return null;
|
|
274
341
|
}
|
|
342
|
+
// A request that was not delivered, or whose deadline passed
|
|
343
|
+
// without an authorization, is not decided by the deadline: nobody
|
|
344
|
+
// was asked, or nobody authorized anything.
|
|
275
345
|
if (request.state !== "pending") return null;
|
|
346
|
+
// The deadline of the request is the only deadline. A request that
|
|
347
|
+
// is not due yet is not decided: the timer is armed again for the
|
|
348
|
+
// time that is left, and the decision waits for the deadline.
|
|
349
|
+
//
|
|
350
|
+
// The window of a delegated question starts with the delivery of the
|
|
351
|
+
// message, so the deadline of the request is later than the deadline
|
|
352
|
+
// of the question that was asked. A countdown that reaches zero
|
|
353
|
+
// first must not decide anything.
|
|
354
|
+
const now = this.deps.now();
|
|
355
|
+
if (now < request.deadlineAt) {
|
|
356
|
+
this.deps.log?.(
|
|
357
|
+
`The approval request ${requestId} is not due yet: the deadline is at ${request.deadlineAt}. The decision waits.`,
|
|
358
|
+
);
|
|
359
|
+
this.armTimer();
|
|
360
|
+
return null;
|
|
361
|
+
}
|
|
276
362
|
// A request that was cancelled, replaced or completed must not be
|
|
277
363
|
// continued by a deadline.
|
|
278
364
|
if (this.deps.active && !this.deps.active(request)) {
|
|
279
365
|
this.deps.log?.(
|
|
280
366
|
`The approval request ${requestId} is not active - the deadline does not continue it.`,
|
|
281
367
|
);
|
|
368
|
+
request.state = "expired";
|
|
282
369
|
return null;
|
|
283
370
|
}
|
|
284
371
|
if (this.deps.paused?.() === true) {
|
|
285
372
|
this.deps.log?.(
|
|
286
|
-
`The approval request ${requestId} is paused - the deadline does not continue it.`,
|
|
373
|
+
`The approval request ${requestId} is paused - the deadline does not continue it. The decision waits for the work to run again.`,
|
|
287
374
|
);
|
|
375
|
+
// The work is paused: the decision waits. The timer tries
|
|
376
|
+
// again, so a pause does not lose the delegation of the user.
|
|
377
|
+
this.armTimer();
|
|
288
378
|
return null;
|
|
289
379
|
}
|
|
290
380
|
// The scope of the delegation decides: an operation that no
|
|
291
381
|
// delegation covers stays blocked.
|
|
292
382
|
const delegation = this.delegationForRequest(request);
|
|
383
|
+
if (!delegation) {
|
|
384
|
+
// Nobody is authorized. The operation stays blocked, and the
|
|
385
|
+
// human may still answer. No decision is recorded: a deadline
|
|
386
|
+
// without a delegation is not a decision of the user, and a
|
|
387
|
+
// recorded decision would close the question for the human.
|
|
388
|
+
request.state = "expired";
|
|
389
|
+
this.deps.log?.(
|
|
390
|
+
`The deadline of the approval request ${requestId} passed and no delegation covers the operation: the operation stays blocked until the human answers.`,
|
|
391
|
+
);
|
|
392
|
+
return null;
|
|
393
|
+
}
|
|
293
394
|
const outcome: ApprovalOutcome =
|
|
294
|
-
delegation
|
|
395
|
+
delegation.defaultOutcome === "continue" ? "yes" : "no";
|
|
295
396
|
const decision: ApprovalDecision = {
|
|
296
397
|
requestId,
|
|
297
398
|
outcome,
|
|
298
399
|
source: "delegated-timeout",
|
|
299
|
-
|
|
300
|
-
reason: delegation
|
|
301
|
-
|
|
302
|
-
: "no delegation covers the operation",
|
|
303
|
-
at: this.deps.now(),
|
|
400
|
+
delegationId: delegation.id,
|
|
401
|
+
reason: `the deadline passed under the delegation ${delegation.id}`,
|
|
402
|
+
at: now,
|
|
304
403
|
};
|
|
305
404
|
// The claim is atomic and durable: the decision is handed out once,
|
|
306
405
|
// and a restart does not hand it out again.
|
|
@@ -308,10 +407,34 @@ export class DelegatedApprovalRuntime {
|
|
|
308
407
|
this.deps.log?.(
|
|
309
408
|
`The decision of the approval request ${requestId} was claimed already.`,
|
|
310
409
|
);
|
|
311
|
-
|
|
410
|
+
// The decision was made: the durable record is the truth, and
|
|
411
|
+
// the work must not continue a second time.
|
|
412
|
+
const known = this.deps.decisions.get(requestId);
|
|
413
|
+
if (known) {
|
|
414
|
+
request.state = "claimed";
|
|
415
|
+
request.answer = {
|
|
416
|
+
outcome: known.outcome,
|
|
417
|
+
source: known.source,
|
|
418
|
+
at: known.at,
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
return known ?? null;
|
|
312
422
|
}
|
|
313
423
|
request.state = "claimed";
|
|
314
424
|
request.answer = { outcome, source: "delegated-timeout", at: decision.at };
|
|
425
|
+
// The caller settles the request: the question of the request is
|
|
426
|
+
// resolved and the wait of the judge ends before the continuation
|
|
427
|
+
// is queued. A hook that throws must not strand the decision: the
|
|
428
|
+
// continuation is queued anyway.
|
|
429
|
+
try {
|
|
430
|
+
this.deps.onDecided?.(request, decision);
|
|
431
|
+
} catch (error) {
|
|
432
|
+
this.deps.log?.(
|
|
433
|
+
`The harness failed to settle the approval request ${requestId}: ${
|
|
434
|
+
error instanceof Error ? error.message : String(error)
|
|
435
|
+
}`,
|
|
436
|
+
);
|
|
437
|
+
}
|
|
315
438
|
if (outcome === "yes") {
|
|
316
439
|
// Exactly one resume: the claim is what guarantees it.
|
|
317
440
|
this.queueResume(request, decision);
|