A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
Enable auto refine by default (#349)
Seth Karten51a3ac19672f
diff --git a/packages/coding-agent/CHANGELOG.md b/packages/coding-agent/CHANGELOG.mdindex e94cc40293..f51c54e232 100644--- a/packages/coding-agent/CHANGELOG.md+++ b/packages/coding-agent/CHANGELOG.md@@ -2,6 +2,9 @@## [Unreleased]+- Changed automatic harness refinement to be enabled by default while keeping `autoRefine.enabled: false` as the opt-out.+- Fixed non-numeric `autoRefine.turnInterval` and `autoRefine.cooldownMs` settings falling back to defaults instead of silently enabling a noisy auto-refine loop.+## [0.2.7] - 2026-07-08- Changed subagent and refinement guidance to favor non-blocking subagent tasks by default, use disk-backed tracking for long-running fan-out, inspect or message live subagents when agent observation/messaging skills are available, and capture reusable delegation roles, procedures, facts, preferences, and prompt addendums with `/refine`.diff --git a/packages/coding-agent/src/core/settings-manager.ts b/packages/coding-agent/src/core/settings-manager.tsindex cb18a20bea..739c653b06 100644--- a/packages/coding-agent/src/core/settings-manager.ts+++ b/packages/coding-agent/src/core/settings-manager.ts@@ -20,7 +20,7 @@ export interface BranchSummarySettings {}export interface AutoRefineSettings {- enabled?: boolean; // default: false+ enabled?: boolean; // default: trueturnInterval?: number; // default: 25 assistant turnscompact?: boolean; // default: truecooldownMs?: number; // default: 20 minutes@@ -777,11 +777,19 @@ export class SettingsManager {}getAutoRefineSettings(): { enabled: boolean; turnInterval: number; compact: boolean; cooldownMs: number } {+ const turnInterval = this.settings.autoRefine?.turnInterval;+ const cooldownMs = this.settings.autoRefine?.cooldownMs;return {- enabled: this.settings.autoRefine?.enabled ?? false,- turnInterval: Math.max(1, this.settings.autoRefine?.turnInterval ?? 25),+ enabled: this.settings.autoRefine?.enabled ?? true,+ turnInterval: Math.max(+ 1,+ typeof turnInterval === "number" && Number.isFinite(turnInterval) ? turnInterval : 25,+ ),compact: this.settings.autoRefine?.compact ?? true,- cooldownMs: Math.max(0, this.settings.autoRefine?.cooldownMs ?? 20 * 60_000),+ cooldownMs: Math.max(+ 0,+ typeof cooldownMs === "number" && Number.isFinite(cooldownMs) ? cooldownMs : 20 * 60_000,+ ),};}diff --git a/packages/coding-agent/test/settings-manager.test.ts b/packages/coding-agent/test/settings-manager.test.tsindex 20c72c73a6..c09b17df0b 100644--- a/packages/coding-agent/test/settings-manager.test.ts+++ b/packages/coding-agent/test/settings-manager.test.ts@@ -212,6 +212,63 @@ describe("SettingsManager", () => {});});+ describe("autoRefine", () => {+ it("defaults to enabled while preserving explicit opt-out", () => {+ const manager = SettingsManager.create(projectDir, agentDir);++ expect(manager.getAutoRefineSettings()).toEqual({+ enabled: true,+ turnInterval: 25,+ compact: true,+ cooldownMs: 20 * 60_000,+ });++ writeFileSync(join(agentDir, "settings.json"), JSON.stringify({ autoRefine: { enabled: false } }));+ const optedOut = SettingsManager.create(projectDir, agentDir);++ expect(optedOut.getAutoRefineSettings().enabled).toBe(false);+ });++ it("falls back to defaults for non-numeric turnInterval and cooldownMs", () => {+ writeFileSync(+ join(agentDir, "settings.json"),+ JSON.stringify({ autoRefine: { turnInterval: "oops", cooldownMs: "nope" } }),+ );+ const manager = SettingsManager.create(projectDir, agentDir);++ const settings = manager.getAutoRefineSettings();+ expect(settings.turnInterval).toBe(25);+ expect(settings.cooldownMs).toBe(20 * 60_000);+ expect(Number.isFinite(settings.turnInterval)).toBe(true);+ expect(Number.isFinite(settings.cooldownMs)).toBe(true);+ });++ it("ignores non-finite numeric values that parse to Infinity", () => {+ // 1e999 is valid JSON that JSON.parse turns into Infinity.+ writeFileSync(+ join(agentDir, "settings.json"),+ `{ "autoRefine": { "turnInterval": 1e999, "cooldownMs": 1e999 } }`,+ );+ const manager = SettingsManager.create(projectDir, agentDir);++ const settings = manager.getAutoRefineSettings();+ expect(settings.turnInterval).toBe(25);+ expect(settings.cooldownMs).toBe(20 * 60_000);+ });++ it("preserves valid numeric overrides", () => {+ writeFileSync(+ join(agentDir, "settings.json"),+ JSON.stringify({ autoRefine: { turnInterval: 5, cooldownMs: 1000 } }),+ );+ const manager = SettingsManager.create(projectDir, agentDir);++ const settings = manager.getAutoRefineSettings();+ expect(settings.turnInterval).toBe(5);+ expect(settings.cooldownMs).toBe(1000);+ });+ });+describe("recentModels", () => {it("records most-recently-used first, dedupes, and persists", async () => {const manager = SettingsManager.create(projectDir, agentDir);