-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat(todo-continuation-enforcer): include remaining todo list in system reminder #473
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+120
−1
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -85,6 +85,30 @@ function isLastAssistantMessageAborted(messages: Array<{ info?: MessageInfo }>): | |
| return errorName === "MessageAbortedError" || errorName === "AbortError" | ||
| } | ||
|
|
||
| function getIncompleteTodos(todos: Todo[]): Todo[] { | ||
| return todos.filter(t => t.status !== "completed" && t.status !== "cancelled") | ||
| } | ||
|
Comment on lines
+88
to
+90
|
||
|
|
||
| function formatRemainingTodos(todos: Todo[]): string { | ||
| const incompleteTodos = getIncompleteTodos(todos) | ||
| if (incompleteTodos.length === 0) return "" | ||
|
|
||
| const lines = incompleteTodos.map((todo, idx) => { | ||
| const statusIndicator = todo.status === "in_progress" ? "🔄" : "⏳" | ||
| const priorityLabel = | ||
| todo.priority === "high" | ||
| ? "[HIGH]" | ||
| : todo.priority === "medium" | ||
| ? "[MED]" | ||
| : todo.priority === "low" | ||
| ? "[LOW]" | ||
| : "[NONE]" | ||
| return ` ${idx + 1}. ${statusIndicator} ${priorityLabel} ${todo.content}` | ||
| }) | ||
|
|
||
| return `\n\nRemaining Tasks:\n${lines.join("\n")}` | ||
| } | ||
|
|
||
| export function createTodoContinuationEnforcer( | ||
| ctx: PluginInput, | ||
| options: TodoContinuationEnforcerOptions = {} | ||
|
|
@@ -198,7 +222,7 @@ export function createTodoContinuationEnforcer( | |
| return | ||
| } | ||
|
|
||
| const prompt = `${CONTINUATION_PROMPT}\n\n[Status: ${todos.length - freshIncompleteCount}/${todos.length} completed, ${freshIncompleteCount} remaining]` | ||
| const prompt = `${CONTINUATION_PROMPT}\n\n[Status: ${todos.length - freshIncompleteCount}/${todos.length} completed, ${freshIncompleteCount} remaining]${formatRemainingTodos(todos)}` | ||
|
|
||
| const modelField = prevMessage?.model?.providerID && prevMessage?.model?.modelID | ||
| ? { providerID: prevMessage.model.providerID, modelID: prevMessage.model.modelID } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test verifies that the todo content is included in the prompt but doesn't verify the format of status indicators (🔄/⏳) or priority labels ([HIGH]/[MED]/[LOW]). Consider adding assertions to verify the complete formatting, such as checking for the presence of "🔄 [MED] Add unit tests" to ensure the formatRemainingTodos function is working correctly.