v0.9.14: Stop re-hashing plugin bundles on every MCP request
- Dominant language
- Rust
- Stars
- 41k
- Forks
- 3.6k
- Avg merge
- 13h 59m
- Merged PRs (30d)
- 299
Description
From `codewhale-ops/PERF-OPPORTUNITIES-20260915.md` §2 R1 **[V — verified 2026-09-15]**.
`crates/tui/src/mcp.rs:2169` (`call_method`) → `validate_before_use` (`mcp.rs:754`) → `verify_plugin_authority` (`plugins/registry.rs:1969`) → `PluginManifest::validate_from_path` on **both** the reviewed source and the staged runtime copy → `hash_bundle` (`manifest.rs:1389`): SHA-256 over every file in the bundle, twice, plus an fd-lock + JSON state read — per `tools/call`, `prompts/get`, `resources/read`.
Cost: multi-ms to tens-of-ms of sync file I/O + hashing on the async worker per tool round-trip for any plugin-provided MCP server. Agent-loop latency paid on every call.
**Fix:** verify at connect (already happens) and cache `{path, mtime, len} → (content_hash, capability_hash)`; revalidate only on cheap-stat drift or the revocation signal the existing 50ms watcher already produces. This is a security check running at the wrong cadence — once-per-use stat comparison preserves the guarantee.
Do not weaken the trust check; move its cadence from per-request to on-drift.
Contributor guide
Research direction
Start at crates/tui/src/mcp.rs:2169 and validate_before_use, then trace verify_plugin_authority in plugins/registry.rs:1969 and PluginManifest::validate_from_path through manifest.rs:1389. Preserve connect-time verification while caching the hashes with path, mtime, and length, and revalidate on stat drift or the existing watcher’s revocation signal. Done means MCP requests no longer hash unchanged plugin bundles while the trust check remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, performance, security
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100