* fix(agent): scope the @Skill and @MCP pickers to the agent that will run
Both pickers listed the caller's own workspace, but a shared agent invokes its
OWNER's skills and MCP services. The two never line up, so for every shared
agent:
* @Skill was always empty, in every skills mode. GET /skills resolves the
sandbox config with (tenant, id), and the agent's config id does not exist
in the borrower's workspace - effectiveTenantSkills short-circuits before
it reads a single skill row. The response still reported
skills_available: true, so the category appeared with nothing under it.
* @MCP in "selected" mode was empty for the same reason: the preset holds the
owner's service ids, which match nothing in the borrower's catalog.
* @MCP in "all" mode was worse than empty. isMCPAllowedByAgent returns true
for every enabled service, so the picker offered the BORROWER's own
services; resolvePerRequestMCPScope then intersected the mention against
the agent's preset, found nothing, and dropped it with only a warning.
Resolve the agent when the request carries agent_id + agent_source_tenant_id
and read its resources where they live. Only an explicit source workspace takes
the share path, so an own-agent request is byte-for-byte unchanged; built-in
agent ids exist in every workspace, and falling back to a share lookup without
one would let an org member take over the caller's default agent, exactly as
session.Handler.resolveAgent already documents.
Both endpoints serve only what the agent can actually invoke:
* skills: the sandbox config comes from the agent, never from the query, so a
borrower cannot name another config in the owner's workspace and enumerate
it; "selected" narrows to the configured names and a disabled picker never
reaches the owner's inventory at all.
* MCP: the agent's explicit preset and nothing else, because that is exactly
what resolvePerRequestMCPScope accepts for a shared agent. "all" therefore
offers nothing rather than offering services every mention would drop.
Whether "all" should become mentionable is a separate decision about that
guard, not about the picker.
The cross-workspace MCP rows use a narrowed response built field by field.
NewMCPServiceResponse reveals endpoint URL, headers, env vars and stdio command
to an Admin, and a borrower can be an Admin of their own workspace - that shape
must be narrow by construction, not by role.
On the client the two lists now follow the selected agent: their cache keys
carry it, and the chat input refetches on a switch behind a request token, so a
slow response for the agent the user just left cannot overwrite the picker with
another workspace's services.
* fix(agent): check the c.Error return on the shared-agent picker paths
golangci-lint judges pull requests on the lines they introduce, so the
repository's older bare c.Error calls are grandfathered while these three are
not. Match the _ = c.Error form already used in mcp_service.go.