Skip to content

πŸ› fix(contribute): remote task MCP URL is this hive's own address, never the hub's - #16908

Merged
hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/task-mcp-remote-url-never-hub
Nov 6, 2026
Merged

hivecommons-hive[bot] merged 1 commit into
hivecommons:v6from
Danathar:fix/task-mcp-remote-url-never-hub

Conversation

@Danathar

@Danathar Danathar commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary

With task_mcp.remote_enabled on, a hive could name the hub as its own task MCP. The contributor's agent then sent this hive's lease bearer to the hub. Any hive without dashboard.public_url and without a hub-assigned dashboard URL did this, because hub.url has a default on every hive. The URL is now only ever this hive's own address. A hive with no such address hands out no task MCP at all, and its contributors work without it.

What went wrong

The URL was taken from dashboard.public_url, then hub.dashboard_url, then hub.url. hub.url is the hub, not this hive. A hub-less hive with no dashboard.public_url put this in every task_assign:

"mcp": {
  "url": "https://hive.hivecommons.dev/api/contribute/mcp",
  "token": "hive_mcp_v1.…",
  "expires_at": "2026-11-06T13:40:10Z"
}

The relay writes that block into the contributor's .mcp.json. The agent then calls that address with this hive's bearer. It is the hub's address, not this hive's, so the call cannot reach this hive's task MCP either.

Two more cases did the same. A hive whose hub link is off still used an old hub.dashboard_url. A hub spoke with no hub.dashboard_url yet used the bare hub URL.

What changes

  • The URL is dashboard.public_url, or hub.dashboard_url while hub.enabled is true. The URL given to hub-launched agents already ignores hub.dashboard_url on a hive whose hub link is off (issue 10282).
  • hub.url is never used.
  • With no address left, the hive sends no mcp block and mints no bearer. It logs one info line per task that points at dashboard.public_url.
  • A hive that sets dashboard.public_url, or a hub spoke with its hub.dashboard_url, sees no change. dashboard.public_url still comes first.
  • A hub-less hive that only had hub.dashboard_url must now set dashboard.public_url.

Files

  • src/pkg/dashboard/task_mcp_lease.go: taskMCPURL returns only this hive's own address. mintTaskMCPForAssignment logs when there is none.
  • src/pkg/dashboard/task_mcp_remote_url_test.go: new tests TestRemoteMCPBlockWithheldWithoutAPublicAddressOfThisHive, TestRemoteMCPURLNamesThisHive and TestSelectTaskAssignCarriesRemoteMCPBlockOnlyForThisHive.
  • src/docs/design/task-mcp.md: which URL contributors get, and when none is sent.
  • src/docs/contributor-relay.md: the same, in short, for contributors.
  • src/docs/operator-reference/README.md: the dashboard.public_url row now mentions the task MCP.
  • changelog.d/security-task-mcp-remote-url-never-hub.md: the release note.

Tests

  • Three hives get no mcp block and no bearer: hub-less with no dashboard.public_url, hub-less with an old hub.dashboard_url, and a hub spoke with no hub.dashboard_url yet. All three fail without the change.
  • The real task_assign from task selection has no mcp key when the hive has no public address. This fails without the change. With dashboard.public_url it carries this hive's URL.
  • The cases that must keep working pass with and without the change: dashboard.public_url (used exactly as the operator wrote it), a hub spoke with its hub.dashboard_url, and dashboard.public_url first when both are set.
  • go test -count=1 -run 'TaskMCP|ContributeMCP|RemoteMCP|Lease' ./pkg/dashboard/ passes. So does -run 'SelectTask|Standby'.

πŸ€– Generated with Claude Code

…ver the hub's

With task_mcp.remote_enabled, the mcp.url in task_assign fell back from
dashboard.public_url to hub.dashboard_url (hub enabled or not) and then to
hub.url. hub.url is the hub itself and has a default on every hive, so a hive
with no public address sent https://hive.hivecommons.dev/api/contribute/mcp
together with its own lease bearer, and the relay wrote both to .mcp.json.

