Skip to content

test: restore build_kernel_depth_test (7 tests, originally from #179)#185

Merged
yishuiliunian merged 1 commit into
mainfrom
restore/depth-and-barren-tests
May 26, 2026
Merged

test: restore build_kernel_depth_test (7 tests, originally from #179)#185
yishuiliunian merged 1 commit into
mainfrom
restore/depth-and-barren-tests

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

Closes the last verified e2e gap from the historical-deletion audit. Restores 7 of the 9 tests from build_kernel_depth_test.rs deleted in 5e41a0f8 (#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) verifies build_kernel_from_config branch selection that had NO direct test coverage:

  • depth_zero_uses_local_backend_with_manager — root always owns LocalMcpProvider
  • depth_gt0_with_hub_client_uses_proxy_backend — sub-agent → McpProxyClient
  • depth_gt0_without_hub_client_falls_back_to_local — defensive fallback
  • non_production_skips_mcp_entirely — test mode keeps Local backend
  • build_kernel_with_slow_mcp_server_returns_within_bounded_wait — core startup-resilience: 1s budget + overhead ≤3s
  • build_kernel_mixed_servers_completes_within_bounded_wait — multiple problem servers
  • sub_agent_build_with_slow_root_config_does_not_spawn_local_mcpanti-process-explosion (chrome-devtools-mcp duplication scenario)

Genuinely obsolete (NOT restored)

Original Reason
build_kernel_with_failing_mcp_server_does_not_propagate_error Post-#179 MCP spawn moved to Hub (loopal-agent-hub::mcp_service); agent's build_kernel_from_config only selects provider type, so per-server failure status comes from Hub tests now
build_kernel_skips_disabled_servers_entirely Same reason

goal_kickoff_barren_test — confirmed not needed

The post-merge audit also identified goal_kickoff_barren_test (deleted in #180) as a potential gap. Verified: this is legitimate deletion. barren_continuation_count was replaced by ContinuationGate + DegenerationDetector in the same PR. The replacement mechanism is covered by degeneration_e2e_test.rs (5 tests) and idle_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:

  • removed tests for genuinely retired features (e.g. AttemptCompletionTool, AutoQuestionHandler, compact_messages, forbids_prefill), or
  • migrated tests to better-placed equivalents (e.g. session tests → loopal-view-state reducer tests, MCP tests → loopal-mcp::proxy_client_test).

Test plan

  • CI passes (bazel build / test / clippy / rustfmt)
  • 7 new tests in build_kernel_depth_test pass locally

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.
@yishuiliunian yishuiliunian merged commit c6a30c0 into main May 26, 2026
4 checks passed
@yishuiliunian yishuiliunian deleted the restore/depth-and-barren-tests branch May 26, 2026 23:54
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