test: restore build_kernel_depth_test (7 tests, originally from #179)#185
Merged
Conversation
Closes the e2e coverage gap identified in the post-deletion audit: `build_kernel_from_config` had no direct tests for its depth-/production- based branch selection of MCP backend after its deletion in #179 (Vault+MCP-to-Hub migration). Restored 7 tests covering still-applicable invariants: - depth_zero_uses_local_backend_with_manager — root agent always owns a LocalMcpProvider (mcp_manager().is_some()) - depth_gt0_with_hub_client_uses_proxy_backend — sub-agent + hub_client → McpProxyClient, no local manager - depth_gt0_without_hub_client_falls_back_to_local — defensive fallback - non_production_skips_mcp_entirely — test mode keeps Local backend but skips MCP server spawn - build_kernel_with_slow_mcp_server_returns_within_bounded_wait — core startup-resilience promise: 1s budget + overhead ≤3s wall-clock - build_kernel_mixed_servers_completes_within_bounded_wait — even with multiple problem servers, build respects bounded wait - sub_agent_build_with_slow_root_config_does_not_spawn_local_mcp — anti- process-explosion: depth>0 + hub_client skips local MCP spawn entirely (chrome-devtools-mcp duplication scenario from the original incident) Two tests from the original were genuinely obsolete and NOT restored: - build_kernel_with_failing_mcp_server_does_not_propagate_error - build_kernel_skips_disabled_servers_entirely Both asserted on `mcp_provider().snapshot()` showing per-server status. Post-#179, MCP server spawning happens in `loopal-agent-hub::mcp_service` (Hub side), not in the agent process. The agent's `build_kernel_from_config` only selects the provider type — actual spawn/failure-reporting is now the Hub's responsibility and is covered by `loopal-agent-hub` tests. Audit also confirmed that `goal_kickoff_barren_test` deleted in #180 is legitimate — `barren_continuation_count` was replaced by ContinuationGate + DegenerationDetector, and is now covered by `degeneration_e2e_test.rs` and `idle_e2e_test.rs`. No restoration needed there. Adjusted McpServerConfig::Stdio variant to include the new fields (`sharing`, `cwd_isolation`) introduced after 5e41a0f.
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
Closes the last verified e2e gap from the historical-deletion audit. Restores 7 of the 9 tests from
build_kernel_depth_test.rsdeleted in5e41a0f8(#179, Vault+MCP-to-Hub migration). The other 2 deleted tests are genuinely obsolete in the new architecture.Restored coverage
crates/loopal-agent-server/tests/suite/build_kernel_depth_test.rs(7 tests, 188 LOC) verifiesbuild_kernel_from_configbranch selection that had NO direct test coverage:depth_zero_uses_local_backend_with_manager— root always owns LocalMcpProviderdepth_gt0_with_hub_client_uses_proxy_backend— sub-agent → McpProxyClientdepth_gt0_without_hub_client_falls_back_to_local— defensive fallbacknon_production_skips_mcp_entirely— test mode keeps Local backendbuild_kernel_with_slow_mcp_server_returns_within_bounded_wait— core startup-resilience: 1s budget + overhead ≤3sbuild_kernel_mixed_servers_completes_within_bounded_wait— multiple problem serverssub_agent_build_with_slow_root_config_does_not_spawn_local_mcp— anti-process-explosion (chrome-devtools-mcp duplication scenario)Genuinely obsolete (NOT restored)
build_kernel_with_failing_mcp_server_does_not_propagate_errorloopal-agent-hub::mcp_service); agent'sbuild_kernel_from_configonly selects provider type, so per-server failure status comes from Hub tests nowbuild_kernel_skips_disabled_servers_entirelygoal_kickoff_barren_test— confirmed not neededThe post-merge audit also identified
goal_kickoff_barren_test(deleted in #180) as a potential gap. Verified: this is legitimate deletion.barren_continuation_countwas replaced byContinuationGate+DegenerationDetectorin the same PR. The replacement mechanism is covered bydegeneration_e2e_test.rs(5 tests) andidle_e2e_test.rs(5+ tests).Audit conclusion
This PR closes the only remaining real coverage gap from the systematic audit of test deletions in 22 historical commits. The other 21 commits either:
AttemptCompletionTool,AutoQuestionHandler,compact_messages,forbids_prefill), orloopal-view-statereducer tests, MCP tests →loopal-mcp::proxy_client_test).Test plan
bazel build / test / clippy / rustfmt)build_kernel_depth_testpass locally