fix(mcp): use ToolApprovalMode enum and clean up empty pending grants#944
Merged
Aaronontheweb merged 3 commits intonetclaw-dev:devfrom May 9, 2026
Merged
Conversation
Replace stringly-typed approval mode literals with ToolApprovalMode enum values in ApplySecureDefaultsForNewServer. Remove empty outer dictionary entries in ToggleServerAccess disable path to prevent HasUnsavedChanges false positives.
…dget `GetCompactionTimeout()` returned `max(TurnLlmTimeout, SidecarLlmTimeout)`, which equals `SidecarLlmTimeout` in the common case where they're configured identically. The compaction pipeline runs three phases under that single deadline, and the inner observer call already enforces its own `SidecarLlmTimeout` via a linked CTS — so the outer budget had zero headroom for Phase 1+2 work, threadpool scheduling, JIT, or GC. On cold-start Windows CI runners, `Buffer_drains_after_compaction` flaked because the watchdog fired ~11ms before the in-flight observer call returned. Same shape as the f5ffb5c DailyStatsActor cold-start fix. Changes: - `GetCompactionTimeout()` now returns `SidecarLlmTimeout * 2 + 5s`, giving the full sidecar budget plus headroom for the surrounding pipeline. - `CompactionIntegrationTests` bumps `TurnLlmTimeout`/`SidecarLlmTimeout` from 1s to 5s (matches the f5ffb5c precedent). - `Buffer_drains_after_compaction_timeout` bumps its `ExpectMsgAsync` waits to match the new 15s watchdog. Watchdog math: - Production default (Sidecar 90s) → 185s outer. - Compaction tests (Sidecar 5s) → 15s outer. - Streaming/watchdog/correlation tests are unaffected (don't compact).
Drop the "Old formula was..." line from GetCompactionTimeout — it would rot once memory of the prior bug fades. Drop the duplicated formula echo from the test comment too; kept the cold-start-margin rationale.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Follow-up to #943 — two cleanup fixes that missed the squash merge:
ApplySecureDefaultsForNewServerused raw string literals ("Auto","Approval","Deny") instead of theToolApprovalModeenum. Now usesToolApprovalMode.Autoetc. with.ToString()at the write site.ToggleServerAccessdisable path removed the audience entry from the inner dict but left an empty outer dict in_pendingGrants, causingHasUnsavedChangesto report true with no actual changes.Test plan
McpCommandTests+McpToolPermissionsViewModelTests)