feat(coding-agent): enabled eager todo skip for queries and commands
- Eager todo enforcement now skips prompts ending with question marks or exclamation marks, treating them as queries or commands rather than statements requiring task planning. - Added 2 test cases validating that eager todo enforcement is skipped for prompts ending with question and exclamation marks.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- Debug tool with DAP (Debug Adapter Protocol) support for launching and attaching debuggers, setting breakpoints, stepping through execution, inspecting threads/stack/variables, and evaluating expressions
|
||||
@@ -18,6 +19,7 @@
|
||||
|
||||
### Changed
|
||||
|
||||
- Eager todo enforcement now skips prompts ending with question marks or exclamation marks, treating them as queries or commands rather than statements requiring task planning
|
||||
- Chunk read output now displays fully-qualified anchor paths (e.g., `[class_Worker.fn_run#CRC]`) instead of bare names, making targets unambiguous for edits
|
||||
- Chunk edit tool documentation clarified: `target` must be the fully-qualified path with `#CRC` suffix; added guidance to run `read(path="file", sel="?")` for canonical target listings when anchor style is unclear
|
||||
- Chunk read tool documentation updated: `sel` parameter now documents the `?` selector for canonical target listings, and clarifies that default output shows full paths
|
||||
|
||||
@@ -2319,7 +2319,7 @@ export class AgentSession {
|
||||
return;
|
||||
}
|
||||
|
||||
const eagerTodoPrelude = !options?.synthetic ? this.#createEagerTodoPrelude() : undefined;
|
||||
const eagerTodoPrelude = !options?.synthetic ? this.#createEagerTodoPrelude(expandedText) : undefined;
|
||||
|
||||
const userContent: (TextContent | ImageContent)[] = [{ type: "text", text: expandedText }];
|
||||
if (options?.images) {
|
||||
@@ -4049,7 +4049,7 @@ export class AgentSession {
|
||||
});
|
||||
}
|
||||
|
||||
#createEagerTodoPrelude(): { message: AgentMessage; toolChoice: ToolChoice } | undefined {
|
||||
#createEagerTodoPrelude(promptText: string): { message: AgentMessage; toolChoice: ToolChoice } | undefined {
|
||||
const eagerTodosEnabled = this.settings.get("todo.eager");
|
||||
const todosEnabled = this.settings.get("todo.enabled");
|
||||
if (!eagerTodosEnabled || !todosEnabled) {
|
||||
@@ -4063,6 +4063,11 @@ export class AgentSession {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const trimmedPromptText = promptText.trimEnd();
|
||||
if (trimmedPromptText.endsWith("?") || trimmedPromptText.endsWith("!")) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (!this.#toolRegistry.has("todo_write")) {
|
||||
logger.warn("Eager todo enforcement skipped because todo_write is unavailable", {
|
||||
activeToolNames: this.agent.state.tools.map(tool => tool.name),
|
||||
|
||||
@@ -264,4 +264,32 @@ describe("AgentSession eager todo enforcement", () => {
|
||||
expect(session.getTodoPhases()).toHaveLength(1);
|
||||
expect(session.getTodoPhases()[0]?.tasks[0]?.content).toBe("List all git worktrees in the current repository");
|
||||
});
|
||||
|
||||
it("skips eager todo enforcement for prompts ending with a question mark", async () => {
|
||||
await session.prompt("list all work trees?");
|
||||
|
||||
expect(observedCalls).toHaveLength(1);
|
||||
expect(observedCalls[0]).toEqual({
|
||||
toolChoice: undefined,
|
||||
toolNames: ["todo_write", "bash"],
|
||||
messageRoles: ["user"],
|
||||
messageTexts: ["list all work trees?"],
|
||||
lastMessageRole: "user",
|
||||
lastMessageText: "list all work trees?",
|
||||
});
|
||||
});
|
||||
|
||||
it("skips eager todo enforcement for prompts ending with an exclamation mark", async () => {
|
||||
await session.prompt("list all work trees!");
|
||||
|
||||
expect(observedCalls).toHaveLength(1);
|
||||
expect(observedCalls[0]).toEqual({
|
||||
toolChoice: undefined,
|
||||
toolNames: ["todo_write", "bash"],
|
||||
messageRoles: ["user"],
|
||||
messageTexts: ["list all work trees!"],
|
||||
lastMessageRole: "user",
|
||||
lastMessageText: "list all work trees!",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user