Skip to content

fix(office): improve tool contracts and multilingual document output - #3766

Merged
bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:bob/office-tool-reliability
Nov 6, 2026
Merged

bobleer merged 1 commit into
openBitFun:mainfrom
bobleer:bob/office-tool-reliability

Conversation

@bobleer

@bobleer bobleer commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

GenOfficeFile now gives agents explicit operation fields and actionable validation errors before workspace IO, so malformed replacements and stale indexes can be corrected without changing the file. PPTX output selects text language from content or an explicit override instead of marking every run as English, and incremental edits preserve both updated text and layout findings.

Type and Areas

Type: Bug fix, tool contract/guidance improvement, regression tests.

Areas: Rust Core GenOfficeFile tool; portable Office document engine and its DOCX/XLSX/PPTX guides.

Motivation / Impact

  • Expand the compact operation schema with supported names, common fields and nested element-patch selectors. Share required-field preflight between the tool and engine; preserve existing aliases and optional null values. Keep a flat schema compatible with provider adapters that flatten unions.
  • Prefer in-place edits and explain batch ordering, current indexes, atomic failure and corrective retries. For example, deleting a preceding slide shifts the source index of a later move. Error guidance describes these general semantics rather than a particular user's document.
  • Fix update_elements silently retaining old canonical paragraphs when a patch supplies new text. Remap touched slide indexes after move_slides so layout warnings still describe the edited slides.
  • Add optional BCP 47 language overrides at theme, text/shape, paragraph and run scopes. Infer PPTX defaults from text scripts, including notes and paragraph endings, while retaining existing font inheritance. DOCX runs also honor explicit language. New fields default cleanly for legacy files.
  • State that successful generation and geometry checks do not constitute visual rendering. Add visual_rendered: false to write results. Font and preview guidance remains environment-neutral; there are no machine-specific font rules, font blacklists or new Office/renderer dependencies.

Verification

  • pnpm run fmt:rs — passed.
  • cargo test --locked -p openbitfun-office-documents — 28 unit tests and 13 integration tests passed.
  • 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 — 5 tests passed.
  • git diff --check and staged diff check — passed.
  • Regression coverage includes malformed calls before workspace access, failed-batch byte preservation, both reported stale-index operation sequences, successful in-place recovery, text updates, layout findings after moves, Unicode XML for all three formats, language precedence, legacy version-1 deserialization and an old-payload round trip.
  • Newly generated multilingual output was opened in PowerPoint on macOS: Simplified/Traditional Chinese, Japanese, Korean, English, emoji and notes displayed correctly. This is evidence for that tested environment, not a claim about every viewer or font configuration.

Reviewer Notes

  • Refreshed upstream main and inspected related code/history and open PRs, including drafts. At submission, the branch is based on current upstream main (c2ae5b88d); no open PR covers these changes.
  • The engine remains platform-independent and IO-free. The tool continues to use the session workspace filesystem; no host commands, dependencies, wire protocols or permission flows changed.
  • Local and simulated SSH workspace tool flows were exercised. No live SSH, remote-control, Peer Device Mode or Detached Dispatch validation was performed. No live provider/model evaluation was performed.
  • Existing document envelope versions and field meanings are retained. Fonts are not embedded. Language inference cannot distinguish every language from script alone; explicit lang remains available for ambiguous content.
  • Existing CI owns broad platform builds; local verification used only the owning engine and focused Core tool tests.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

@bobleer
bobleer merged commit bf0379d into openBitFun:main Nov 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant