Skip to content

fix(mcp): filter schema placeholder echoes and preserve task metadata in task_edit - #1007

Open
souljedi wants to merge 1 commit into
MrLesk:mainfrom
souljedi:fix/mcp-comment-task-edits
Open

souljedi wants to merge 1 commit into
MrLesk:mainfrom
souljedi:fix/mcp-comment-task-edits

Conversation

@souljedi

@souljedi souljedi commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #1006

Summary

When LLM clients call task_edit over MCP to append review comments or update specific fields, some models populate omitted parameters with literal TypeScript schema signatures (e.g. planSet?: string, acceptanceCriteriaSet?[], commentAuthor?: string, commentsAppend?[]: string[]).

Previously, task_edit accepted these strings directly into comment arrays and update fields, cluttering task history with schema type strings. In addition, comment-only updates risked clearing other task metadata if empty arrays or no-op fields were passed.

What changed

  • src/utils/task-edit-builder.ts:
    • Added isSchemaPlaceholder to filter echoed TypeScript parameter signatures and type declarations out of string and array update fields.
    • Added isCommentPlaceholder so legitimate short user comments (like status? or title?) are preserved, while signatures like status?: TaskStatus or planSet?: string are discarded.
    • Preserved explicit clear semantics for modifiedFiles: [] while treating whitespace-only arrays as no-ops.
  • src/mcp/validation/validators.ts:
    • Handled enum-backed schema placeholder echoes at the MCP boundary so they are treated as omitted without weakening validation of actual enum values.
  • src/mcp/utils/schema-generators.ts:
    • Updated task_create schema generation to advertise the configured defaultStatus.
  • src/test/task-edit-builder.test.ts & src/test/mcp-tasks.test.ts:
    • Added 9 unit tests for builder placeholder filtering and edge cases.
    • Added full MCP integration tests verifying comment-only updates, metadata preservation, modified-file clearing, and markdown structural validity.

Verification

  • bunx tsc --noEmit — clean
  • bun run check . — clean (426 files)
  • bun test src/test/task-edit-builder.test.ts src/test/mcp-tasks.test.ts — 52 pass / 0 fail (343 assertions)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MCP task_edit serializes schema placeholder echoes into comments and metadata

1 participant