You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Every system task in this plugin is site-scoped workspace maintenance — disk/file/git cleanup driven by the Workspace service and gated by PluginSettings. None of them act as an agent or invoke an agent-scoped ability. Yet they all extends SystemTask, whose requiresAgentContext() defaults to true (the safe default for content-mutating tasks in data-machine core).
That default is wrong for this plugin's domain. It means every DMC task author must remember to override requiresAgentContext(): bool { return false; }, and forgetting fails quietly: the task is registered as an agent-less recurring schedule (per_agent => false), so TaskScheduler::schedule() rejects it at the agent-context gate and logs an error every tick — the cleanup just silently stops running.
That is exactly what happened in #564: workspace_disk_emergency_cleanup logged 213 identical hourly errors over 7 days and never cleaned disk. PR #565 fixed it by adding the override to five task classes (WorkspaceDiskEmergencyCleanupTask, WorktreeCleanupTask, WorkspaceRetentionCleanupTask, WorkspaceHygieneReportTask, WorktreeCleanupChunkTask) — five hand-copied identical methods.
Proposal
Introduce a thin MaintenanceTask base class in this plugin that sets the site-scoped default once, mirroring core's existing DataMachine\Engine\AI\System\Tasks\Retention\RetentionTask (which already does exactly this for retention cleanup):
namespaceDataMachineCode\Tasks;
useDataMachine\Engine\AI\System\Tasks\SystemTask;
abstractclass MaintenanceTask extends SystemTask {
/** * DMC tasks are site-scoped workspace maintenance with no agent owner. * Opt out of the agent-context gate by default; a task that genuinely * needs agent context can override back to true. */publicfunctionrequiresAgentContext(): bool {
returnfalse;
}
}
Then reparent the five maintenance tasks to extends MaintenanceTask and delete the five duplicated overrides.
Context
Follow-up hardening from #564 / PR #565.
Every system task in this plugin is site-scoped workspace maintenance — disk/file/git cleanup driven by the
Workspaceservice and gated byPluginSettings. None of them act as an agent or invoke an agent-scoped ability. Yet they allextends SystemTask, whoserequiresAgentContext()defaults totrue(the safe default for content-mutating tasks indata-machinecore).That default is wrong for this plugin's domain. It means every DMC task author must remember to override
requiresAgentContext(): bool { return false; }, and forgetting fails quietly: the task is registered as an agent-less recurring schedule (per_agent => false), soTaskScheduler::schedule()rejects it at the agent-context gate and logs an error every tick — the cleanup just silently stops running.That is exactly what happened in #564:
workspace_disk_emergency_cleanuplogged 213 identical hourly errors over 7 days and never cleaned disk. PR #565 fixed it by adding the override to five task classes (WorkspaceDiskEmergencyCleanupTask,WorktreeCleanupTask,WorkspaceRetentionCleanupTask,WorkspaceHygieneReportTask,WorktreeCleanupChunkTask) — five hand-copied identical methods.Proposal
Introduce a thin
MaintenanceTaskbase class in this plugin that sets the site-scoped default once, mirroring core's existingDataMachine\Engine\AI\System\Tasks\Retention\RetentionTask(which already does exactly this for retention cleanup):Then reparent the five maintenance tasks to
extends MaintenanceTaskand delete the five duplicated overrides.Why this is the right shape
data-machinecore (RetentionTaskdoes the same opt-out in its base).trueexplicitly — the escape hatch stays open in the other direction.Acceptance criteria
MaintenanceTaskabstract base ininc/Tasks/setsrequiresAgentContext(): false.requiresAgentContext() === false.php -lclean; existing task scheduling continues to pass the gate.Constraints