Files
skillshare/internal
Willie 91dbd2a9fc fix(mcp): turn off a global server for Pi with its project override (#379)
* fix(mcp): turn off a global server for Pi with its project override

Since Pi 1.0.1, a .pi/mcp.json entry without command, url or type
overrides only enabled, exposure and toolExposure of the global server
with that name, and Pi's own /mcp writes {"enabled": false} for it.

Skillshare still wrote the global server's command (or url without the
query) next to enabled: false. Pi reads that entry as a project server
that replaces the global one, so turning it back on in Pi's /mcp only
dropped enabled and started the server without its args, env or
headers, and a url server lost its query. It also needed the global
server, so project mode refused pi in a disabled entry.

The switch is now the override alone. It needs nothing from the global
server, so project mode accepts it; a switch written by an earlier
release is rewritten on the next sync, and an identical override Pi
already wrote is unchanged instead of a conflict. The dashboard counts
Pi as an Agent with a per-project switch. Pi before 1.0.1 reports the
override as invalid, as the docs now say.

Closes #378

* fix(mcp): compare the whole Pi override before calling it the switch

Codex review on #379: an unmanaged .pi/mcp.json override such as
{"enabled": false, "exposure": "direct"} has the same ownership hash as
the switch sync writes, because that hash leaves out Pi-only fields like
exposure and toolExposure. Sync then reported it as unchanged, although
it differs from the switch and the docs promise a conflict. The check
now compares the whole entry, so only an exact {"enabled": false} is
unchanged; Pi fields a person adds to a switch this config already owns
are still kept, as for any managed Pi entry.

* docs(mcp): say which Pi overrides of a switch conflict

Codex review on #379 read "the override differs from the disabled
entry" as covering a switch sync already owns, where Pi settings added
in Pi, such as exposure, are kept: managed Pi entries keep Pi-only
fields by design (withAgentFields, piOwnedFields), and exposure does
nothing while the server is off. Turning the server back on in Pi
changes enabled, which the ownership hash covers, so that is a conflict.

The docs now say so: an exact {"enabled": false} is no conflict, Pi
settings added to an owned switch are kept, re-enabling in Pi
conflicts, and a differing override sync did not write conflicts.
TestPiSwitchOwnedBySync pins both owned-switch cases.
2026-10-04 11:50:03 +08:00
..