Repository navigation
Fix e2e tool coverage gaps in ollama_integration tests and search_nodes prompt bias - #1091
Conversation
- agent/tools.rs: add update_schema tool (delegating to handle_update_schema MCP handler), fix create/update_node to use single content field, improve title_template field description to require matching fields entries; fix test assertions to use content field; update definitions_count to 13 - agent/prompt_assembler.rs: add assemble_static() for test use — builds prompt from seed nodes without a DB, renders minijinja templates with provided workspace_context - agent_types.rs + agent_loop.rs: add system_prompt_override field to AgentSession and set_system_prompt() to LocalAgentService — bypasses PromptAssembler/fallback for tests injecting pre-built prompts - ollama_integration.rs: schema_creation_context() now uses assemble_static() + seed_skill_nodes() so prompt changes auto-reflect in tests; call sites switch from set_session_context to set_system_prompt Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…ields
The Project schema example had title_template: "{name} ({status})" but
omitted 'name' from the fields array — the model was copying this broken
pattern. Added 'name' as text field to the example and strengthened the
TITLE TEMPLATE rule to say "CRITICAL: every placeholder MUST be defined
as a field", with examples showing field-template alignment.
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Instead of an opaque SurrealDB CREATE failure, check upfront if the schema already exists and return: "Schema 'X' already exists. Use create_node with node_type='x' to create instances." This gives the model enough information to stop retrying and switch to create_node. Applies to both the MCP path and local agent (exec_create_schema delegates to handle_create_schema in both cases). Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…_node creates data Small models conflate create_schema (type definition) with create_node (data creation). Prepend a concise NODE MODEL paragraph to the Tool Strategy Guide explaining that custom types need a schema node first, and that create_schema defines the type while create_node creates instances. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
get_schema_node returns Result<Option<SchemaNode>>. Using is_ok() matched both Ok(None) (not found) and Ok(Some(_)) (found), causing every create_schema call to fail with "already exists" on a fresh DB. Changed to matches!(…, Ok(Some(_))) to only match actual existence. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- Return fallback message when model produces no text and no tool calls, instead of silently returning empty string to the UI - Improve Node Creation skill description to better match intents like "create entries/records/samples/examples" for custom types Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Code Review — PR #1091 (Initial Review)Review Type: Initial Review Requirements Check
All acceptance criteria are addressed. Code Review Findings[Improvement]
|
malibio
left a comment
There was a problem hiding this comment.
Pragmatic code review completed. Detailed findings posted as inline comment. Recommendation: APPROVE — all acceptance criteria met, no blocking issues found.
…de_uri tests - exec_update_schema: apply same Ok(error_result) pattern as exec_create_schema so the model receives validation errors as tool responses and can self-correct (rather than propagating as ToolError::ExecutionFailed) - assemble_static: add current_date parameter (Option<&str>, defaults to "2025-01-01") making the intentional divergence from production assemble() explicit rather than silent; update ollama_integration.rs call site - node_uri / strip_node_uri: add three round-trip unit tests (round-trip, idempotent, no-prefix) to prevent silent regression - system_prompt_override on AgentSession: deferred to follow-up issue #1093 because #[cfg(test)] on struct fields does not propagate to integration test binaries in tests/ — the field is already skip_serializing_if="is_none" and never set in production sessions - max-iterations raw tool names: deferred to follow-up issue #1092 Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
Review Feedback AddressedCommit: 4e516eb Implemented[Important] exec_update_schema error handling consistency [Suggestion] assemble_static current_date parameter [Suggestion] node_uri / strip_node_uri round-trip tests
Deferred with Follow-up Issues[Important] system_prompt_override on AgentSession → Issue #1093 [Suggestion] Humanize tool names in max-iterations fallback → Issue #1092 |
…at values (#1080) - Flip get_prop() lookup order: check namespaced key first, flat fallback second so MCP updates (which normalize to namespace) aren't shadowed by pre-normalization flat values stored in older databases - Update SkillNodeBehavior::validate() to use get_namespaced_prop() so validation runs against the actual stored value (namespaced after create_node normalization) - Add get_namespaced_prop() helper in behaviors/mod.rs with namespace-first order - Fix 3 stale agent tool tests left broken by #1091: tool count 12→13, create_node required field title→content, create_node_missing_required test Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
… max_iterations updates via MCP (#1095) * Fix: namespace-first property lookup so MCP updates override stale flat values (#1080) - Flip get_prop() lookup order: check namespaced key first, flat fallback second so MCP updates (which normalize to namespace) aren't shadowed by pre-normalization flat values stored in older databases - Update SkillNodeBehavior::validate() to use get_namespaced_prop() so validation runs against the actual stored value (namespaced after create_node normalization) - Add get_namespaced_prop() helper in behaviors/mod.rs with namespace-first order - Fix 3 stale agent tool tests left broken by #1091: tool count 12→13, create_node required field title→content, create_node_missing_required test Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Fix linting and formatting * Address review: add regression test for #1080 bug scenario Adds get_prop_namespace_overrides_stale_flat test that directly documents the failure mode: flat {"max_iterations": 2} coexisting with namespaced {"skill": {"max_iterations": 4}} after an MCP update, ensuring namespace wins. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
…es prompt bias (#1091) * Wire seed-based prompts into integration tests, add update_schema tool - agent/tools.rs: add update_schema tool (delegating to handle_update_schema MCP handler), fix create/update_node to use single content field, improve title_template field description to require matching fields entries; fix test assertions to use content field; update definitions_count to 13 - agent/prompt_assembler.rs: add assemble_static() for test use — builds prompt from seed nodes without a DB, renders minijinja templates with provided workspace_context - agent_types.rs + agent_loop.rs: add system_prompt_override field to AgentSession and set_system_prompt() to LocalAgentService — bypasses PromptAssembler/fallback for tests injecting pre-built prompts - ollama_integration.rs: schema_creation_context() now uses assemble_static() + seed_skill_nodes() so prompt changes auto-reflect in tests; call sites switch from set_session_context to set_system_prompt Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Fix schema guidance example: title_template {name} requires name in fields The Project schema example had title_template: "{name} ({status})" but omitted 'name' from the fields array — the model was copying this broken pattern. Added 'name' as text field to the example and strengthened the TITLE TEMPLATE rule to say "CRITICAL: every placeholder MUST be defined as a field", with examples showing field-template alignment. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Return clear error when create_schema called on existing schema Instead of an opaque SurrealDB CREATE failure, check upfront if the schema already exists and return: "Schema 'X' already exists. Use create_node with node_type='x' to create instances." This gives the model enough information to stop retrying and switch to create_node. Applies to both the MCP path and local agent (exec_create_schema delegates to handle_create_schema in both cases). Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Add node model framing to system prompt — schema defines type, create_node creates data Small models conflate create_schema (type definition) with create_node (data creation). Prepend a concise NODE MODEL paragraph to the Tool Strategy Guide explaining that custom types need a schema node first, and that create_schema defines the type while create_node creates instances. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Fix schema existence check: Ok(None) is not the same as Ok(Some(_)) get_schema_node returns Result<Option<SchemaNode>>. Using is_ok() matched both Ok(None) (not found) and Ok(Some(_)) (found), causing every create_schema call to fail with "already exists" on a fresh DB. Changed to matches!(…, Ok(Some(_))) to only match actual existence. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Fix empty agent response and improve Node Creation skill matching - Return fallback message when model produces no text and no tool calls, instead of silently returning empty string to the UI - Improve Node Creation skill description to better match intents like "create entries/records/samples/examples" for custom types Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Address review: error handling consistency, assemble_static param, node_uri tests - exec_update_schema: apply same Ok(error_result) pattern as exec_create_schema so the model receives validation errors as tool responses and can self-correct (rather than propagating as ToolError::ExecutionFailed) - assemble_static: add current_date parameter (Option<&str>, defaults to "2025-01-01") making the intentional divergence from production assemble() explicit rather than silent; update ollama_integration.rs call site - node_uri / strip_node_uri: add three round-trip unit tests (round-trip, idempotent, no-prefix) to prevent silent regression - system_prompt_override on AgentSession: deferred to follow-up issue #1093 because #[cfg(test)] on struct fields does not propagate to integration test binaries in tests/ — the field is already skip_serializing_if="is_none" and never set in production sessions - max-iterations raw tool names: deferred to follow-up issue #1092 Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Claude Sonnet 4.6 <[email protected]>
… max_iterations updates via MCP (#1095) * Fix: namespace-first property lookup so MCP updates override stale flat values (#1080) - Flip get_prop() lookup order: check namespaced key first, flat fallback second so MCP updates (which normalize to namespace) aren't shadowed by pre-normalization flat values stored in older databases - Update SkillNodeBehavior::validate() to use get_namespaced_prop() so validation runs against the actual stored value (namespaced after create_node normalization) - Add get_namespaced_prop() helper in behaviors/mod.rs with namespace-first order - Fix 3 stale agent tool tests left broken by #1091: tool count 12→13, create_node required field title→content, create_node_missing_required test Co-Authored-By: Claude Sonnet 4.6 <[email protected]> * Fix linting and formatting * Address review: add regression test for #1080 bug scenario Adds get_prop_namespace_overrides_stale_flat test that directly documents the failure mode: flat {"max_iterations": 2} coexisting with namespaced {"skill": {"max_iterations": 4}} after an MCP update, ensuring namespace wins. Co-Authored-By: Claude Sonnet 4.6 <[email protected]> --------- Co-authored-by: Michael Libio <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]>
Closes #1083