Repository navigation
Audit all agent-facing parameter structs for silent unknown-field discard - #1823
Conversation
…1816) Generalizes the coreValues fix (#1819): a small local model that misspells a tool-call argument key had that key silently dropped, surfacing only as an unrelated downstream error two layers from the cause. deny_unknown_fields turns that into an immediate, self-describing rejection naming the bad key (serde's default message also lists the accepted field names). Applied to every struct deserialized directly from raw tool-call JSON: SearchNodesParams/SearchSemanticParams, AgentFilterItem/AgentSortItem, UpdateSchemaParams (create_schema's sibling) and AdditionalConstraints, CreateNodesFromMarkdownParams, and the remaining local_agent::tools structs (CreateRelationshipParams, GetRelatedNodesParams, ResolveQueryParams, SearchSkillsParams, UpdateTaskStatusParams, DeleteNodeParams, AgentGetNodeParams). Also hardened schema-relationship and batch-node structs that aren't currently tool-reachable but sit on the same Value boundary. AgentCreateNodeParams and AgentUpdateNodeParams are deliberately excluded: exec_create_node/exec_update_node intentionally tolerate flat schema-property keys at the top level (promoting them into `properties`), so those structs must keep accepting the same "unknown" keys their callers pre-scan for. One rejection test per newly-guarded tool confirms an unknown key is rejected (not ignored) and that the error names the offending field. Co-Authored-By: Claude <[email protected]>
Code Review SummaryThis is a solid, well-scoped generalization of the FindingsCritical IssuesNone. Suggested Improvements
Nitpicks
Verification performed
|
malibio
left a comment
There was a problem hiding this comment.
Net-positive audit generalization, verified correct — see full findings in the PR comment above. No blockers; one Improvement-level test-coverage gap noted (dead relationship/batch structs and a couple of nested-item structs lack dedicated rejection tests), plus two nits. Not merging per instructions.
… rationale Adds rejection tests and doc comments for the four structs the pragmatic review flagged as inconsistently covered relative to the PR's own scoping logic (none reachable from a tool call today, same as the already-called-out ExecuteQueryInput/QueryNodesInput): - AddSchemaRelationshipParams, RemoveSchemaRelationshipParams, FieldRename (schema/mod.rs) — no add/remove_schema_relationship tool exists - GetMarkdownParams, UpdateRootFromMarkdownParams (markdown/mod.rs) — built only from already-validated Rust fields (get_node's format="markdown" path, the daemon's export_markdown gRPC handler, or nothing at all) Also adds a nested-struct rejection test for AgentFilterItem/AgentSortItem (query_ops.rs) plus one through a real search_nodes payload (agent_params.rs), matching the coverage already given to AdditionalConstraints. And states explicitly, in agent_params.rs's module doc, that serde's stock "unknown field X, expected one of ..." message already satisfies both halves of the acceptance criterion — no custom formatting needed for future additions. Addresses non-blocking suggestions from the PR #1823 review. Co-Authored-By: Claude <[email protected]>
Addressed review feedbackAll items from the review were suggested improvements / nitpicks (no criticals) — all addressed:
Nothing was skipped. Re-Review DecisionDecision: NO RE-REVIEW NEEDED Rationale: All changes are additive test coverage and doc comments on structs that were already correctly excluded from the tool-call surface (no |
…l test gap - Malformed filters from the decomposition step were silently swallowed via .ok(); now logged with tracing::warn! (matching the deny_unknown_fields rigor #1823 established for AgentFilterItem elsewhere) so a bad key producing a wrong resolution isn't silent. Added a regression test confirming one malformed filter is dropped while a valid sibling filter still resolves the node it uniquely identifies. - Documented, rather than silently left implicit, that resolve_query's integration tests all use a stubbed inference engine — the real decomposition prompt's accuracy is exercised only by the eval harness (scripts/eval/fixtures/agent-matrix.ts scenario 6), not cargo test. Building an in-crate real-model fixture would mean new test infrastructure matching ai_chat_send_to_idle_test.rs's pattern (model download/load, machine-load-sensitive timing) — out of scope for this fix. Addresses non-blocking suggestions from the PR #1825 review. Co-Authored-By: Claude <[email protected]>
* resolve_query returns a resolved node, not query fragments (closes #1637) resolve_query previously returned {query, filters} for the model to route into search_nodes itself; the model reliably skipped that step, inventing a nonexistent update_node filters parameter instead. resolve_query now performs the search internally (via a shared run_node_query core also used by search_nodes) and returns the resolved node directly on a unique match, or an explicit no_match/multiple_matches discrimination otherwise — per ADR-064 rule 4, tool results own facts, not plans. Regression tests cover the three measured phrasings (dollar amount, relative date, paraphrased identifier) plus zero- and multi-match discrimination. skill_pipeline.rs's Graph Editing guidance and the resolve_query tool description are rewritten for the new contract. Co-Authored-By: Claude <[email protected]> * Fix svelte-check failure in dev-proxy-recovery.e2e.ts svelte-check rejected the .ts-extension import under the desktop-app tsconfig (allowImportingTsExtensions is not set); Vite/Vitest resolve the extensionless form the same way every other cross-package import in this codebase already uses, so drop the extension rather than loosen the tsconfig. Also required a fresh bun install — @grpc/grpc-js and @grpc/proto-loader were present in dev-tools' hoisted node_modules but missing from a stale desktop-app node_modules, which is what surfaced as "cannot find module" alongside the extension error. Co-Authored-By: Claude <[email protected]> * Address review: log dropped resolve_query filters, document real-model test gap - Malformed filters from the decomposition step were silently swallowed via .ok(); now logged with tracing::warn! (matching the deny_unknown_fields rigor #1823 established for AgentFilterItem elsewhere) so a bad key producing a wrong resolution isn't silent. Added a regression test confirming one malformed filter is dropped while a valid sibling filter still resolves the node it uniquely identifies. - Documented, rather than silently left implicit, that resolve_query's integration tests all use a stubbed inference engine — the real decomposition prompt's accuracy is exercised only by the eval harness (scripts/eval/fixtures/agent-matrix.ts scenario 6), not cargo test. Building an in-crate real-model fixture would mean new test infrastructure matching ai_chat_send_to_idle_test.rs's pattern (model download/load, machine-load-sensitive timing) — out of scope for this fix. Addresses non-blocking suggestions from the PR #1825 review. Co-Authored-By: Claude <[email protected]> --------- Co-authored-by: Claude <[email protected]>
Closes #1816