Skip to content

fix(outlook): bound message pagination and payloads - #467

Open
zhouzhuozhzh-maker wants to merge 1 commit into
andrewyng:mainfrom
zhouzhuozhzh-maker:codex/fix-465-outlook-pagination
Open

fix(outlook): bound message pagination and payloads#467
zhouzhuozhzh-maker wants to merge 1 commit into
andrewyng:mainfrom
zhouzhuozhzh-maker:codex/fix-465-outlook-pagination

Conversation

@zhouzhuozhzh-maker

@zhouzhuozhzh-maker zhouzhuozhzh-maker commented Aug 7, 2026

Copy link
Copy Markdown

Problem

Outlook message search silently capped requests at 20 items, exposed an opaque Microsoft Graph next link that the agent could not consume, and returned full message payloads. Larger inbox queries could therefore trigger repeated overlapping searches and exhaust the model context window.

Solution

  • follow Microsoft Graph pagination inside one connector call, with a hard cap of 100 messages and 100 pages
  • deduplicate messages and reject pagination URLs outside the trusted Graph origin
  • return compact message summaries with explicit returned_count, has_more, and query_complete metadata
  • add outlook_get_message so the agent can fetch one selected message body without loading every body
  • instruct the agent to narrow an incomplete query instead of repeating or broadening it

Why this approach

Pagination belongs to the connector because Graph next links are opaque implementation details and may carry credentials through request headers. Keeping them away from the model prevents unsupported pagination loops. Splitting list and detail payloads also bounds context usage while preserving access to complete message content.

Verification

  • .venv/bin/pytest tests/test_connectors.py -k outlook -q — 7 passed
  • .venv/bin/pytest -q — 1176 passed, 1 skipped
  • git diff --check origin/main...HEAD — clean

Risk and compatibility

The existing account, ok, data, and data.value response structure remains available. Search results now contain summaries rather than bodies; callers can retrieve a full message through the new read-only tool. Pagination and returned data are bounded, and credentials are never forwarded to a non-Graph origin.

Fixes #465

lwxyfer added a commit to lwxyfer/openworker that referenced this pull request Aug 9, 2026
lwxyfer added a commit to lwxyfer/openworker that referenced this pull request Aug 10, 2026
@zhouzhuozhzh-maker
zhouzhuozhzh-maker force-pushed the codex/fix-465-outlook-pagination branch from a891a91 to f209513 Compare August 12, 2026 08:04
@zhouzhuozhzh-maker zhouzhuozhzh-maker changed the title Fix Outlook search pagination and bound message payloads fix(outlook): bound message pagination and payloads Aug 12, 2026
@zhouzhuozhzh-maker

Copy link
Copy Markdown
Author

Hi @rohitprasad15 — this is ready for review and is the only open PR currently linked to #465.

I rebased it onto the latest main and re-ran the validation:

  • Outlook regression tests: 7 passed
  • full Python suite: 1176 passed, 1 skipped
  • clean diff check

The new GitHub Actions run is marked action_required, so it needs maintainer approval before CI can start: https://github.com/andrewyng/openworker/actions/runs/31576734070

The implementation keeps Graph pagination inside the connector, bounds results, rejects off-origin next links, and separates message summaries from full-body retrieval. Happy to address any review feedback.

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.

Outlook connector loops on pagination, blows past token limit on single day inbox listing

1 participant