Skip to content

[Bug] Exact-thread sync rejects documented thread selectors #112

Description

@morluto

Description

The documented exact-thread selection shape for github_sync_threads is rejected by the MCP handler. This blocks the narrow refresh path and prevents dependent pull-request status hydration from obtaining current evidence.

Observed against morluto/leantoken#167 on 2026-07-23:

{
  "selection": "threads",
  "threads": [
    {"owner": "morluto", "repo": "leantoken", "kind": "pull_request", "number": 167}
  ]
}

The call returned:

repository filters are not accepted in thread selection mode

A subsequent github_sync_pull_request_status request for the same pull request reported that the thread had not been synced.

Steps to reproduce

  1. Call github_sync_threads in thread-selection mode with one exact {owner, repo, kind, number} selector.
  2. Observe the validation error above.
  3. Call github_sync_pull_request_status for that exact pull request.
  4. Observe that the status refresh cannot proceed because the thread is not synced.

Expected behavior

An exact thread selector should be accepted, bounded to the requested thread, and return a durable job whose completed projection can be consumed by pull-request status hydration.

Repository-selection mode should remain distinct and should not be broadened implicitly as a fallback.

Actual behavior

The published tool contract accepts exact thread objects, but the handler rejects them as if repository filters had been supplied in repository mode. This makes exact issue/PR refresh unavailable through the MCP path.

The error may indicate a schema/handler disagreement or a selection-mode routing bug; the underlying cause still needs source-level confirmation.

Acceptance criteria

  • Schema and handler tests use the same exact-thread fixture and pass for both issue and pull-request kinds.
  • The returned job reports the requested thread as complete, retryable, unavailable, or failed without silently widening scope.
  • Repeating the same exact sync is idempotent and does not duplicate observations.
  • github_sync_pull_request_status succeeds after the exact thread sync and reports facet completeness accurately.
  • Repository-selection mode retains its own validation and budgeting behavior.
  • An end-to-end MCP test exercises sync, job polling, and dependent status hydration through stdio.

Evaluation scenario

Freeze a fake GitHub repository with one issue and one pull request plus the exact MCP request above.

A correct agent/tool path must:

  • accept the exact selector;
  • sync only that thread;
  • poll the durable job to completion; and
  • make the dependent PR-status call observe the synced projection.

A tempting invalid path is to retry the same malformed route, silently switch to a broad repository sync, or report PR health as current without a complete sync. The evaluation should reject all three. It should also verify that missing facets remain explicitly unknown rather than being treated as success.

Impact

Agents and integrations must fall back to native GitHub commands or broader syncs for a request that should be narrow and bounded. This increases network work, weakens freshness provenance, and prevents the contribution workflow from composing its existing exact-thread and PR-health capabilities.

Related work

This is a follow-up to the PR-health and scalable MCP contracts covered by #20; it is specifically about the exact-thread sync prerequisite and does not replace the existing PR-health scope.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions