Skip to content

Rectify: Fleet Tag Visibility Leak — Startup Disable Invariant Immunity#3363

Merged
Trecek merged 4 commits into
developfrom
fleet-tag-visibility-leak-fleet-fleet-dispatch-tags-never-di/3337
May 31, 2026
Merged

Rectify: Fleet Tag Visibility Leak — Startup Disable Invariant Immunity#3363
Trecek merged 4 commits into
developfrom
fleet-tag-visibility-leak-fleet-fleet-dispatch-tags-never-di/3337

Conversation

@Trecek
Copy link
Copy Markdown
Collaborator

@Trecek Trecek commented May 31, 2026

Summary

Fleet-tagged and fleet-dispatch-tagged MCP tools are visible in tools/list for ALL session types because server/__init__.py only disables kitchen and plan-review at startup — but _apply_session_type_visibility() assumes ALL conditional tags start disabled. The fix replaces manual per-tag mcp.disable() calls with a loop over ALL_VISIBILITY_TAGS, matching what the test conftest already does, and adds an arch test that structurally prevents regression by asserting the startup disable set covers all conditionally-enabled tags.

Closes #3337

Implementation Plan

Plan file: /home/talon/projects/autoskillit-runs/remediation-20260530-161302-799487/.autoskillit/temp/rectify/rectify_fleet_tag_visibility_leak_2026-05-30_163500.md

🤖 Generated with Claude Code via AutoSkillit

Token Usage Summary

Step Model count uncached output cache_read peak_ctx turns cache_write time
rectify* opus[1m] 1 3.0k 28.3k 1.9M 116.5k 213 173.2k 22m 21s
review_approach* sonnet 1 3.5k 5.9k 181.2k 42.1k 42 29.0k 2m 58s
dry_walkthrough* opus 2 856 16.6k 1.2M 66.7k 145 81.7k 9m 29s
implement* sonnet 2 394 20.8k 2.6M 86.4k 120 92.7k 9m 36s
audit_impl* sonnet 2 580 21.5k 574.3k 53.7k 95 93.8k 11m 34s
make_plan* sonnet 1 111 6.4k 478.6k 48.7k 29 35.0k 1m 59s
prepare_pr* sonnet 1 72.5k 3.2k 185.7k 31.0k 19 43.9k 1m 6s
compose_pr* sonnet 1 37.6k 1.3k 182.9k 31.0k 14 15.5k 39s
review_pr* sonnet 1 150 41.1k 807.7k 87.6k 67 73.8k 9m 56s
resolve_review* opus 1 548 12.8k 1.2M 77.7k 60 62.0k 9m 42s
Total 119.3k 158.0k 9.4M 116.5k 700.7k 1h 19m

* Step used a non-Anthropic provider; caching behavior may differ.

Token Efficiency

Step LoC Changed cache_read/LoC cache_write/LoC output/LoC
rectify 0
review_approach 0
dry_walkthrough 0
implement 229 11395.9 405.0 90.9
audit_impl 0
make_plan 0
prepare_pr 0
compose_pr 0
review_pr 0
resolve_review 4 309304.8 15498.2 3208.0
Total 233 40464.3 3007.4 678.3

Model Usage Breakdown

Model steps uncached output cache_read cache_write time
opus[1m] 1 3.0k 28.3k 1.9M 173.2k 22m 21s
sonnet 7 114.9k 100.3k 5.0M 383.8k 37m 50s
opus 2 1.4k 29.4k 2.5M 143.7k 19m 12s

Trecek and others added 4 commits May 30, 2026 18:03
Add test_startup_disables_all_visibility_tags (AST-level structural guard) asserting
that server/__init__.py uses a for-loop over ALL_VISIBILITY_TAGS rather than hardcoded
mcp.disable() calls. Add 5 negative-visibility regression tests to TestSessionTypeVisibility
asserting fleet/fleet-dispatch tools are absent from non-fleet session types.
Replace two hardcoded mcp.disable(tags={"kitchen"}) and mcp.disable(tags={"plan-review"})
calls in server/__init__.py with a single loop over ALL_VISIBILITY_TAGS. This ensures fleet,
fleet-dispatch, kitchen-core, and headless tags are also disabled at startup, preventing
fleet tools from being visible in non-fleet sessions. Update server/CLAUDE.md to reflect
the new startup behavior, correct the ALL_VISIBILITY_TAGS listing (add plan-review), fix
the wrong filename reference (_type_constants.py → _type_constants_registries.py), and
update the anomalies and tool gating matrix entries.
…sables_all_visibility_tags

Replace boolean `canonical_loop_found` flag with integer `canonical_loop_count` counter
and change the assertion to `== 1`, enforcing that server/__init__.py has exactly one
qualifying ALL_VISIBILITY_TAGS for-loop rather than at least one.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tants

Update Registry Constants header to reference _type_constants_registries.py (not
_type_constants.py) and fix FLEET_DISPATCH_TOOLS description from "always tag-visible"
to "hidden at startup" — aligning with the gating matrix and actual startup behavior.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@Trecek Trecek force-pushed the fleet-tag-visibility-leak-fleet-fleet-dispatch-tags-never-di/3337 branch from 8fbb4a9 to bcc2a7b Compare May 31, 2026 01:03
@Trecek Trecek added this pull request to the merge queue May 31, 2026
Merged via the queue into develop with commit 79bf382 May 31, 2026
3 checks passed
@Trecek Trecek deleted the fleet-tag-visibility-leak-fleet-fleet-dispatch-tags-never-di/3337 branch May 31, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant