{"record":{"id":"66a8920a2c375aee","repo":"Hmbown/CodeWhale","slug":"ninth-activation","errorCode":null,"errorMessage":"ninth activation","messagePattern":"ninth activation","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tools/subagent/tests.rs","lineNumber":8121,"sourceCode":"    // production goal controls are eager and must not consume cache slots.\n    catalog\n        .iter_mut()\n        .find(|tool| tool.name == \"get_goal\")\n        .expect(\"goal read fixture\")\n        .defer_loading = Some(true);\n    let mut others = catalog\n        .iter()\n        .filter(|tool| tool.defer_loading == Some(true) && tool.name != \"get_goal\")\n        .map(|tool| tool.name.clone());\n    let mut warm = vec![\"get_goal\".to_string()];\n    warm.extend(others.by_ref().take(7));\n    let ninth = others.next().expect(\"ninth deferred child tool\");\n    let mut surface = SubAgentToolSurface::new(catalog, &warm);\n    model_request_tools(&mut surface);\n    execute_surface_tool(&registry, &mut surface, \"get_goal\", json!({}))\n        .await\n        .expect(\"cached read tool executes\");\n    surface.hydrate(&ninth).expect(\"ninth activation\");\n    assert!(model_tool_names(model_request_tools(&mut surface)).contains(\"get_goal\"));\n}\n\n#[test]\nfn small_surface_depth_cap_removes_only_agent() {\n    let mut runtime =\n        stub_runtime().with_agent_tool_surface_options(enabled_agent_surface_options());\n    runtime.worker_profile = WorkerRuntimeProfile::for_role(FleetRole::Builder);\n    runtime.spawn_depth = runtime.max_spawn_depth;\n    let registry = SubAgentToolRegistry::new(\n        runtime,\n        FleetRole::Builder,\n        None,\n        crate::tools::todo::new_shared_todo_list(),\n        crate::tools::plan::new_shared_plan_state(),\n    );\n    let mut surface = SubAgentToolSurface::new(\n        registry.deferred_catalog_for_model(&FleetRole::Builder),","sourceCodeStart":8103,"sourceCodeEnd":8139,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tools/subagent/tests.rs#L8103-L8139","documentation":"A `.expect(\"ninth activation\")` panic: surface.hydrate(&ninth) returned Err when the test tries to hydrate the ninth deferred tool, expecting the LRU to evict another entry to admit it. Failure means the hydration path rejects the activation instead of evicting a cached slot.","triggerScenarios":"surface.hydrate(&ninth) at crates/tui/src/tools/subagent/tests.rs:8121 errors — typically a not-found error because the ninth name is not in the catalog, or a cache-full error because the LRU no longer evicts on hydration at the cap.","commonSituations":"The catalog actually had fewer than nine deferred tools so `ninth` is an empty/garbage name; an LRU policy change made hydration at cap fail hard instead of evicting; hydrate now requires exact-name matching that the fixture name fails.","solutions":["Inspect the Err from hydrate: a not-found error points at the fixture list, a cache error at eviction policy.","Verify the ninth tool's name exists in the catalog (print catalog names before hydrate).","Confirm the LRU evicts the least-recently-used entry when a tenth tool is hydrated at the cap of nine.","Re-check that get_goal stayed hydrated after eviction if the test asserts on it afterwards."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"assert!(catalog.iter().any(|t| t.name == *ninth), \"ninth tool '{}' not in catalog\", ninth);","typeGuard":"fn in_catalog(catalog: &[Tool], name: &str) -> bool { catalog.iter().any(|t| t.name == name) }","tryCatchPattern":"surface.hydrate(&ninth).unwrap_or_else(|e| panic!(\"hydrating '{}' failed: {e}\", ninth));","preventionTips":["Verify the ninth fixture exists in the catalog before the hydration step.","Keep the LRU eviction-on-hydrate contract covered by an explicit unit test.","Make hydrate errors carry the missing tool name.","Re-check cap-dependent tests whenever eviction policy changes."],"tags":["rust","test-panic","hydrate","lru","deferred-tools"],"backgroundTag":"resource-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-22T10:30:35.592Z"}