fix: prevent tag corruption in bulk updates (#856)

* fix(task-manager): prevent tag corruption in bulk updates and add tag preservation test

- Fix writeJSON call in scripts/modules/task-manager/update-tasks.js (line 469) to include projectRoot and tag parameters.
- Ensure tagged task lists maintain data integrity during bulk updates, preventing task disappearance in tagged contexts.
- Update MCP tools to properly pass tag context through the call chain.
- Introduce a comprehensive test case to verify that all tags are preserved when updating tasks, covering both master and feature-branch scenarios.

Addresses an issue where bulk updates could corrupt tasks.json in tagged task list structures, reinforcing task management robustness.

* style(tests): format task data in update-tasks test
This commit is contained in:
Parthy
2025-07-02 12:53:12 +02:00
committed by GitHub
parent 598e687067
commit 43e0025f4c
5 changed files with 147 additions and 14 deletions

View File

@@ -21,7 +21,7 @@ import {
*/
export async function updateTasksDirect(args, log, context = {}) {
const { session } = context;
const { from, prompt, research, tasksJsonPath, projectRoot } = args;
const { from, prompt, research, tasksJsonPath, projectRoot, tag } = args;
// Create the standard logger wrapper
const logWrapper = createLogWrapper(log);
@@ -75,7 +75,8 @@ export async function updateTasksDirect(args, log, context = {}) {
{
session,
mcpLog: logWrapper,
projectRoot
projectRoot,
tag
},
'json'
);

View File

@@ -43,11 +43,12 @@ export function registerUpdateTool(server) {
.optional()
.describe(
'The directory of the project. (Optional, usually from session)'
)
),
tag: z.string().optional().describe('Tag context to operate on')
}),
execute: withNormalizedProjectRoot(async (args, { log, session }) => {
const toolName = 'update';
const { from, prompt, research, file, projectRoot } = args;
const { from, prompt, research, file, projectRoot, tag } = args;
try {
log.info(
@@ -71,7 +72,8 @@ export function registerUpdateTool(server) {
from: from,
prompt: prompt,
research: research,
projectRoot: projectRoot
projectRoot: projectRoot,
tag: tag
},
log,
{ session }