Skip to content

fix(notion-web): accept OpenAI content-parts arrays in transcript - #7896

Merged
diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
artickc:fix/notion-web-content-parts
Jul 20, 2026
Merged

diegosouzapw merged 1 commit into
cheaper-inference:release/v3.8.49from
artickc:fix/notion-web-content-parts

Conversation

@artickc

@artickc artickc commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Notion AI Web previously required message.content to be a plain string. Agent clients (Skills Manager, OpenCode-style tool runners, multimodal clients) often send OpenAI content-parts arrays ([{ type: \"text\", text: \"...\" }]).
  • Those messages were silently dropped in buildNotionMessageStep, so system injects (jailbreak / agentic conversion / client tool catalogs) and array-shaped user turns never reached Notion's runInferenceTranscript payload.
  • Add extractNotionMessageText() to normalize string | content-parts | bare string parts, and use it for system / user / assistant roles.

Test plan

  • node --import tsx --test tests/unit/executor-notion-web.test.ts — 30/30 pass
  • New regression: system + user with content-parts arrays fold into context.instructions and a user step
  • New regression: bare string parts inside content arrays join with newlines
  • Existing string-content transcript tests still green
  • Manual: agent client → notion-web/fable-5 with system inject markers present in backend call log / transcript

Notes

Agent clients often send message.content as [{type:\"text\",text:\"...\"}]
instead of a plain string. buildNotionMessageStep previously required a
string and silently dropped those turns, so system injects (jailbreak /
agentic conversion) and multimodal user messages never reached Notion.

Normalize string | content-parts | bare string parts via
extractNotionMessageText, and add regression coverage in the transcript
unit suite.
@artickc
artickc requested a review from diegosouzapw as a code owner July 20, 2026 17:53

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Notion executor to correctly handle OpenAI-style message content that uses arrays of parts, rather than just plain strings. A new utility function, extractNotionMessageText, was introduced to normalize these content structures, ensuring that system and user messages are correctly processed and included in the Notion transcript. Corresponding unit tests were added to verify this behavior and ensure regression coverage. There are no review comments to address for this pull request.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@artickc

artickc commented Jul 20, 2026

Copy link
Copy Markdown
Contributor Author

This is necessary to transform a web provider into an agentic provider by utilizing prompts for the exchange of tool and skill instructions.

@diegosouzapw
diegosouzapw merged commit 99135d7 into cheaper-inference:release/v3.8.49 Jul 20, 2026
5 checks passed
@diegosouzapw

Copy link
Copy Markdown
Collaborator

Merged — thanks @artickc! extractNotionMessageText() cleanly handles the OpenAI content-parts array shape that OpenCode/Cline send. Validated in the local merge-train (combined tree, full unit suite + vitest green) on tomni-proxmox-113 @ 998752fbca then squash-merged.

diegosouzapw added a commit to artickc/OmniRoute that referenced this pull request Jul 21, 2026
Merge release/v3.8.49 into fix/notion-web-thread-continuity: the sticky
thread-session cache (root binding, disk persistence, client pin via
notion_thread_id/thread_id/X-Notion-Thread-Id) collided with cheaper-inference#7896's
identical extractNotionMessageText/buildNotionMessageStep dedupe already
landed on release — kept the PR's exported extractNotionMessageText plus
release's content-parts docstring, and release's buildNotionMessageStep
comment. Removed the dead @deprecated buildNotionCreateThreadRequestBody
alias (zero call sites, confirmed by grep) flagged in review.

Co-authored-by: Diego Rodrigues de Sa e Souza <diegosouzapw@users.noreply.github.com>
@diegosouzapw diegosouzapw mentioned this pull request Jul 23, 2026
HouMinXi pushed a commit to HouMinXi/OmniRoute that referenced this pull request Aug 2, 2026
…eaper-inference#7896)

Agent clients often send message.content as [{type:\"text\",text:\"...\"}]
instead of a plain string. buildNotionMessageStep previously required a
string and silently dropped those turns, so system injects (jailbreak /
agentic conversion) and multimodal user messages never reached Notion.

Normalize string | content-parts | bare string parts via
extractNotionMessageText, and add regression coverage in the transcript
unit suite.
muhamadgalihsaputra pushed a commit to niyatna/NiyatnaRoute that referenced this pull request Sep 27, 2026
…eaper-inference#7896)

Agent clients often send message.content as [{type:\"text\",text:\"...\"}]
instead of a plain string. buildNotionMessageStep previously required a
string and silently dropped those turns, so system injects (jailbreak /
agentic conversion) and multimodal user messages never reached Notion.

Normalize string | content-parts | bare string parts via
extractNotionMessageText, and add regression coverage in the transcript
unit suite.
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.

2 participants