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.
64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using Microsoft.EntityFrameworkCore.Migrations;
|
|
|
|
#nullable disable
|
|
|
|
namespace ClaudeDo.Data.Migrations
|
|
{
|
|
/// <inheritdoc />
|
|
public partial class AddMaxTurnsCeiling : Migration
|
|
{
|
|
/// <inheritdoc />
|
|
protected override void Up(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "default_max_turns",
|
|
table: "app_settings",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 40,
|
|
oldClrType: typeof(int),
|
|
oldType: "INTEGER",
|
|
oldDefaultValue: 30);
|
|
|
|
migrationBuilder.AddColumn<int>(
|
|
name: "max_turns_ceiling",
|
|
table: "app_settings",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 80);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "app_settings",
|
|
keyColumn: "id",
|
|
keyValue: 1,
|
|
columns: new[] { "default_max_turns", "max_turns_ceiling" },
|
|
values: new object[] { 40, 80 });
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
protected override void Down(MigrationBuilder migrationBuilder)
|
|
{
|
|
migrationBuilder.DropColumn(
|
|
name: "max_turns_ceiling",
|
|
table: "app_settings");
|
|
|
|
migrationBuilder.AlterColumn<int>(
|
|
name: "default_max_turns",
|
|
table: "app_settings",
|
|
type: "INTEGER",
|
|
nullable: false,
|
|
defaultValue: 30,
|
|
oldClrType: typeof(int),
|
|
oldType: "INTEGER",
|
|
oldDefaultValue: 40);
|
|
|
|
migrationBuilder.UpdateData(
|
|
table: "app_settings",
|
|
keyColumn: "id",
|
|
keyValue: 1,
|
|
column: "default_max_turns",
|
|
value: 100);
|
|
}
|
|
}
|
|
}
|