Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

test: cover MCP collisions, profile refs, and content parsing

open
Stack 2/2
#333 opened by cursor[bot]cursor/missing-test-coverage-e2c1→main
Conversation0
cursor[bot]
Commits
0
Files changed…
opened this pull request
Author
· 2 weeks ago

Add missing regression tests for MCP hot-load fail-closed gates that never landed from #330, plus persisted message content parsing from this week's extract.

Risky behavior now covered

  • MCP tool identity: colliding tool names from different servers remap to _2/_3 instead of overwriting each other, and a failed multi-server refresh closes only the connections created in that attempt.
  • MCP cancellation ownership: abort after dispatch waits for the in-flight tool to settle so task termination cannot commit early; extra keys and overlong search queries fail before the catalog loads; non-executable catalog entries are skipped.
  • Agent profiles: invalid ids, unknown roles/scopes, extras, and malformed workspace:/global: refs fail closed; allowlists are trimmed and deduped.
  • Marketplace parse: invalid JSON, extras, malformed sha256: hashes, and ./../ / absolute source paths are rejected before install.
  • Skills vs plugins install scopes: skills accept only project|global; plugins accept only workspace|user. Marketplace add/remove and skill-improvement restore reject blanks and extras.
  • Persisted message text: contentText trims strings, joins text/inputText parts, and ignores non-textual values so hydration/projection cannot invent transcript text.

Test files added/updated

  • test/mcp.cache.test.ts (updated)
  • test/mcp.deferred-tools.test.ts (updated)
  • test/agent-profile-schema.test.ts (added)
  • test/plugins.marketplace-parse.test.ts (added)
  • test/jsonrpc.skills-plugins-marketplace-schema-rejects.test.ts (added)
  • test/shared.message-content.test.ts (added)

Why these tests materially reduce regression risk

MCP hot-load, profile refs, and marketplace source paths are shared harness gates. A silent overwrite of colliding MCP tools, an early task-complete after abort, or a marketplace path that escapes its root would leak across sessions and clients. contentText is the single parser for persisted model-message content; a wrong join or fallback would corrupt snapshots and reconnect hydration. The new tests lock the fail-closed behavior without changing production code.

Validation

  • Targeted coverage + platform-boundary: 49 tests green
  • Touched files Biome-clean
  • bun run check, bun run typecheck, bun run docs:check: clean
  • Full bun run test: new files that reached the runner passed in-suite (agent-profile-schema, jsonrpc.skills-plugins-marketplace-schema-rejects). Isolated runs also passed for mcp.cache, mcp.deferred-tools, plugins.marketplace-parse, and shared.message-content.
Open in Web View Automation 
This branch can’t be merged automatically yet
Branch comparison failed — verify branches still exist in storage.
0 approving reviews
None yet
Checks
No checks recorded
Fast-forward
Source must contain the target branch tip
main ← cursor/missing-test-coverage-e2c1

Sign in to comment.

Stack

2/2
1

Merge readiness

Checking mergeability after the indexing worker computes the current branch state.

Autopilot

Debug

Reviews

Approved0
ReviewersNone yet

Configure an OpenRouter key in repository settings.

Update README.md

#125 mobile-fixes ← main

Updated 4 months ago

merged
2

test: cover MCP collisions, profile refs, and content parsing

#333 main ← cursor/missing-test-coverage-e2c1

Updated 2 weeks ago

open