@@ -26,6 +26,7 @@ import {
2626import type { ParsedAgentSessionKey } from "../routing/session-key.js" ;
2727import { withTempDir } from "../test-helpers/temp-dir.js" ;
2828import { withEnvAsync } from "../test-utils/env.js" ;
29+ import { CRON_TASK_KIND } from "./cron-task-contract.js" ;
2930import { SUBAGENT_KILL_TASK_ERROR } from "./detached-task-runtime-contract.js" ;
3031import { ensureTaskRuntimeStateReady } from "./runtime-internal.js" ;
3132import {
@@ -4775,25 +4776,37 @@ describe("task-registry", () => {
47754776
47764777 it . each ( [
47774778 {
4778- name : "cancels stale cron tasks without an active runtime abort handle" ,
4779+ name : "cancels stale legacy childless cron tasks without an active runtime abort handle" ,
4780+ taskKind : undefined ,
47794781 childSessionKey : undefined ,
47804782 cancelled : true ,
47814783 reason : undefined ,
47824784 status : "cancelled" ,
47834785 error : "Cancelled by operator." ,
47844786 } ,
4787+ {
4788+ name : "does not cancel canonical childless cron tasks without an active runtime abort handle" ,
4789+ taskKind : CRON_TASK_KIND ,
4790+ childSessionKey : undefined ,
4791+ cancelled : false ,
4792+ reason : "Cron task has no active cancellation handle." ,
4793+ status : "running" ,
4794+ error : undefined ,
4795+ } ,
47854796 {
47864797 name : "does not mark session-backed cron tasks cancelled without an active runtime abort handle" ,
4798+ taskKind : undefined ,
47874799 childSessionKey : "agent:main:cron:daily-repost" ,
47884800 cancelled : false ,
47894801 reason : "Cron task has no active cancellation handle." ,
47904802 status : "running" ,
47914803 error : undefined ,
47924804 } ,
4793- ] ) ( "$name" , async ( { childSessionKey, cancelled, reason, status, error } ) => {
4805+ ] ) ( "$name" , async ( { taskKind , childSessionKey, cancelled, reason, status, error } ) => {
47944806 await withTaskRegistryTempDir ( async ( ) => {
47954807 const task = createTaskFixture ( "cron" , {
47964808 sourceId : "daily-repost" ,
4809+ taskKind,
47974810 ownerKey : "" ,
47984811 scopeKind : "system" ,
47994812 childSessionKey,
0 commit comments