refactor(coding-agent): reorganized todo settings namespace and refactored tool availability checks
- Reorganized todo-related settings from `todoCompletion.*` namespace to `todo.*` namespace with separate `todo.enabled` and `todo.reminders.*` properties. - Updated settings access pattern in agent session from grouped settings object to flat dot-notation keys for improved consistency. - Refactored todo_write tool availability check to independently gate on both `todo.enabled` setting and absence of submit_result.
This commit is contained in:
@@ -264,12 +264,12 @@ export const SETTINGS_SCHEMA = {
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// Todo completion settings
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
"todoCompletion.enabled": {
|
||||
"todo.reminders": {
|
||||
type: "boolean",
|
||||
default: false,
|
||||
ui: { tab: "behavior", label: "Todo completion", description: "Remind agent to complete todos before stopping" },
|
||||
ui: { tab: "behavior", label: "Todo reminders", description: "Remind agent to complete todos before stopping" },
|
||||
},
|
||||
"todoCompletion.maxReminders": {
|
||||
"todo.reminders.max": {
|
||||
type: "number",
|
||||
default: 3,
|
||||
ui: {
|
||||
@@ -280,6 +280,15 @@ export const SETTINGS_SCHEMA = {
|
||||
},
|
||||
},
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// Todos settings
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
"todo.enabled": {
|
||||
type: "boolean",
|
||||
default: true,
|
||||
ui: { tab: "tools", label: "Todos", description: "Enable the todo_write tool for task tracking" },
|
||||
},
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
// Startup settings
|
||||
// ─────────────────────────────────────────────────────────────────────────
|
||||
@@ -822,7 +831,6 @@ export interface BashInterceptorRule {
|
||||
export interface GroupTypeMap {
|
||||
compaction: CompactionSettings;
|
||||
retry: RetrySettings;
|
||||
todoCompletion: TodoCompletionSettings;
|
||||
branchSummary: BranchSummarySettings;
|
||||
skills: SkillsSettings;
|
||||
commit: CommitSettings;
|
||||
|
||||
@@ -2461,13 +2461,15 @@ Be thorough - include exact file paths, function names, error messages, and tech
|
||||
* Check if agent stopped with incomplete todos and prompt to continue.
|
||||
*/
|
||||
private async _checkTodoCompletion(): Promise<void> {
|
||||
const todoSettings = this.settings.getGroup("todoCompletion");
|
||||
if (!todoSettings.enabled) {
|
||||
const remindersEnabled = this.settings.get("todo.reminders");
|
||||
const todosEnabled = this.settings.get("todo.enabled");
|
||||
if (!remindersEnabled || !todosEnabled) {
|
||||
this._todoReminderCount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._todoReminderCount >= todoSettings.maxReminders) {
|
||||
const remindersMax = this.settings.get("todo.reminders.max");
|
||||
if (this._todoReminderCount >= remindersMax) {
|
||||
logger.debug("Todo completion: max reminders reached", { count: this._todoReminderCount });
|
||||
return;
|
||||
}
|
||||
@@ -2503,7 +2505,7 @@ Be thorough - include exact file paths, function names, error messages, and tech
|
||||
`<system_reminder>\n` +
|
||||
`You stopped with ${incomplete.length} incomplete todo item(s):\n${todoList}\n\n` +
|
||||
`Please continue working on these tasks or mark them complete if finished.\n` +
|
||||
`(Reminder ${this._todoReminderCount}/${todoSettings.maxReminders})\n` +
|
||||
`(Reminder ${this._todoReminderCount}/${remindersMax})\n` +
|
||||
`</system_reminder>`;
|
||||
|
||||
logger.debug("Todo completion: sending reminder", {
|
||||
@@ -2516,7 +2518,7 @@ Be thorough - include exact file paths, function names, error messages, and tech
|
||||
type: "todo_reminder",
|
||||
todos: incomplete,
|
||||
attempt: this._todoReminderCount,
|
||||
maxAttempts: todoSettings.maxReminders,
|
||||
maxAttempts: remindersMax,
|
||||
});
|
||||
|
||||
// Inject reminder and continue the conversation
|
||||
|
||||
@@ -278,6 +278,7 @@ export async function createTools(session: ToolSession, toolNames?: string[]): P
|
||||
if (name === "lsp") return enableLsp;
|
||||
if (name === "bash") return allowBash;
|
||||
if (name === "python") return allowPython;
|
||||
if (name === "todo_write") return !includeSubmitResult && session.settings.get("todo.enabled");
|
||||
return true;
|
||||
};
|
||||
if (includeSubmitResult && requestedTools && !requestedTools.includes("submit_result")) {
|
||||
|
||||
Reference in New Issue
Block a user