From a8bc2825761cef46aa7ce67123aaa7f0703bc36f Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Tue, 14 Jul 2026 15:37:00 +0200 Subject: [PATCH] fix(librarian): expose page_id in wiki search results search_wiki printed ordinally numbered results with no page ID while get_wiki_page demands 'the page ID from search results' - the model passed the list position (page 1) and 404'd. Results now carry page_id and drop the ordinals. Co-Authored-By: Claude Fable 5 --- src/agents/librarian/tools.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/agents/librarian/tools.py b/src/agents/librarian/tools.py index 2c2a54f..e6669fe 100644 --- a/src/agents/librarian/tools.py +++ b/src/agents/librarian/tools.py @@ -246,11 +246,14 @@ async def search_wiki( output_parts = [f"## Wiki Search: {query}\n"] - for i, page in enumerate(results, 1): - output_parts.append(f"{i}. **{page.title}**") - output_parts.append(f" Path: {page.path}") + # No ordinal numbering: small models pass the list position to + # get_wiki_page instead of the page ID unless the ID is the only + # number in sight. + for page in results: + output_parts.append(f"- **{page.title}** (page_id: {page.id})") + output_parts.append(f" Path: {page.path}") if page.description: - output_parts.append(f" {page.description}") + output_parts.append(f" {page.description}") output_parts.append("") return "\n".join(output_parts)