Repository navigation
Description
Summary
Completing workspace-tool enrollment can replace the session's entire durable tool authority with only the enrolled broker catalogue's tool names. Unrelated core tools, including Shell, then disappear from the model-visible tool surface and remain absent across resume and fork.
Permission mode and operator posture cannot restore the missing tools because the persisted bound authority is applied as a stricter request-time filter.
Observed behavior
- Start an ordinary filesystem session where
Shellis available. - Complete workspace-tool enrollment with a catalogue that does not contain
Shell. - On the next request,
Shellis no longer advertised. - Exit and resume the session:
Shellremains absent. - Fork the session: the fork also lacks
Shell. - Starting mecatui with
--mode accept-edits --posture autodoes not restore it. Diagnostics report the persisted session mode, while the deployment-wide Bash capability can still appear enabled.
Observed with:
mecatui v0.0.39-6-g68aa40e57
embedded server
permission mode: default
Expected behavior
Workspace enrollment should atomically replace the broker-owned tool bundle without attenuating unrelated core, delegation, memory, skill, global MCP, or client MCP tools that remain present in the rebuilt session catalog.
Resume and fork should preserve the resulting complete authority. Deliberately attenuated sessions must still remain unable to widen their own authority.
Likely cause
internal/adapter/server/workspace_enrollment.go obtains only the enrolled catalogue's names and passes them to the aggregate:
toolNames := result.Catalogue.ToolNames()
// ...
sess.CompleteWorkspaceEnrollment(pending, toolNames)engine/session/workspace_enrollment.go then replaces the complete generic capability list:
exact := s.Authority.Clone()
exact.CapabilitySet.Tools = append([]string(nil), exactTools...)
s.Authority = exactThe rebuilt engine catalog is broader than that broker-only list: composition registers core tools and other session tools alongside the enrolled wrappers. At request construction, engine/agent/loop.go applies authoritySpecs, so every catalog tool absent from the persisted broker-only list is removed.
Forking copies the source authority in internal/adapter/server/placement_successor.go, making the attenuation durable in successors as well.
Suggested direction
Do not solve this by blindly unioning the previous authority with the new broker list; that would retain stale broker tools during replacement.
Instead, make the rebuilt session-engine path return or otherwise project the exact final catalog registration names after composition. Persist that complete set only after the replacement engine has been successfully built. This preserves atomic broker replacement while retaining unrelated tools that remain in the actual catalog.
Regression coverage
- Core
Shell, file, delegation, memory, and skill tools remain after initial workspace enrollment. - A broker refresh removes stale broker-owned names and installs the exact replacement bundle.
- Global MCP and client MCP tools remain when still present in the rebuilt catalog.
- Persisted authority exactly matches the final built catalog.
- Resume retains the corrected complete authority.
- Fork retains the corrected complete authority.
- Deliberately attenuated sessions cannot regain excluded tools through enrollment, resume, fork, mode, or posture.
- Per-session diagnostics distinguish globally supported Bash from a session tool removed by mode, authority, or mount availability.
Relevant code
internal/adapter/server/workspace_enrollment.goengine/session/workspace_enrollment.goengine/agent/authority_disclosure.goengine/agent/loop.gointernal/adapter/server/placement_successor.gointernal/app/catalog.go
Activity
docs(plan): tighten workspace enrollment authority contract
docs(plan): amend enrollment authority after spike review
docs(plan): tighten workspace enrollment authority contract
docs(plan): amend enrollment authority after spike review
fix(enrollment): preserve workspace enrollment authority
docs(plan): tighten workspace enrollment authority contract
docs(plan): amend enrollment authority after spike review
docs(plan): renumber ADR to 0356 and relate it to ADR 0355
fix(enrollment): preserve workspace enrollment authority
docs(plan): tighten workspace enrollment authority contract
docs(plan): amend enrollment authority after spike review
docs(plan): renumber ADR to 0356 and relate it to ADR 0355
docs(plan): address plan review and renumber ADR to 0357
fix(enrollment): preserve workspace enrollment authority
docs(plan): tighten workspace enrollment authority contract
docs(plan): amend enrollment authority after spike review
docs(plan): renumber ADR to 0356 and relate it to ADR 0355
docs(plan): address plan review and renumber ADR to 0358
fix(enrollment): preserve workspace enrollment authority
fix(enrollment): preserve workspace enrollment authority
fix(enrollment): preserve workspace enrollment authority
fix(enrollment): preserve workspace enrollment authority
fix(enrollment): preserve workspace enrollment authority
fix(enrollment): preserve workspace enrollment authority
jhrozek commentedon Oct 19, 2026
Fixed on main by #1809 (2ad7d94, merged 2026-10-15). Workspace enrollment now replaces only the prior broker-owned tool bundle, tracked by a persisted broker-key ledger, so unrelated core tools such as
Shellkeep their authority across enrollment, resume and fork. Closing.