Skip to content

fix(mcp): use ToolApprovalMode enum and clean up empty pending grants#944

Merged
Aaronontheweb merged 3 commits intonetclaw-dev:devfrom
Aaronontheweb:fix/mcp-permissions-simplify
May 9, 2026
Merged

fix(mcp): use ToolApprovalMode enum and clean up empty pending grants#944
Aaronontheweb merged 3 commits intonetclaw-dev:devfrom
Aaronontheweb:fix/mcp-permissions-simplify

Conversation

@Aaronontheweb
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #943 — two cleanup fixes that missed the squash merge:

  • Stringly-typed approval mode: ApplySecureDefaultsForNewServer used raw string literals ("Auto", "Approval", "Deny") instead of the ToolApprovalMode enum. Now uses ToolApprovalMode.Auto etc. with .ToString() at the write site.
  • HasUnsavedChanges false positive: ToggleServerAccess disable path removed the audience entry from the inner dict but left an empty outer dict in _pendingGrants, causing HasUnsavedChanges to report true with no actual changes.

Test plan

  • All 31 MCP permission tests pass (McpCommandTests + McpToolPermissionsViewModelTests)
  • Slopwatch clean
  • Copyright headers verified

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.
@Aaronontheweb Aaronontheweb enabled auto-merge (squash) May 8, 2026 20:06
…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.
@Aaronontheweb Aaronontheweb merged commit da25364 into netclaw-dev:dev May 9, 2026
6 checks passed
@Aaronontheweb Aaronontheweb deleted the fix/mcp-permissions-simplify branch May 9, 2026 03:17
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