Skip to content

[Bug]: Pi bots lose Notion MCP tools (0 tools registered) after upgrading to Orca 1.4.280 (Codex/Antigravity unaffected) #51748

Done

Description

@ayisuplus

Summary

After Orca desktop on Windows auto-updated and restarted from 1.4.277 (daemon protocol v62) to 1.4.280 (daemon protocol v63), Pi (@earendil-works/pi-coding-agent 1.6.0) bot sessions with Orca-managed Notion MCP (https://mcp.notion.com/mcp) consistently end up with 0 Notion tools registered (searchTools("notion") returns []), even though:

  • orca bot tools --json reports notion as signed-in with problems: {},
  • Orca injects - mcp__notion (codemode) into Pi's <mcp_servers> system prompt section via orca-bot-tools.ts, and
  • Pi reaches the local bot-tool-relay at startup and triggers an OAuth credential refresh on disk (~3 seconds after session start).

On the exact same machine and Orca 1.4.280 instance, Codex and Antigravity bot sessions using the exact same Notion MCP setup continue to work normally.

Reproduction Timeline (Windows, Orca 1.4.277 → 1.4.280)

Time (CST / UTC+8) Bot & Agent Orca Version Outcome
2026-11-27 10:30 bot-36 (Pi 1.6.0) 1.4.277 (v62) Connected; created Notion DB and wrote 8 pages
2026-11-28 07:00 bot-35 (Pi 1.6.0) 1.4.277 (v62) Connected; queried and updated Notion DB + uploaded images
2026-11-28 09:56 Orca daemon restart 1.4.280 (v63) daemon.log: protocolVersion 62 → 63
2026-11-28 10:30 bot-36 (Pi 1.6.0) 1.4.280 (v63) 0 Notion tools (searchTools("notion") === [])
2026-11-28 10:51 bot-21 (Codex) 1.4.280 (v63) Connected & working normally
2026-11-28 11:00 notion (Pi 1.6.0) 1.4.280 (v63) 0 Notion tools (searchTools("notion") === []), also reproduced in a fresh Pi worker
2026-11-28 11:19 bot-2 (Antigravity) 1.4.280 (v63) Connected & working (notion-get-self succeeded)

Technical Observations

  1. Injection succeeds: In both failed Pi sessions (bot-36 at 02:30:58Z and notion at 03:00:58Z), Pi's session .jsonl records <mcp_servers>... - mcp__notion (codemode)</mcp_servers>, confirming orca-bot-tools.ts and ORCA_PI_BOT_TOOLS executed.
  2. Relay is reached and OAuth refreshes: Both bots' sealed credential files under ~/.orca/bot-tool-credentials/ updated their mtimes at +3s (02:31:01Z and 03:01:01Z), confirming Pi's @earendil-works/pi-mcp client contacted Orca's local bot-tool-relay and passed relay auth.
  3. Zero tools registered & silent failure in chat: Calling searchTools("notion") in Pi's codemode returns [] in 0.1s (ALL_TOOLS contains only built-in/extension tools, zero mcp__notion__* entries). Meanwhile orca bot tools --json shows signIn.state: "signed-in" and problems: {}, and Pi's startup ctx.ui.notify warning is not surfaced in Orca chat (related to feat(pi): draw extension notify, setStatus and setWidget in the chat #45081), so the bot cannot see the underlying transport error.
  4. Possible regression area: Between 1.4.277 and 1.4.280, bot-tool-relay changed request/response header forwarding (fix(tools): agent tool relay forwards every header except hop-by-hop and its own credentials #49535, forwarding Node undici headers such as user-agent: node, sec-fetch-mode: cors, accept-language: * that Pi sends via fetch(), unlike non-undici clients).

Environment

  • OS: Windows (Orca desktop 1.4.280)
  • Pi: @earendil-works/pi-coding-agent 1.6.0 (unchanged since 2026-11-20; ~/.pi/agent/mcp.json empty)
  • MCP server: Notion official remote MCP (https://mcp.notion.com/mcp) via Orca Bot Tools OAuth
  • Workaround: Switching affected bot automations from pi to codex restores Notion MCP immediately.

Activity

  1. nwparker commented on Nov 28, 2026

    @nwparker
    Contributor

    Thanks for the report. One change between 1.4.279 and 1.4.280 touched how Orca's bot tool relay forwards HTTP headers to MCP servers, which is our main suspect, but we can't yet see which header trips Notion for Pi. Could you share:

    1. Whether Codex or Claude bots on the same machine still see the Notion tools (you mentioned Codex works; please confirm it's the same Notion connector).
    2. Any lines mentioning relay, mcp or notion from the Pi bot's terminal or the Orca dev tools console (Ctrl/Cmd+Shift+I → Console) when the bot starts. Please redact any tokens.
    3. Your Pi version (pi --version).
  2. ayisuplus commented on Nov 28, 2026

    @ayisuplus
    Author

    Thanks for the quick look! Here are the details for all three items:

    1. Codex / Claude on the same machine & same Notion connector

    • Yes — confirmed with the exact same Bot-level Notion connector (https://mcp.notion.com/mcp, own bot tool, signIn: { state: "signed-in", limited: false }, unchanged):
      • Same bots, switching only the run agent from Pi → Codex: On Orca 1.4.280, we ran one-shot Codex (gpt-6.2-sol) backfill runs inside the exact same two affected bots (冲浪-商机Notion and 冲浪-开源notion). Both connected to Notion MCP on the first try using that exact connector, created a database / wrote 5 + 8 pages, and read them back cleanly.
      • Other bots on the same machine: Another Codex bot and an Antigravity bot using the same https://mcp.notion.com/mcp connector both still see all Notion tools on 1.4.280.
      • (No Claude bots are configured on this machine, so Claude is untested.)

    2. Logs (relay / mcp / notion) when the Pi bot starts

    We re-triggered a fresh Pi bot run on 1.4.280 right after an Orca restart (2026-11-28T13:03:45Z):

    • Pi's system prompt included - mcp__notion (codemode) (confirming orca-bot-tools.ts registered the server), yet searchTools('notion') returned [] (0 Notion tools out of 17 total tools).
    • Immediately afterward, orca bot tools --bot <name> --json still reported:
      {
        "agent": "pi",
        "own": [{ "name": "notion", "detail": "https://mcp.notion.com/mcp", "remote": false, "signIn": { "state": "signed-in", "limited": false } }],
        "inherited": [],
        "problems": {}
      }
      Notice "problems": {} — so bot-tool-relay did not hit the 401/403 branch that populates this.problems (pointing to a non-401/403 status or an error before relayResponse).
    • No lines mentioning relay, mcp, or notion appear in %APPDATA%\orca\logs\daemon.log, %APPDATA%\orca\logs\main.trace.ndjson, or ~/.pi/acp.log. (Also, Orca's Pi RPC bridge appears to ignore extension_ui_request notify events, so Pi's MCP servers need attention: ... startup failure message is not persisted in the chat/session journal.)
    • For reference, here are the exact request headers Pi 1.6.0 (@earendil-works/pi-mcp 1.6.0 on Node v24.22.3 undici globalThis.fetch) sends to a local loopback http://127.0.0.1:<port>/bot-tools/.../mcp endpoint:
      {
        "host": "127.0.0.1:<port>",
        "connection": "keep-alive",
        "authorization": "Bearer [REDACTED]",
        "accept": "application/json, text/event-stream",
        "content-type": "application/json",
        "accept-language": "*",
        "sec-fetch-mode": "cors",
        "user-agent": "node",
        "accept-encoding": "gzip, deflate",
        "content-length": "151"
      }
      After bot-tool-relay's denylist (host, connection, content-length, expect, accept-encoding, authorization, cookie), the three headers forwarded for Pi that Codex doesn't send are sec-fetch-mode: cors, accept-language: *, and user-agent: node.
    • (I haven't captured the live Electron DevTools Console (Ctrl+Shift+I) yet — if you still need the live [bot-tool-relay] console output when the Pi bot starts, let me know and I'll grab and paste it redacted.)

    3. Pi version

    • pi --version: 1.6.0 (@earendil-works/pi-coding-agent 1.6.0, @earendil-works/pi-mcp 1.6.0)
    • Node: v24.22.3 · OS: Windows · Orca: 1.4.280
  3. nwparker commented on Nov 28, 2026

    @nwparker
    Contributor

    Thank you, the header comparison is extremely useful. The three Pi-only headers (sec-fetch-mode: cors, accept-language: *, user-agent: node) are our lead: sec-fetch-* is browser fetch metadata, which a server-side relay shouldn't forward, and a server may treat it as a cross-origin browser request. Unauthenticated probes can't distinguish them (Notion returns 401 either way), so yes, please grab the live [bot-tool-relay] lines from the DevTools Console (Ctrl+Shift+I → Console, filter bot-tool-relay) while the Pi bot starts. The upstream status code or error there would confirm it. Redact any tokens.

  4. ayisuplus commented on Nov 28, 2026

    @ayisuplus
    Author

    We opened DevTools (Ctrl+Shift+I → Console, filtered bot-tool-relay) on packaged Windows Orca 1.4.280 and started a fresh chat on the affected Pi bot — nothing appeared in the renderer Console.

    Checking why it came up empty, there look to be two visibility gaps on packaged Windows builds:

    1. console.warn("[bot-tool-relay] ...") runs in the main / orcad process (bot-tool-relay.ts), so the renderer DevTools Console doesn't receive those lines; and bot-tool-relay.ts only logs on 401/403/>=500 anyway, so any other 4xx (e.g., 400/406/415) passes through unlogged.
    2. On the Pi side, Pi's built-in MCP extension reports the exact McpHttpError status and body via ctx.ui.notify("MCP servers need attention: ..."), which Orca's Pi RPC bridge drops (notify is ignored alongside setStatus/setWidget/etc.), so it never reaches the chat UI or session log.
      (Side note: withRelayProblems in bot-launch-tools.ts only attaches botToolRelay.lastProblem(...) when out[server.name] is already present, which may also explain why orca bot tools --json stayed "problems": {}.)

    If there's a flag or env var to dump main-process orcad / bot-tool-relay logs to a file on packaged Windows, let us know and we're happy to run a quick capture. Otherwise, stripping sec-fetch-* from the relay's forwarded headers sounds like the right fix regardless — happy to verify on Windows as soon as a build with that change ships!

  5. nwparker commented on Nov 28, 2026

    @nwparker
    Contributor

    Thanks to your header comparison we found it: Pi's Node fetch sends sec-fetch-mode: cors, Orca's tool relay forwarded it since 1.4.280, and Electron's fetch rejects a CORS-mode request with no origin. The relay then answered 502, so Pi registered 0 tools. #51894 strips those browser-only headers before forwarding. Once it ships, could you confirm your Pi bots see the Notion tools again?

  6. nwparker commented on Dec 1, 2026

    @nwparker
    Contributor

    Closing as completed — verified on origin/main. PR #51894 (b3b282a) updates sendUpstream in src/main/bots/tool-relay/bot-tool-relay-upstream.ts to strip sec-fetch-* headers (!name.startsWith('sec-fetch-')) on origin/main, preventing Electron's net fetch from rejecting Node/undici Sec-Fetch-Mode: cors MCP requests without an Origin header from Pi bots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions