Repository navigation
fix: keep two Search entities written alike apart - #84
Merged
Merged
Conversation
data-mcp's SearchEntity takes an optional name or dcid, never both, and sends them, so an agent can post "Congo" twice and settle an entity_ambiguous refusal by resending the row with the candidate's dcid. The digest lists each ambiguous entity group by its entity_choice index, with its words, role and candidate dcids. The harness keeps Search's entity_refs per restatement row: BoundEntity carries the row's identity (dcid, else name, else text), text, role and refs, and SelectedSource.bound_refs is a tuple of them. Evidence resolution matches each requirement entity to its own row, by identity then text, fitting the role first, so two Congos in one role column or in two both resolve. A saved plan with the old dict form fails validation and is planned again. The search capability's input hash is re-pinned for the new fields. Co-authored-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Search answers "aid from Congo to Congo" with two entity rows written alike, told apart by
nameordcid, onePart.entity_refsentry per row, and options carryingentity_choice(DevelopmentFinanceObservatory/apis#119). dfo-ai could not send either field and keyed bound refs by text, so both Congos merged into one key and the evidence check lost one.SearchEntityinservices/data-mcp/src/data_mcp/search_tool.pytakes an optionalnameordcid, refusing both, and_wire_entitysends them. The tool description and README say how to post a text twice and how to settleentity_ambiguous: resend that row with the chosen candidate'sdcid, keeping itstextandrole.digest.pylists each ambiguous entity group by itsentity_choiceindex, with its words, role and candidate dcids, falling back to mention text for an option without the field.In the harness,
BoundEntityinplanner/workflow.pyholds a row's identity (dcid, else name, else text), text, role and refs, andSelectedSource.bound_refsis a tuple of them.compiler/sources.pybound_refs()pairs eachentity_refsentry with its restatement row by position and binds nothing when the counts differ.compiler/evidence.pybound_refs_ofmatches a requirement entity to its row by identity, then text, preferring rows that fit its role, andresolve_name,resolve_groupand_named_entity_issuesread the bound row first, so a donor "Congo" no longer label-matches the recipient's node.capabilities.pyre-pins the search input hash for the two new fields.bound_refsis a hashed field, so a source carrying bound refs gets a new identity. Plans are stored as JSON in ADK's conversation store, and the repo replans a stored plan its model rejects (planner.plan.stored_plan), so a saved plan in the old shape is planned again once, and an old stored search block refuses as unusable. Harness discovery's_search_partstill sends nonameordcid.docs/upstream-asks.mdsection 10 lists the current no_data fields and narrows the ask.Testing: the data-mcp suite passed (1,629 passed, 20 skipped) and the harness suite passed (7,173 passed). The new tests fail on dev: SearchEntity with name and with dcid and the both-set refusal, the digest of the recorded dev response to "aid from Congo to Congo", and bound refs and evidence for two Congos pinned, named and named beside unnamed, in one role column and in two. ruff and
ty checkare clean.Co-authored-by: Claude noreply@anthropic.com