Repository navigation
fix(office): route existing Office files to Read instead of GenOfficeFile - #3836
Merged
bobleer merged 1 commit intoNov 9, 2026
Merged
Conversation
…File Agents asked to analyze an attached .xlsx called GenOfficeFile twice before falling back to Read. The tool contract listed `read` as a peer action with sheet/range support and only said that foreign files are not "editable", so the model treated it as an Office reader. Its not_generated failure then appended "Use action=guide", inviting a retry inside the same tool. - State the scope up front: GenOfficeFile produces Office files; read and edit open only files it generated, and every other Office file (attachments, uploads, files saved by other programs) goes to Read. - Mark `read` as verification-only in the description, the action schema, and the short description. - Give not_generated its own recovery text (do not retry, use Read) and drop the guide hint from externally_modified; other errors keep it. The engine's not_generated message no longer suggests creating a new file. - Add a regression test pinning the routing contract and messages.
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.
Summary
Make the
GenOfficeFilecontract say clearly that it only produces Office files, and send agents that need to read or analyze an existing.docx/.xlsx/.pptxto theReadtool.Type and Areas
Type: bug fix (agent tool contract)
Areas: Rust core (
GenOfficeFiletool), office-documents engineMotivation / Impact
When a user attached an
.xlsxand asked for insights, the agent calledGenOfficeFiletwice (both failed) before falling back toRead.readas a peer action with sheet/range support. The only restriction it gave was "Only files created by this tool are editable", so the model treated the tool as an Office reader. In factreadopens only files this tool generated, because they carry its embedded source model.not_generatedfailure ended with "Use action=guide for the format's contract.", and the engine message said "create a new file instead". Both pushed the model to keep trying inside the same tool.Changes:
Read, and the agent should not probe it withGenOfficeFilefirst.readas verification-only in the description, theactionschema, and the short description.not_generatedits own recovery text: do not retry (discard_external_changesdoes not apply), useRead. Drop the guide hint fromexternally_modified, whose message already explains what to do. Other errors keep the guide hint.not_generatedmessage so it no longer suggests creating a new file.User impact: fewer failed tool calls and less wasted context when users ask for analysis of attached Office files. Generation and edit behavior are unchanged.
Verification
cargo test --locked -p openbitfun-core --no-default-features --features agent-runtime,git,tools-office-documents --lib agentic::tools::implementations::gen_office_file_tool::tests: 7 passed, including the newcontract_routes_reading_existing_office_files_to_read_tool.cargo test --locked -p openbitfun-office-documents: all passed.pnpm run fmt:rs,git diff --check: clean.Not verified: I have not re-run the original attachment scenario against a live model, so the effect on tool choice comes from the reasoning above and has not been measured. Remote scenarios are unaffected: only prompt and error text changed, and no file IO paths changed.
Reviewer Notes
The text the model sees changed in three places: the tool description, the
actionschema description, andshort_description. No i18n catalogs or generated capability files reference the changed strings.Checklist