Runaway sessions were the single biggest cost driver: model_presets was never persisted (stayed code-only), default_max_turns shipped at 100, and ResolveMaxTurns had no upper bound, so a task/list override could run hundreds of turns unchecked. - TaskRunner.ResolveMaxTurns now clamps the resolved value to AppSettings.MaxTurnsCeiling (new column, default 80) and logs a warning with task id / requested / effective value when it clamps. - default_max_turns default lowered from 100 to 40 (entity, EF config, and the seeded row via the new AddMaxTurnsCeiling migration). - AppSettingsRepository.GetAsync backfills model_presets with the shipping defaults on first read instead of leaving the column null. - Settings > General's per-model preset table and the task/list agent editor now show a hint when a set max-turns value exceeds the ceiling.
46 lines
2.0 KiB
C#
46 lines
2.0 KiB
C#
namespace ClaudeDo.Data.Models;
|
|
|
|
public sealed class AppSettingsEntity
|
|
{
|
|
public const int SingletonId = 1;
|
|
|
|
public int Id { get; set; } = SingletonId;
|
|
|
|
public string DefaultClaudeInstructions { get; set; } = string.Empty;
|
|
public string DefaultModel { get; set; } = "sonnet";
|
|
public int DefaultMaxTurns { get; set; } = 40;
|
|
public string DefaultPermissionMode { get; set; } = "auto";
|
|
|
|
// Hard ceiling every resolved max-turns value (task/list/global) is clamped to before a run
|
|
// starts. Guards against runaway sessions regardless of what a task/list override requests.
|
|
public int MaxTurnsCeiling { get; set; } = 80;
|
|
|
|
public int MaxParallelExecutions { get; set; } = 1;
|
|
|
|
public string WorktreeStrategy { get; set; } = "sibling";
|
|
public string? CentralWorktreeRoot { get; set; }
|
|
public bool WorktreeAutoCleanupEnabled { get; set; }
|
|
public int WorktreeAutoCleanupDays { get; set; } = 7;
|
|
|
|
// JSON array of parent folders remembered by the repo-import modal.
|
|
public string? RepoImportFolders { get; set; }
|
|
// JSON array of path prefixes whose sessions are excluded from the weekly report.
|
|
public string? ReportExcludedPaths { get; set; }
|
|
// DayOfWeek the standup happens on; default Wednesday. Drives the report's default range.
|
|
public int StandupWeekday { get; set; } = (int)DayOfWeek.Wednesday;
|
|
|
|
// Max number of open tasks the daily prep ("Prime Claude") may place in MyDay.
|
|
public int DailyPrepMaxTasks { get; set; } = 5;
|
|
|
|
// JSON array of session skill names applied by default to new tasks.
|
|
public string? SessionSkills { get; set; }
|
|
|
|
// JSON array of ModelPreset rows (model → effort + max turns). Supplies the global effort and
|
|
// turn defaults per model; list-/task-level max-turns overrides still win. Null = ship defaults.
|
|
public string? ModelPresets { get; set; }
|
|
|
|
// Percentage of the 5h/7d Claude usage window at which the autonomous queue pauses. 0 = gate off.
|
|
public int UsageGateFiveHourPct { get; set; } = 80;
|
|
public int UsageGateSevenDayPct { get; set; } = 90;
|
|
}
|