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
29 changes: 29 additions & 0 deletions src/subagent/nudge-director.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,35 @@ describe("SubAgentDirector incomplete-report wiring", () => {
expect(reply.content).toContain("read-1.ts");
});

test("tool-using turns reset the tool-less narration count (CL-7788)", async () => {
const director = new SubAgentDirector("system", [], undefined, 30);
const caps = capabilities();

await director.decide(
inferenceDoneText("Still looking at the files..."),
state,
caps,
);
await director.decide(inferenceDone(["read-1"]), state, caps);
await director.decide(toolDone("read-1"), state, caps);
await director.decide(inferenceDone(["read-2"]), state, caps);
await director.decide(toolDone("read-2"), state, caps);

const result = actions(
await director.decide(
inferenceDoneText("Still narrating, no envelope."),
state,
caps,
),
);
expect(result).toContainEqual({
type: "checkpoint",
message: "subagent-incomplete-report-nudge",
});
expect(result.some((action) => action.type === "reply")).toBe(false);
expect(result.some((action) => action.type === "infer")).toBe(true);
});

test("tool-less turn with the four headings completes normally", async () => {
const director = new SubAgentDirector("system", [], undefined, 30);
const caps = capabilities();
Expand Down
1 change: 1 addition & 0 deletions src/subagent/nudge-director.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ export class SubAgentDirector extends DefaultDirector {
this.lastAssistantText = lastText(content);
const hasToolCalls = content.some((block) => block.type === "tool_call");
if (hasToolCalls) {
this.toolLessNarrationCycles = 0;
this.verbatimToolCallNudgeFired = false;
this.thrashState = nextThrashState(this.thrashState, content);
}
Expand Down
Loading