feat(TASK-016): engine + test fixes from the Phase-1 re-review
- warn-per-retry test via shared test-only WarnCollector (src/testing.rs) - extraction-placement test: extraction failures are never retried - is_transient_error: typed reqwest/Elapsed pre-check + anchored 429 matchers - outcome_from docstring corrected; validator warning for fallback+output_schema without state_updates (llm + agent) - validator error for max_attempts == 0 (llm + agent); runtime backstop kept - nits: generalized branch-escape error text, Continue payload comment, BFS test assignments assert, node_id threaded into AgentNodeExecutor warns - bundled-graph warning baseline records 3 true-positive step-runner nodes (orient, edge_case_sweep, write_handoff) pending state_updates there
This commit is contained in:
9 files changed
+519
-70
No files matched your search
@@ -8200,6 +8200,20 @@ mod tests {
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn fallback_capture(node_ids: &[&str]) -> Vec<String> {
|
||||
node_ids
|
||||
.iter()
|
||||
.map(|id| {
|
||||
format!(
|
||||
"{id}: llm node declares `fallback` with `output_schema` but no \
|
||||
`state_updates`; on failure the \"…failed: <chain>\" string is \
|
||||
only written through `state_updates`, so the fallback node \
|
||||
cannot see why it was reached"
|
||||
)
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
let _guard = TestConfigDirGuard::new();
|
||||
|
||||
Agent::install_builtin_agents(false).unwrap();
|
||||
@@ -8238,7 +8252,9 @@ mod tests {
|
||||
// nodes, plus variable-shadowing on `coder` and `step-runner` (they
|
||||
// declare variables whose names are also `initial_state` keys). A new
|
||||
// rule that fires on a shipped asset (or a new bundled graph) must be
|
||||
// recorded here deliberately.
|
||||
// recorded here deliberately. The fallback-capture warnings on
|
||||
// `step-runner` are true positives, recorded until those nodes gain
|
||||
// `state_updates` that capture the failure string.
|
||||
let expected_warnings = BTreeMap::from([
|
||||
("adversary".to_string(), Vec::new()),
|
||||
("code-reviewer".to_string(), Vec::new()),
|
||||
@@ -8266,9 +8282,8 @@ mod tests {
|
||||
("finding-verifier".to_string(), Vec::new()),
|
||||
("librarian".to_string(), Vec::new()),
|
||||
("review-gauntlet".to_string(), Vec::new()),
|
||||
(
|
||||
"step-runner".to_string(),
|
||||
[
|
||||
("step-runner".to_string(), {
|
||||
let mut lines = [
|
||||
shadowed(&["plans_dir", "project_dir"]),
|
||||
unreachable(&[
|
||||
"check_handoff",
|
||||
@@ -8290,9 +8305,12 @@ mod tests {
|
||||
"verify_tests",
|
||||
"write_handoff",
|
||||
]),
|
||||
fallback_capture(&["edge_case_sweep", "orient", "write_handoff"]),
|
||||
]
|
||||
.concat(),
|
||||
),
|
||||
.concat();
|
||||
lines.sort();
|
||||
lines
|
||||
}),
|
||||
]);
|
||||
assert_eq!(
|
||||
warnings_by_agent, expected_warnings,
|
||||
|
||||
@@ -918,42 +918,8 @@ mod tests {
|
||||
use super::*;
|
||||
use crate::config::mcp_tool_policy::LayerSource;
|
||||
use crate::function::ToolCall;
|
||||
use log::{Level, LevelFilter, Log, Metadata, Record};
|
||||
use crate::testing::{install_warn_collector, warn_messages};
|
||||
use std::sync::atomic::Ordering;
|
||||
use std::sync::{Mutex, Once, OnceLock};
|
||||
|
||||
struct WarnCollector;
|
||||
|
||||
static WARN_MESSAGES: OnceLock<Mutex<Vec<String>>> = OnceLock::new();
|
||||
|
||||
fn warn_messages() -> &'static Mutex<Vec<String>> {
|
||||
WARN_MESSAGES.get_or_init(Mutex::default)
|
||||
}
|
||||
|
||||
impl Log for WarnCollector {
|
||||
fn enabled(&self, metadata: &Metadata) -> bool {
|
||||
metadata.level() <= Level::Warn
|
||||
}
|
||||
|
||||
fn log(&self, record: &Record) {
|
||||
if self.enabled(record.metadata()) {
|
||||
warn_messages()
|
||||
.lock()
|
||||
.unwrap()
|
||||
.push(record.args().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
fn flush(&self) {}
|
||||
}
|
||||
|
||||
fn install_warn_collector() {
|
||||
static INSTALL: Once = Once::new();
|
||||
INSTALL.call_once(|| {
|
||||
log::set_logger(&WarnCollector).expect("no other logger should be installed");
|
||||
log::set_max_level(LevelFilter::Warn);
|
||||
});
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn mcp_runtime_new_is_empty() {
|
||||
|
||||
Reference in new issue
Block a user