Skip to content

Commit 6c66e34

Browse files
committed
test(run-state): add an unsafe kernel for a rejected turn event
1 parent d670011 commit 6c66e34

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

‎docs/architecture/task-lifecycle-model.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ The checker also requires:
294294
- named witnesses, each tied to an event and the states around it: abort during a pending approval in a live stream, an ask after the stream ends, abandon after the stream ends, dispose after completion, a new stream after a failure cleanup without abort, a stream that starts without user input, an approval before the first stream, and a rejected late completion accept after a newer ask;
295295
- every ordered pair of the stream, ask, cancel, and dispose event sources to follow each other, where both events change the state;
296296
- no unseen successor at the depth bound;
297-
- thirty-three known-unsafe kernels, each of which the checker must reject. They include a throwing kernel, a kernel that returns nothing, and one kernel for each check that runs at every search step without the table; and
297+
- thirty-four known-unsafe kernels, each of which the checker must reject. They include a throwing kernel, a kernel that returns nothing, and one kernel for each check that runs at every search step without the table; and
298298
- self-tests that a small depth bound and a small state budget each fail the checker.
299299

300300
The kernel has no resume event. A resumed task is `initialized` followed by `streamStarted` or `askStarted`. The witnesses `first-stream-without-ask` and `approval-before-first-stream` cover those paths.

‎scripts/check-run-state-kernel.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,11 @@ const unsafeKernels: Record<string, UnsafeKernel> = {
821821
caughtBy: differsFor("turnStarted"),
822822
useTable: true,
823823
},
824+
"turn-event-rejected": {
825+
step: (state, event) => (event.tag === "toolUsed" ? { rejected: state } : nextRunState(state, event)),
826+
caughtBy: /toolUsed was rejected/,
827+
useTable: false,
828+
},
824829
"stream-start-resets-turn": {
825830
step: (state, event) => {
826831
const result = nextRunState(state, event)

0 commit comments

Comments
 (0)