A self-improving RLM agent for coding workflows and long-running autonomous tasks.
Rust
[RSI] feat(coding-agent): persist autonomous limits and subagent default model in settings (#2281)
Seth Karten13f52b01cdf0
diff --git a/packages/coding-agent/.changes/settings-autonomous-subagent-model.md b/packages/coding-agent/.changes/settings-autonomous-subagent-model.mdnew file mode 100644index 0000000000..5b7f92f0ea--- /dev/null+++ b/packages/coding-agent/.changes/settings-autonomous-subagent-model.md@@ -0,0 +1,3 @@+- Added `autonomous` settings (`maxContinuations`, `maxTurns`, `maxTokens`, `timeoutMs`, each a positive number or `"unlimited"`) that persist the default budget for autonomous runs, so long-horizon runs keep a user-defined budget without re-passing `--autonomous-*` CLI or `/autonomous on` flags; explicit per-run flags still win.+- Added the `subagentDefaultModel` setting: `rlm.spawn` calls that do not pin a model resolve against this persisted default (shown in the spawn receipt's `model` field) instead of always inheriting the parent model; unset keeps inherit-parent, and an unavailable default fails the spawn instead of silently falling back.+- Fixed the bundled goal skill's canonical example, which still taught `token_budget=200000` against its own "set `token_budget` only when an explicit token budget is requested" guidance.diff --git a/packages/coding-agent/docs/settings.md b/packages/coding-agent/docs/settings.mdindex 3fc0b77197..40d20c9773 100644--- a/packages/coding-agent/docs/settings.md+++ b/packages/coding-agent/docs/settings.md@@ -17,9 +17,32 @@ Edit directly or use `/settings` for common options.|---------|------|---------|-------------|| `defaultProvider` | string | - | Default provider (e.g., `"anthropic"`, `"openai"`) || `defaultModel` | string | - | Default model ID |+| `subagentDefaultModel` | string | - | Model selector (`"provider/id"`) used when `rlm.spawn` does not pin a model; unset inherits the parent model || `defaultThinkingLevel` | string | `"xhigh"` | `"off"`, `"minimal"`, `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"` || `thinkingBudgets` | object | - | Custom token budgets per thinking level |+`subagentDefaultModel` applies only to spawned subagents whose `rlm.spawn` call omits `model=`. An explicit `model=` per spawn always wins, and an unset setting keeps the inherit-parent behavior. If the configured default is unavailable, unauthenticated, or expired, the spawn fails with that error instead of silently falling back.++### Autonomous Runs++| Setting | Type | Default | Description |+|---------|------|---------|-------------|+| `autonomous.maxContinuations` | number or `"unlimited"` | `3` | Continuation budget for autonomous runs |+| `autonomous.maxTurns` | number or `"unlimited"` | `12` | Turn budget for autonomous runs |+| `autonomous.maxTokens` | number or `"unlimited"` | `80000` | Token budget for autonomous runs |+| `autonomous.timeoutMs` | number or `"unlimited"` | `1800000` | Wall-clock budget in milliseconds |++```json+{+ "autonomous": {+ "maxContinuations": "unlimited",+ "maxTokens": 1000000+ }+}+```++These are the persisted defaults for the same limits as the `--autonomous-*` CLI flags and `/autonomous on` budget flags. Set them once so every autonomous run starts with your budget instead of the built-in defaults; explicit flags on a given run still win. Invalid values are ignored per-field, falling back to the built-in defaults.+#### thinkingBudgets```jsondiff --git a/packages/coding-agent/skills/goal/SKILL.md b/packages/coding-agent/skills/goal/SKILL.mdindex 4f0650993c..c96c21856b 100644--- a/packages/coding-agent/skills/goal/SKILL.md+++ b/packages/coding-agent/skills/goal/SKILL.md@@ -12,7 +12,9 @@ it. Call it directly from the Python REPL:```pythonawait goal.get()-await goal.create("ship the release notes", token_budget=200000)+await goal.create("ship the release notes")+# Only pass token_budget when the user explicitly asks for one:+# await goal.create("ship the release notes", token_budget=200000)await goal.complete()```diff --git a/packages/coding-agent/src/core/agent-session.ts b/packages/coding-agent/src/core/agent-session.tsindex f834bed733..50e0153f08 100644--- a/packages/coding-agent/src/core/agent-session.ts+++ b/packages/coding-agent/src/core/agent-session.ts@@ -1557,6 +1557,7 @@ export class AgentSession {this._subagentRuntimeHost = config.subagentRuntimeHost;this._autonomousState = createAutonomousRuntimeState(config.autonomous, {cwd: this._cwd,+ defaultLimits: this.settingsManager.getAutonomousLimits(),});this._goalState = this._loadPersistedGoalState();// Seed initial goal from CLI --goal flag, but only for top-level sessions@@ -11503,6 +11504,18 @@ export class AgentSession {const normalizedReference = reference.toLowerCase();if (`${parentModel.provider}/${parentModel.id}`.toLowerCase() === normalizedReference) {+ // The parent model is in active use, so a catalog miss must not+ // exclude it (e.g. an offline discovery refresh), but a stale or+ // expired provider has to fail the spawn here instead of starting+ // a child that fails its first model request.+ const status = this._modelRegistry.getProviderAuthStatus(parentModel.provider);+ if (status.source === "stale" || status.label === "expired") {+ throw new Error(`Requested ${target} model "${reference}" is unavailable, unauthenticated, or expired`);+ }+ const auth = await this._modelRegistry.getApiKeyAndHeaders(parentModel);+ if (!auth.ok) {+ throw new Error(`Requested ${target} model "${reference}" failed authentication preflight`);+ }return { model: parentModel };}const model = (await this._authenticatedRlmModels()).find(@@ -11551,7 +11564,12 @@ export class AgentSession {let modelSelection: RlmSubagentModelSelection;try {if (requestedSessionName) await this._assertRlmSubagentSessionNameAvailable(requestedSessionName, true);- modelSelection = await this._resolveRlmSubagentModel(requestedModel);+ // An unpinned spawn model resolves against the persisted subagent+ // default; an unavailable default fails the spawn instead of silently+ // inheriting the parent model.+ modelSelection = await this._resolveRlmSubagentModel(+ requestedModel ?? this.settingsManager.getSubagentDefaultModel(),+ );} finally {if (requestedSessionName) this._pendingRlmSubagentSessionNames.delete(requestedSessionName);}diff --git a/packages/coding-agent/src/core/autonomous.ts b/packages/coding-agent/src/core/autonomous.tsindex 0dab26ce47..f370a074b1 100644--- a/packages/coding-agent/src/core/autonomous.ts+++ b/packages/coding-agent/src/core/autonomous.ts@@ -140,10 +140,24 @@ interface AutonomousOperationOptions {type GateFailure = AgentAutonomousGateFailure;+export type AutonomousLimitDefaults = Pick<+ AgentAutonomousConfig,+ "maxContinuations" | "maxTurns" | "maxTokens" | "timeoutMs"+>;+export function createAutonomousRuntimeState(config?: AgentAutonomousConfig,- _options: { cwd?: string } = {},+ options: { cwd?: string; defaultLimits?: AutonomousLimitDefaults } = {},): AutonomousRuntimeState {+ // Settings-derived defaults sit between the built-in limits and the explicit+ // config: explicit CLI/slash flags win, then persisted settings, then the+ // built-in defaults.+ const defaults: Required<AutonomousLimitDefaults> = {+ maxContinuations: options.defaultLimits?.maxContinuations ?? DEFAULT_AUTONOMOUS_LIMITS.maxContinuations,+ maxTurns: options.defaultLimits?.maxTurns ?? DEFAULT_AUTONOMOUS_LIMITS.maxTurns,+ maxTokens: options.defaultLimits?.maxTokens ?? DEFAULT_AUTONOMOUS_LIMITS.maxTokens,+ timeoutMs: options.defaultLimits?.timeoutMs ?? DEFAULT_AUTONOMOUS_LIMITS.timeoutMs,+ };const enabled = config?.enabled === true;return {enabled,@@ -152,10 +166,10 @@ export function createAutonomousRuntimeState(tokensUsed: 0,startedAt: enabled ? Date.now() : undefined,limits: {- maxContinuations: normalizeLimit(config?.maxContinuations, DEFAULT_AUTONOMOUS_LIMITS.maxContinuations),- maxTurns: normalizeLimit(config?.maxTurns, DEFAULT_AUTONOMOUS_LIMITS.maxTurns),- maxTokens: normalizeLimit(config?.maxTokens, DEFAULT_AUTONOMOUS_LIMITS.maxTokens),- timeoutMs: normalizeLimit(config?.timeoutMs, DEFAULT_AUTONOMOUS_LIMITS.timeoutMs),+ maxContinuations: normalizeLimit(config?.maxContinuations, defaults.maxContinuations),+ maxTurns: normalizeLimit(config?.maxTurns, defaults.maxTurns),+ maxTokens: normalizeLimit(config?.maxTokens, defaults.maxTokens),+ timeoutMs: normalizeLimit(config?.timeoutMs, defaults.timeoutMs),},continuationPrompt: config?.continuationPrompt?.trim() || DEFAULT_AUTONOMOUS_CONTINUATION_PROMPT,gates: {diff --git a/packages/coding-agent/src/core/settings-manager.ts b/packages/coding-agent/src/core/settings-manager.tsindex 35e6237541..8a20c92a4b 100644--- a/packages/coding-agent/src/core/settings-manager.ts+++ b/packages/coding-agent/src/core/settings-manager.ts@@ -71,6 +71,43 @@ export interface ThinkingBudgetsSettings {high?: number;}+/** One autonomous-run budget limit: a positive number, or "unlimited" for no cap. */+export type AutonomousLimitSetting = number | "unlimited";++/**+ * Persisted defaults for autonomous-run budget limits. They apply when a run+ * starts without explicit `--autonomous-*` CLI or `/autonomous on` budget+ * flags; explicit flags keep winning per run.+ */+export interface AutonomousSettings {+ maxContinuations?: AutonomousLimitSetting;+ maxTurns?: AutonomousLimitSetting;+ maxTokens?: AutonomousLimitSetting;+ timeoutMs?: AutonomousLimitSetting;+}++/** Autonomous limit settings resolved to finite positive numbers; invalid entries are dropped. */+export interface ResolvedAutonomousLimits {+ maxContinuations?: number;+ maxTurns?: number;+ maxTokens?: number;+ timeoutMs?: number;+}++function resolveAutonomousLimit(value: AutonomousLimitSetting | undefined): number | undefined {+ if (value === "unlimited") {+ // Matches the runtime's UNLIMITED_AUTONOMOUS_LIMIT sentinel.+ return Number.MAX_SAFE_INTEGER;+ }+ if (typeof value !== "number" || !Number.isFinite(value)) {+ return undefined;+ }+ // Truncate before validating so a positive fraction (e.g. 0.5) drops to+ // undefined instead of becoming a zero limit that stops the run immediately.+ const truncated = Math.trunc(value);+ return truncated > 0 ? truncated : undefined;+}+export type MermaidRenderingMode = "off" | "final" | "streaming";export interface MarkdownSettings {@@ -144,6 +181,7 @@ export interface Settings {onboardingCompleted?: boolean;defaultProvider?: string;defaultModel?: string;+ subagentDefaultModel?: string; // "provider/id" for rlm.spawn without a pinned model; unset inherits the parent modelrecentModels?: string[]; // "provider/id" keys, most-recently-used first// "provider/id" for background LLM passes (refinement review and planning);// unset falls back to the session model. Routing these to a different model@@ -170,6 +208,7 @@ export interface Settings {* Default: none - requests never silently switch models.*/providerBackupModel?: string;+ autonomous?: AutonomousSettings;shellPath?: string; // Custom shell path (e.g., for Cygwin users on Windows)quietStartup?: boolean;shellCommandPrefix?: string; // Prefix prepended to every bash command (e.g., "shopt -s expand_aliases" for alias support)@@ -729,6 +768,15 @@ export class SettingsManager {return this.settings.defaultModel;}+ /** Model selector applied when `rlm.spawn` does not pin a model; unset inherits the parent model. */+ getSubagentDefaultModel(): string | undefined {+ // Parsed settings are only cast to Settings; a non-string JSON value+ // (e.g. 42) must behave as unset, never throw into the spawn path.+ const reference = this.settings.subagentDefaultModel;+ if (typeof reference !== "string") return undefined;+ return reference.trim() ? reference.trim() : undefined;+ }+setDefaultProvider(provider: string): void {this.globalSettings.defaultProvider = provider;this.markModified("defaultProvider");@@ -947,6 +995,23 @@ export class SettingsManager {};}+ /**+ * Persisted autonomous-run limit defaults, ready for the runtime. Invalid+ * entries are dropped so the built-in per-field defaults still apply.+ */+ getAutonomousLimits(): ResolvedAutonomousLimits {+ const settings = this.settings.autonomous;+ if (!settings) {+ return {};+ }+ return {+ maxContinuations: resolveAutonomousLimit(settings.maxContinuations),+ maxTurns: resolveAutonomousLimit(settings.maxTurns),+ maxTokens: resolveAutonomousLimit(settings.maxTokens),+ timeoutMs: resolveAutonomousLimit(settings.timeoutMs),+ };+ }+getBranchSummarySettings(): { reserveTokens: number; skipPrompt: boolean } {return {reserveTokens: this.settings.branchSummary?.reserveTokens ?? 16384,diff --git a/packages/coding-agent/test/settings-manager.test.ts b/packages/coding-agent/test/settings-manager.test.tsindex 9079f851d7..9679948b53 100644--- a/packages/coding-agent/test/settings-manager.test.ts+++ b/packages/coding-agent/test/settings-manager.test.ts@@ -653,4 +653,98 @@ describe("SettingsManager", () => {expect(listed.getProviderBackupModel()).toBeUndefined();});});+ describe("autonomous limits and subagent default model", () => {+ it("resolves persisted autonomous limits and maps unlimited to the runtime sentinel", () => {+ writeFileSync(+ join(agentDir, "settings.json"),+ JSON.stringify({+ autonomous: {+ maxContinuations: 25,+ maxTurns: "unlimited",+ maxTokens: 1_000_000,+ timeoutMs: 3_600_000,+ },+ }),+ );++ const manager = SettingsManager.create(projectDir, agentDir);++ expect(manager.getAutonomousLimits()).toEqual({+ maxContinuations: 25,+ maxTurns: Number.MAX_SAFE_INTEGER,+ maxTokens: 1_000_000,+ timeoutMs: 3_600_000,+ });+ });++ it("merges project autonomous settings over global ones and drops invalid entries", () => {+ writeFileSync(+ join(agentDir, "settings.json"),+ JSON.stringify({ autonomous: { maxContinuations: 10, maxTurns: 40 } }),+ );+ writeFileSync(+ join(projectDir, ".prime", "agent", "settings.json"),+ JSON.stringify({+ autonomous: { maxContinuations: "unlimited", maxTokens: "one million" },+ }),+ );++ const manager = SettingsManager.create(projectDir, agentDir);++ expect(manager.getAutonomousLimits()).toEqual({+ maxContinuations: Number.MAX_SAFE_INTEGER,+ maxTurns: 40,+ maxTokens: undefined,+ timeoutMs: undefined,+ });+ });++ it("drops fractional limits that truncate to zero instead of returning zero budgets", () => {+ writeFileSync(+ join(agentDir, "settings.json"),+ JSON.stringify({+ autonomous: { maxTurns: 0.5, maxTokens: 1_000.75, maxContinuations: 2.5 },+ }),+ );++ const manager = SettingsManager.create(projectDir, agentDir);++ expect(manager.getAutonomousLimits()).toEqual({+ maxContinuations: 2,+ maxTokens: 1_000,+ maxTurns: undefined,+ timeoutMs: undefined,+ });+ });++ it("returns empty autonomous limits when unset", () => {+ const manager = SettingsManager.create(projectDir, agentDir);++ expect(manager.getAutonomousLimits()).toEqual({});+ });++ it("trims the subagent default model and treats blank as unset", () => {+ writeFileSync(+ join(agentDir, "settings.json"),+ JSON.stringify({ subagentDefaultModel: " prime-inference/internal/glm-5.2-fast " }),+ );+ const manager = SettingsManager.create(projectDir, agentDir);+ expect(manager.getSubagentDefaultModel()).toBe("prime-inference/internal/glm-5.2-fast");++ writeFileSync(join(agentDir, "settings.json"), JSON.stringify({ subagentDefaultModel: " " }));+ const blank = SettingsManager.create(projectDir, agentDir);+ expect(blank.getSubagentDefaultModel()).toBeUndefined();+ });++ it("treats a non-string subagentDefaultModel value as unset instead of throwing", () => {+ // Parsed settings are only cast; a corrupted value must not throw into the spawn path.+ const numeric = SettingsManager.inMemory({ subagentDefaultModel: 123 as unknown as string });+ expect(numeric.getSubagentDefaultModel()).toBeUndefined();++ const listed = SettingsManager.inMemory({+ subagentDefaultModel: ["faux/faux-child"] as unknown as string,+ });+ expect(listed.getSubagentDefaultModel()).toBeUndefined();+ });+ });});diff --git a/packages/coding-agent/test/suite/agent-session-autonomous.test.ts b/packages/coding-agent/test/suite/agent-session-autonomous.test.tsindex 21c197036f..d27eaf48f9 100644--- a/packages/coding-agent/test/suite/agent-session-autonomous.test.ts+++ b/packages/coding-agent/test/suite/agent-session-autonomous.test.ts@@ -249,6 +249,62 @@ describe("AgentSession autonomous mode", () => {});});+ it("seeds autonomous limits from persisted settings when no run-level limits are set", async () => {+ const harness = await createHarness({+ settings: {+ autonomous: { maxContinuations: 100, maxTurns: "unlimited", maxTokens: 1_000_000 },+ },+ });+ harnesses.push(harness);++ expect(harness.session.getAutonomousStatus().limits).toEqual({+ maxContinuations: 100,+ maxTurns: UNLIMITED_AUTONOMOUS_LIMIT,+ maxTokens: 1_000_000,+ timeoutMs: 30 * 60 * 1000,+ });+ });++ it("keeps explicit run-level autonomous limits ahead of persisted settings", async () => {+ const harness = await createHarness({+ settings: { autonomous: { maxContinuations: 100, maxTokens: 1_000_000 } },+ autonomous: { enabled: true, maxContinuations: 2, maxTokens: 20_000 },+ });+ harnesses.push(harness);++ expect(harness.session.getAutonomousStatus()).toMatchObject({+ enabled: true,+ limits: { maxContinuations: 2, maxTokens: 20_000 },+ });+ });++ it("drops invalid persisted autonomous limits back to the built-in defaults", async () => {+ const harness = await createHarness({+ settings: { autonomous: { maxContinuations: -3, maxTurns: 0.5, maxTokens: 0.5 } },+ });+ harnesses.push(harness);++ expect(harness.session.getAutonomousStatus().limits).toMatchObject({+ maxContinuations: 3,+ maxTurns: 12,+ maxTokens: 80_000,+ });+ });++ it("keeps settings-derived limits when enabling autonomous mode without budget flags", async () => {+ const harness = await createHarness({+ settings: { autonomous: { maxContinuations: 100 } },+ });+ harnesses.push(harness);++ await harness.session.prompt("/autonomous on");++ expect(harness.session.getAutonomousStatus()).toMatchObject({+ enabled: true,+ limits: { maxContinuations: 100 },+ });+ });+it("keeps defaults when no budget flags are named and appends repeated gates", async () => {const harness = await createHarness();harnesses.push(harness);diff --git a/packages/coding-agent/test/suite/rlm-subagent-default-model.test.ts b/packages/coding-agent/test/suite/rlm-subagent-default-model.test.tsnew file mode 100644index 0000000000..b8f86dd592--- /dev/null+++ b/packages/coding-agent/test/suite/rlm-subagent-default-model.test.ts@@ -0,0 +1,149 @@+import { fauxAssistantMessage } from "@earendil-works/pi-ai";+import { describe, expect, it, vi } from "vitest";+import { createHarness } from "./harness.js";++const provider = "faux-eng-subagent-default-model";++describe("subagent default model setting", () => {+ it("resolves unpinned spawns against subagentDefaultModel", { timeout: 30_000 }, async () => {+ const harness = await createHarness({+ provider,+ models: [{ id: "parent-model" }, { id: "child-model" }],+ settings: { subagentDefaultModel: `${provider}/child-model` },+ });+ try {+ harness.setResponses([fauxAssistantMessage("child answer")]);++ const result = await harness.session.runRlmChild("do the work");++ expect(result.model).toBe(`${provider}/child-model`);+ await vi.waitFor(+ async () => {+ const childEntry = (await harness.session.listRlmSubagents()).subagents[0];+ expect(childEntry?.status).toBe("completed");+ expect(harness.session.getRlmChildSession(childEntry!.rlm_child_id)?.model?.id).toBe("child-model");+ },+ { timeout: 10_000 },+ );+ } finally {+ harness.cleanup();+ }+ });++ it("keeps an explicit spawn model ahead of subagentDefaultModel", { timeout: 30_000 }, async () => {+ const harness = await createHarness({+ provider,+ models: [{ id: "parent-model" }, { id: "child-model" }],+ settings: { subagentDefaultModel: `${provider}/child-model` },+ });+ try {+ harness.setResponses([fauxAssistantMessage("parent answer")]);++ const result = await harness.session.runRlmChild("do the work", { model: `${provider}/parent-model` });++ expect(result.model).toBe(`${provider}/parent-model`);+ await vi.waitFor(+ async () => {+ const childEntry = (await harness.session.listRlmSubagents()).subagents[0];+ expect(childEntry?.status).toBe("completed");+ expect(harness.session.getRlmChildSession(childEntry!.rlm_child_id)?.model?.id).toBe("parent-model");+ },+ { timeout: 10_000 },+ );+ } finally {+ harness.cleanup();+ }+ });++ it("fails an unpinned spawn when the configured default is unavailable", { timeout: 30_000 }, async () => {+ const harness = await createHarness({+ provider,+ models: [{ id: "parent-model" }],+ settings: { subagentDefaultModel: `${provider}/missing-model` },+ });+ try {+ await expect(harness.session.runRlmChild("do the work")).rejects.toThrow(+ `Requested subagent model "${provider}/missing-model" is unavailable, unauthenticated, or expired`,+ );+ expect((await harness.session.listRlmSubagents()).subagents).toEqual([]);+ } finally {+ harness.cleanup();+ }+ });++ it("fails an unpinned spawn when the configured parent-model default is stale", { timeout: 30_000 }, async () => {+ // A default naming the parent model must pass the same availability and+ // authentication preflight as any other reference; the parent-model+ // equality shortcut would start a child that fails its model request.+ const harness = await createHarness({+ provider,+ models: [{ id: "parent-model" }, { id: "child-model" }],+ settings: { subagentDefaultModel: `${provider}/parent-model` },+ });+ try {+ expect(harness.session.modelRegistry.markProviderAuthStale(provider)).toBe(true);+ expect(harness.session.modelRegistry.markProviderAuthStale(provider)).toBe(true);+ expect(harness.session.modelRegistry.getProviderAuthStatus(provider)).toMatchObject({+ source: "stale",+ label: "expired",+ });+ harness.setResponses([fauxAssistantMessage("child answer")]);++ await expect(harness.session.runRlmChild("do the work")).rejects.toThrow(+ `Requested subagent model "${provider}/parent-model" is unavailable, unauthenticated, or expired`,+ );+ expect((await harness.session.listRlmSubagents()).subagents).toEqual([]);+ } finally {+ harness.cleanup();+ }+ });++ it("inherits the parent model when no default is configured", { timeout: 30_000 }, async () => {+ const harness = await createHarness({+ provider,+ models: [{ id: "parent-model" }, { id: "child-model" }],+ });+ try {+ harness.setResponses([fauxAssistantMessage("parent answer")]);++ const result = await harness.session.runRlmChild("do the work");++ expect(result.model).toBe(`${provider}/parent-model`);+ await vi.waitFor(+ async () => {+ const childEntry = (await harness.session.listRlmSubagents()).subagents[0];+ expect(childEntry?.status).toBe("completed");+ },+ { timeout: 10_000 },+ );+ } finally {+ harness.cleanup();+ }+ });++ it("treats a non-string subagentDefaultModel setting as unset on unpinned spawns", { timeout: 30_000 }, async () => {+ // Corrupted settings (e.g. 42) must degrade to "unset" in the spawn hot+ // path: the child inherits the parent model instead of throwing.+ const harness = await createHarness({+ provider,+ models: [{ id: "parent-model" }, { id: "child-model" }],+ settings: { subagentDefaultModel: 42 as unknown as string },+ });+ try {+ harness.setResponses([fauxAssistantMessage("parent answer")]);++ const result = await harness.session.runRlmChild("do the work");++ expect(result.model).toBe(`${provider}/parent-model`);+ await vi.waitFor(+ async () => {+ const childEntry = (await harness.session.listRlmSubagents()).subagents[0];+ expect(childEntry?.status).toBe("completed");+ },+ { timeout: 10_000 },+ );+ } finally {+ harness.cleanup();+ }+ });+});