Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Changed the default RLM maximum recursion depth for new sessions from 1 to 2.
2 changes: 1 addition & 1 deletion packages/coding-agent/docs/rlm-runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ Unknown options fail instead of being ignored. Model search is bounded to active
7. Run the child prompt, retain its session, and update lifecycle state independently of the admission call.
8. Attribute child usage to the parent assistant turn and persist the attribution.

Children receive incremented `RLM_DEPTH`, the inherited maximum depth, and their own `RLM_SESSION_DIR`. The default maximum depth is 1, so root sessions may create children and those children may not create grandchildren unless the limit is configured higher.
Children receive incremented `RLM_DEPTH`, the inherited maximum depth, and their own `RLM_SESSION_DIR`. The default maximum depth is 2, so root sessions may create children and grandchildren; grandchildren may not create another generation unless the limit is configured higher.

## Independent Delegation

Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/src/core/agent-session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ export class AgentSession {
if (env !== undefined && env !== "") {
return { maxDepth: parseDepth(env, 1, "RLM_MAX_DEPTH"), source: "env" };
}
return { maxDepth: 1, source: "default" };
return { maxDepth: 2, source: "default" };
}

private _loadPersistedGoalState(): GoalState {
Expand Down
2 changes: 1 addition & 1 deletion packages/coding-agent/src/core/settings-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export interface Settings {
recentModels?: string[]; // "provider/id" keys, most-recently-used first
defaultThinkingLevel?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
defaultServiceTier?: ServiceTier;
rlmMaxDepth?: number; // default for new sessions; unset falls through to RLM_MAX_DEPTH, then 1
rlmMaxDepth?: number; // default for new sessions; unset falls through to RLM_MAX_DEPTH, then 2
idleEvictionMinutes?: number | "off"; // global daemon policy; default: 90
transport?: TransportSetting; // default: "auto"
steeringMode?: "all" | "one-at-a-time";
Expand Down
6 changes: 3 additions & 3 deletions packages/coding-agent/test/agent-session-recursion.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2481,7 +2481,7 @@ describe("AgentSession rlm recursion", () => {
const root = createSession();
const originalMessages = [...root.messages];

expect(root.getRlmMaxDepthStatus()).toEqual({ maxDepth: 1, source: "default" });
expect(root.getRlmMaxDepthStatus()).toEqual({ maxDepth: 2, source: "default" });
await expect(root.setRlmMaxDepth(-1)).rejects.toThrow("non-negative integer");
await root.setRlmMaxDepth(3);

Expand Down Expand Up @@ -2598,7 +2598,7 @@ describe("AgentSession rlm recursion", () => {
source: "chat",
globalSaved: true,
});
expect(existing.rlmMaxDepth).toBe(1);
expect(existing.rlmMaxDepth).toBe(2);
const freshSettings = SettingsManager.create(tempDir, tempDir);
const fresh = createSession({ settingsManager: freshSettings });
expect(fresh.getRlmMaxDepthStatus()).toEqual({ maxDepth: 4, source: "global" });
Expand Down Expand Up @@ -2676,7 +2676,7 @@ describe("AgentSession rlm recursion", () => {
});

await expect(root.setRlmMaxDepth(0)).rejects.toThrow("disk full");
expect(root.rlmMaxDepth).toBe(1);
expect(root.rlmMaxDepth).toBe(2);
expect(root.systemPrompt).toBe(originalPrompt);
expect(
root.sessionManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ describe("AgentSession prompt characterization", () => {
const responseGate = createDeferred();
const harness = await createHarness({
rlmDepth: 1,
rlmMaxDepth: 1,
extensionFactories: [
(pi) => {
pi.on("before_agent_start", async (event) => ({
Expand Down
Loading