The URL is now dashboard.public_url, or hub.dashboard_url while the hub is
enabled; resolveSpokeDashboardURL has had the same hub.enabled condition for
hub-launched agents since issue 10282. hub.url is never used. With no address
left the hive sends no mcp block, mints no bearer and logs why at info level.
The docs now say which URL contributors are given.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Signed-off-by: Danathar <Danathar@users.noreply.github.com>
@kubestellar-prow kubestellar-prow Bot added the dco-signoff: yes Indicates the PR's author has signed the DCO. label Nov 6, 2026
@kubestellar-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign danathar for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubestellar-prow kubestellar-prow Bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 6, 2026
@github-actions

github-actions Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Open PR overlap check

Base branch: v6

Conflicts are checked with every PR merged onto the current tip of v6, so a PR that only needs a rebase is not reported as conflicting with its siblings.

PR Title Relation Files
#16915 πŸ› fix(task-mcp): a remote task's MCP token works for as long as its lease is renewed same files src/docs/contributor-relay.md
src/docs/design/task-mcp.md
src/pkg/dashboard/task_mcp_lease.go
#16910 πŸ› fix(scheduler): kicks point at hive-task only for agents that have the MCP server same files src/docs/design/task-mcp.md
#16688 🌱 Forward-merge v5 into v6 (2 commits) same files src/docs/operator-reference/README.md

@hivecommons-hive hivecommons-hive Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Decision needed: @clubanderson should decide whether remote contributors on a hub spoke that has no hub.dashboard_url (and on hub-less hives that relied on hub.url) should lose the task MCP entirely, as this PR does, rather than falling back to the derived https://<hive_id>. address that resolveSpokeDashboardURL still uses.

The code is correct and fixes a real credential misrouting; I'm routing it because it changes where a lease bearer is sent and drops one fallback, and that sign-off belongs to a maintainer.

Verified in the tree

  • src/pkg/config/defaults.go:236 sets Hub.URL = "https://hive.hivecommons.dev" on every hive, so the old third candidate in taskMCPURL really did put the hub into mcp.url β€” with this hive's bearer β€” for any hive lacking dashboard.public_url/hub.dashboard_url.
  • The new gate (hub.dashboard_url only while hub.enabled) mirrors resolveSpokeDashboardURL at src/cmd/hive/main.go:1859.
  • mintTaskMCPForAssignment already returned nil on an empty endpoint, so no bearer is minted now either; the new log line uses h.logger, which NewContributeWSHub defaults when nil.
  • Tests cover the three withheld cases and the kept cases.

The one decision (low severity, behaviour change) β€” task_mcp_lease.go:46: resolveSpokeDashboardURL (main.go:1870-1874) still derives https://<hive_id>.<hub-host> for a hub spoke without hub.dashboard_url. taskMCPURL deliberately does not, so such spokes now hand out no task MCP until the operator sets a URL. The PR body states this as intended; a maintainer should confirm that trade-off is acceptable (safe default) versus adopting the same derived address.

I have not approved or changed anything.

β€” hive: agent=reviewer backend=copilot model=claude-fable-5.1 copilot=1.0.88

@hivecommons-hive

hivecommons-hive Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Hive status β€” updated in place; edits do not notify. Full history is in the Activity Monitor.

Review findings from reviewer-2 (folded here because this head already carries its hive review):

Looks correct to me, and it is a strict tightening: the old third candidate cfg.Hub.URL meant a hive with no address of its own handed contributors this hive's lease bearer addressed to the hub.

Verified against the tree:

One non-blocking observation for the operator-facing behaviour change: resolveSpokeDashboardURL still synthesises https://<hiveID>.<hub host> (main.go:1870-1874) for a hub spoke with no hub.dashboard_url yet, whereas this PR sends no mcp block in that case. That is the conservative choice and the body says so; just noting the two resolvers now diverge on that one case in case anyone later wonders why hub-launched agents get a task MCP and remote contributors do not.

Evidence bundle `#169082b21b07` sha256:9975df167051a52de915a9f52585911578146d38878fb034157d78ed232bdcca β€” download from the dashboard or `hivectl review evidence #16908`.

@hivecommons-hive
hivecommons-hive Bot merged commit c6f0075 into hivecommons:v6 Nov 6, 2026
72 of 75 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has signed the DCO. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant