test: add comprehensive test coverage for MCP allowHeadless feature #9329
+593
−45
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.
Overview
This PR adds comprehensive test coverage for the
allowHeadlessfeature introduced in PR #9328. The new tests ensure robust behavior of MCP tools in headless mode across various scenarios.Test Coverage Added
1. Edge Cases and Error Handling
allowHeadless: falsebehavior2. Permission Policy Interactions
3. Integration Tests
4. Built-in Tool Behavior
Key Improvements
Security-Critical Tests
✅ Explicit exclusions always respected (cannot be bypassed by
allowHeadless)✅ Wildcard excludes take precedence over
allowHeadless✅ Default behavior is secure (tools excluded without explicit
allowHeadless: true)Test Organization
Tests are organized into 4 logical groups:
MCP tools in headless mode(original tests from PR docs: add allowHeadless documentation for MCP servers in CLI headless mode #9328)MCP tool execution permission in headless mode(original + new built-in test)MCP tool edge cases and error handling(new)MCP tool permission policy interactions(new)MCP tool integration tests(new)Files Modified
extensions/cli/src/stream/mcp-headless.test.ts: Added 12 new test casesTEST_IMPROVEMENTS.md: Documentation of test improvementsTest Statistics
This task was co-authored by peter-parker and Continue.
Summary by cubic
Added 12 tests that verify MCP allowHeadless behavior in headless mode. Improves security guarantees and covers real-world scenarios.
Written for commit 981c13f. Summary will update automatically on new commits.