Skip to content

Fix harness_list output validation for PR activity#248

Draft
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/mcp-v2-bug-resolution-ea4d
Draft

Fix harness_list output validation for PR activity#248
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/mcp-v2-bug-resolution-ea4d

Conversation

@cursor
Copy link
Copy Markdown
Contributor

@cursor cursor Bot commented May 22, 2026

Description

Fixes harness_list(resource_type="pr_activity") output validation when the Harness Code activities API returns a bare array. The list tool now normalizes bare arrays and common list-array wrapper keys into { items, total } before compacting and formatting, ensuring MCP structuredContent is present for the declared output schema.

Type of Change

  • Bug fix
  • New feature
  • Refactor
  • Documentation
  • Other

Checklist

  • Tests pass
  • Typecheck passes

Verification:

  • pnpm test tests/tools/tool-handlers.test.ts
  • pnpm typecheck
  • pnpm build
  • pnpm test
Open in Web View Automation 

cursoragent and others added 2 commits May 22, 2026 05:13
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Co-authored-by: Rohan Gupta <thisrohangupta@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 finding.

  • Mediumharness_list is fixing list-shape drift in the wrong layer. The new normalization in src/tools/harness-list.ts makes this tool return { items, total } for bare-array / raw-envelope responses, but the affected resource definitions still advertise responseExtractor: passthrough instead of using the registry extractor layer that already owns list normalization. That splits the contract across layers, duplicates backend-shape knowledge, and leaves other Registry.dispatch(..., "list") consumers inconsistent. The cleaner fix is to normalize pr_activity (and any sibling raw-array PR list endpoints) in the resource extractor layer, reusing the existing extractor helpers there.
Open in Web View Automation 

Sent by Cursor Automation: Sunil On Demand Architecture Review

Comment thread src/tools/harness-list.ts
input.template_list_type = "All";
}
const result = await registry.dispatch(client, resourceType, "list", input);
const result = normalizeListResult(await registry.dispatch(client, resourceType, "list", input));
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Medium: this is patching the symptom in the generic tool instead of fixing the list contract where the repo already normalizes response shapes.

If pr_activity is a bare-array list, the canonical fix is to switch that resource off responseExtractor: passthrough and use a registry extractor (v1ListExtract() or a dedicated extractor) in src/registry/toolsets/pull-requests.ts. Doing it here duplicates list-envelope knowledge the registry already owns, and Registry.dispatch(..., "list") still returns raw arrays to other shared consumers that assume { items, total } (for example harness_search). That’s exactly the kind of boundary drift CLAUDE.md/AGENTS.md ask us to avoid.

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.

2 participants