Merge claudedo/1b599d6711914658b9857b3df996f6e0

This commit is contained in:
mika kuns
2026-08-05 16:03:14 +02:00
11 changed files with 483 additions and 27 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ ASP.NET Core hosted service that executes tasks via Claude CLI in isolated envir
Worker/
State/ — TaskStateService + TransitionResult (sole owner of Status/PlanningPhase/BlockedBy writes)
Queue/ — IQueueWaker, IQueuePicker, QueueService (BackgroundService), OverrideSlotService, RunCancellationRegistry (taskId → running-run CTS; lets TaskStateService.CancelAsync kill the process of a cancelled task/child without a DI cycle)
Lifecycle/ — StaleTaskRecovery, TaskResetService, TaskMergeService, VerifyCommandRunner (IVerifyCommandRunner — spawns a list's optional post-merge verify command via `cmd.exe /c`), ClaudeCliPreflight, OrphanRecovery, PlanningLineageRecovery, AttachmentOrphanRecovery (startup sweep: deletes any `attachments/<taskId>/` dirs whose task no longer exists)
Lifecycle/ — StaleTaskRecovery, TaskResetService, TaskMergeService, VerifyCommandRunner (IVerifyCommandRunner — spawns a list's optional post-merge verify command via `cmd.exe /c`), ClaudeCliPreflight, OrphanRecovery, PlanningLineageRecovery, AttachmentOrphanRecovery (startup sweep: deletes any `attachments/<taskId>/` dirs whose task no longer exists), PromptFileRecovery (startup sweep: `PromptFiles.ReconcileStaleDefaults()` drops any prompt override that only matched a now-superseded default and was never actually edited, `QuarantineOrphans()` moves *.md files under `prompts/` with no matching `PromptKind` into `prompts/_orphans/`)
Worktrees/ — WorktreeMaintenanceService
Agents/ — AgentFileService, DefaultAgentSeeder
Runner/ — TaskRunner + Claude CLI integration; TaskRunMcpService/TaskRunMcpContext/TaskRunTokenRegistry (in-task MCP wired during execution)
@@ -0,0 +1,36 @@
using ClaudeDo.Data;
namespace ClaudeDo.Worker.Lifecycle;
/// <summary>
/// Startup-only sweep: drops any prompt override file that only matched a now-superseded
/// bundled default and was never actually edited (see <see cref="PromptFiles.ReconcileStaleDefaults"/>),
/// and quarantines any *.md file under the prompts root that no longer maps to a known
/// <see cref="PromptKind"/> (leftovers from a retired naming scheme).
/// </summary>
public sealed class PromptFileRecovery : IHostedService
{
private readonly ILogger<PromptFileRecovery> _logger;
private readonly string? _root;
public PromptFileRecovery(ILogger<PromptFileRecovery> logger, string? root = null)
{
_logger = logger;
_root = root;
}
public Task StartAsync(CancellationToken cancellationToken)
{
PromptFiles.ReconcileStaleDefaults(_root);
var orphans = PromptFiles.QuarantineOrphans(_root);
if (orphans.Count > 0)
_logger.LogWarning("Prompt file recovery: quarantined {Count} orphaned prompt file(s) into _orphans", orphans.Count);
else
_logger.LogInformation("Prompt file recovery: no orphaned prompt files found");
return Task.CompletedTask;
}
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
}
+1
View File
@@ -63,6 +63,7 @@ builder.Services.AddSingleton<AttachmentStore>();
builder.Services.AddHostedService<StaleTaskRecovery>();
builder.Services.AddHostedService<OrphanRecovery>();
builder.Services.AddHostedService<AttachmentOrphanRecovery>();
builder.Services.AddHostedService<PromptFileRecovery>();
builder.Services.AddSignalR().AddJsonProtocol(options =>
{
options.PayloadSerializerOptions.Converters.Add(new System.Text.Json.Serialization.JsonStringEnumConverter());