Skip to content

Wake Oh My Pi sessions from the Inbox - #3676

Merged
backnotprop merged 20 commits into
mainfrom
fix/omp-inbox-wake
Nov 28, 2026
Merged

backnotprop merged 20 commits into
mainfrom
fix/omp-inbox-wake

Conversation

@backnotprop

@backnotprop backnotprop commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

A user reported that the Plannotator Inbox does not wake his agent in Oh My Pi (OMP), though he has the plugin installed.

Causes

  1. No Inbox tool and no wake in OMP by default. The Pi extension loads in OMP. But OMP reads Pi's inboxTool.pi switch, and that switch is off by default. Nothing turned it on for OMP: the Inbox's connect step found the extension only in Pi's own ~/.pi/agent/settings.json, and OMP keeps its plugins in ~/.omp/plugins. So an OMP session had no plannotator_inbox tool, and nothing polled for its replies. Every OMP test set inboxTool: { pi: true } by hand, which hid the gap.
  2. Nothing installed the extension in OMP. The installer only printed omp plugin install @plannotator/pi-extension, and the Inbox did not know OMP as an agent.
  3. A thread started over MCP was never woken. OMP starts the MCP servers it finds with no session variable, so plannotator inbox mcp sent each thread as a fresh ses_ id, and the session the extension polls for never owned it.
  4. Already fixed on main, not yet released: after /new, the wake kept polling for the old session (Pi extension: Inbox replies don't reach an Oh My Pi (omp) session started with /new #3564, fixed by Move the Inbox wake when Oh My Pi switches sessions #3644 after v0.29.0).

Changes

No manual step is left for an OMP user.

  • Installers (scripts/install.sh, install.ps1, install.cmd): with omp on PATH, they run omp plugin install @plannotator/pi-extension, or omp plugin upgrade @plannotator/pi-extension when OMP's plugin manifest already lists it. Each run is time-bounded (PLANNOTATOR_OMP_PLUGIN_TIMEOUT, default 180 s; the whole process group is stopped), with stdin closed, from the home folder. It never prompts and never fails the install. On failure it says "could not install" or "could not update" with the matching command. The result is checked against this release, like the Pi step ("still X (this release is Y)" when npm lags). A listed package without a readable version is installed again. A version the person pinned in OMP (an exact version in OMP's manifest) is left as is: "pinned to X in OMP, left as is". A local build is left as is too: "is a local build in OMP (…), left as is". That is a symlink (a junction on Windows) at <plugins>/node_modules/@plannotator/pi-extension, which is all omp plugin link <path> and omp plugin install <path> write besides a lock entry, with the link's target in the line; or a git spec in the manifest. A pinned --version run installs nothing in OMP (OMP would record that exact version as a pin): it prints the command, and leaves an existing install as it is. The way off a pin is the unversioned omp plugin install @plannotator/pi-extension. It is skipped by --minimal, like the Pi step. Updates run the installer, so they upgrade it too.
  • The Inbox knows OMP as its own agent ("Oh My Pi", id oh-my-pi). It is found by omp on PATH or by the extension in OMP's plugin folder. If the extension is missing or unreadable, or lacks the OMP default (the omp-inbox-tool-default feature in the extension's own package.json, so nothing is bumped at release), the connect step runs omp plugin install (or upgrade). At Inbox start this runs in the background, outside the 30 s connect limit, up to 180 s, one at a time; the window then says "Installed Plannotator's extension in Oh My Pi. Type /restart in each open Oh My Pi session to load it." A failure is said once and not retried until Plannotator or the installed extension changes. A version pinned in OMP, and a local build, are left alone; Settings says why ("A local build is installed in Oh My Pi, left as is."). Settings' switch and the first-run screen's one-click Connect do the same. No inboxTool key is written, because that key is Pi's too. Settings → Agents shows OMP's own state, and the Pi and OMP rows say "Oh My Pi and Pi share this switch." Turning OMP off and on again restores what Pi had (a Pi on by name stays on).
  • Kept extensions are not "connected": a start that finds a pinned or local extension without the OMP default says why once instead of "Connected Oh My Pi". One install at a time from a start, Settings or Connect; a run that overlaps an install keeps the install's record and its /restart line. Pi's own switch clears what OMP's off remembered.
  • Uninstall: plannotator uninstall runs omp plugin uninstall @plannotator/pi-extension when OMP's manifest lists it. A failure, or no omp, is a warning with the command, never an uninstall error. A local build is left and named.
  • Tool on by default in OMP: resolvePiInboxTool uses its own constant, INBOX_TOOL_OMP_DEFAULT. The switch is still inboxTool.pi / PLANNOTATOR_INBOX_TOOL. Pi keeps its default (off).
  • MCP identity: the shim sends as the Pi or OMP session that its parent process claims (inbox/pi-sessions/<session>.<pid>.json), read at each call. On Oh My Pi 19.1.0+ this rarely applies: omp now runs stdio MCP servers in its daemon, shared across sessions by default (mcp.shared), so the shim's parent is the daemon, which claims no session, and an MCP send gets a ses_ id that no reply wakes. It applies with mcp.shared: false, on older omp, and on Pi. The extension's own plannotator_inbox tool is the path that wakes an omp session. An identity the MCP client gives itself wins: Claude Code's, Qwen's per call, or T3's. A claim counts only if its file is no older than the parent process's start, so a claim left by a dead process under a reused pid is ignored.
  • Dropped sends: when OMP 18.18.2+ rejects sendUserMessage (PromptDroppedError: it did not admit the message, e.g. an abort or its cost cap; a turn already running queues it as a steer instead), the reply waits for the next idle tick (InboxDeliverLater), up to 3 retries. After that it is reported.
  • plannotator inbox --help and the docs now say the tool is on in Oh My Pi, that /restart loads it, and that OMP reads Pi's key.

Only the Inbox, the CLI shim, uninstall and the installers change. The Inbox is Bun-only, and the Pi server runtime is untouched. Claude Code, OpenCode and Pi's defaults are unchanged.

Brought up to date with main (28 Nov)

Held on 19 Nov until the Inbox turned on only when the person chooses it (#3729). Main is merged in (a0c711095c, main at dc0fbb8d7e); no rebase.

Conflicts, each kept both sides:

  • apps/pi-extension/inbox.ts: the extension registers the Inbox tool only when resolvePiInboxTool allows it (on by default in omp) and main's isInboxTurnedOn(dataDir) says the person turned the Inbox on. Imports and locals are the union (main's PiTerminalPrompts, this PR's laterTries).
  • apps/hook/server/inbox-mcp-shim.ts: imports only (this PR's claim reader, main's INBOX_OFF_LINE and the gate).
  • apps/hook/server/inbox-help.ts: main's new wording for DeepSeek Harness, Cline, Hermes, OpenClaw and T3, plus this PR's Oh My Pi bullet unchanged; main's "Once the person has turned the Inbox on here…" paragraph with this PR's two Oh My Pi clauses put back word for word.
  • apps/marketing/…/environment-variables.md and docs/agent-guides/environment.md: main's rows, with this PR's Oh My Pi additions put back.
  • bun install --frozen-lockfile left bun.lock unchanged; scripts/mobile/check.ts is in step.

The "only when chosen" rule (#3729), checked for every place this PR writes into Oh My Pi:

  • The installers (install.sh, install.ps1, install.cmd) run omp plugin install|upgrade @plannotator/pi-extension when the person runs the installer, as main's installer already runs pi install for Pi. That installs Plannotator's extension. It does not write an inboxTool key, an MCP entry or the Inbox mark, so it does not turn the Inbox on.
  • The Inbox's connect step installs the extension in the background only from connectInboxAgents. That runs only on the person's own non-detached plannotator inbox or --no-open, the first --open, and the control route that plannotator inbox uses while an Inbox is running. It never runs on a detached start, ensureInboxRunning or the shim. It also runs only for an agent with no record yet, so an Oh My Pi the person turned off or removed is never added back.
  • Settings' switch and the first-run Connect: a press in the open window.
  • The extension's tool in Oh My Pi: gated by the mark (above). New test: inbox-omp-tool-default.test.ts, "OMP's default never turns the Inbox on". It fails without the gate.
  • plannotator uninstall: removes the extension; the person runs it.

Also fixed: processStartedAtMs read ps in the inherited time zone but parsed in the runtime's. On macOS, with TZ changed at run time (Bun keeps that out of a child's environment), the start time was off by hours, and the shim test failed locally. CI runs on Linux, which reads /proc. ps now runs in UTC and the time is parsed as UTC.

Independent review fixes (27 Nov, 6b96a47a6e, main merged at c298e42a7d)

  • A linked local build was installed over. omp never puts a local build in its manifest: omp plugin link (and plugin install ./path) writes only the node_modules symlink and a lock entry (oh-my-pi plugins/manager.ts link, directory-link.ts). The old check read only manifest specs, so the installers, plannotator update, auto-update and the first Inbox connect ran omp plugin install over a developer's link. Now all four (install.sh, install.ps1, install.cmd :UpdateOmpExtension, inbox-agents.ts ompExtension) treat that symlink or junction as a local build, with the existing local-build line. The faked link:/file: manifest tests are replaced by omp's real layout (symlink + lock entry, with and without a manifest); uninstall now also leaves and names a linked build.
  • Plugin folder as omp's dirs.ts picks it: $XDG_DATA_HOME/omp/plugins once $XDG_DATA_HOME/omp exists, on Linux and macOS only, else ~/.omp/plugins (no longer both). install.ps1 and install.cmd no longer read XDG_DATA_HOME.
  • Two untrue sentences deleted (nothing written in their place): on omp ≥ 19.1 MCP servers run in the shared daemon by default, so a thread sent over the Inbox's MCP server is not signed as the session and a reply does not wake it. Removed from reference/inbox.md and apps/pi-extension/README.md.
  • xd:// dropped from this PR's environment.md row, the inbox.ts header and the config.ts comment.

Verified / not verified

  • Not run against a real Oh My Pi, then or now. Everything rests on fakes (a fake host for the extension, a fake omp for the installers and the Inbox) and on reading omp's source at 19.2.1.
  • Read in omp's source (19.2.1):
    • omp loads the extension from <plugins>/package.json dependencies;
    • ctx.isIdle(), ctx.hasPendingMessages() and sessionManager.getSessionId() exist;
    • there is no agent_settled event, so the wake waits for idle alone, as on old Pi;
    • an idle sendUserMessage with no deliverAs starts a turn, and its user message emits message_start, which is when the wake counts it as delivered;
    • sendUserMessage returns a promise that rejects with PromptDroppedError (18.18.2+).
  • Changed in omp since this PR was written:
    • 19.1.0 replaced xd:// devices with tool commands. An extension tool is still one line in the system prompt, but its schema comes from <tool> --help. This PR's own xd:// mentions are dropped; main's agent-tool docs (README, installation.md, plan-review.md) still say xd://.
    • 19.1.0 moved MCP servers into the daemon (see MCP identity above).
  • Local test runs (bun 1.3.14):
    • inbox-omp-tool-default 4 pass;
    • inbox-agents-omp 21 pass (after the review fixes);
    • inbox-mcp-shim-pi 10 pass;
    • inbox-omp-dropped-send 2 pass;
    • connectSteps 24 pass;
    • agents 14 pass;
    • agentsSettings 24 pass;
    • connectLine 7 pass;
    • inbox-structure 5 pass;
    • inbox-guidance-parity 22 pass;
    • inbox-help-setup 4 pass;
    • inbox-agent-text-lessons 8 pass;
    • agents-md-size 3 pass;
    • scripts/install.test.ts 345 pass, 114 skipped (no pwsh here; CI runs the Windows installer tests under pwsh);
    • uninstall 127 pass, 1 fail (a Vibe TOML message worded by this Bun's TOML parser, not this PR), with the linked-build case;
    • scripts/install.test.ts -t "OMP|Oh My Pi" 19 pass for install.sh (ps1/cmd need pwsh: CI);
    • inbox-agents 69 pass, 1 fail (a Codex grandchild-daemon case, not Oh My Pi).
  • Typecheck: clean for core, shared, server, pi-extension, the hook server, the hook mod and inbox.
  • Left to CI: apps/pi-extension/inbox.test.ts (it runs a real Pi) and inbox-help.test.ts (it starts an Inbox).

Tests

  • scripts/install.test.ts: a fake omp covers install, upgrade, already current, failure, exit 0 without the manifest entry, a hang stopped at the time limit, a pinned run, a version pinned in OMP, a failed update, npm behind the release, an unreadable package, a hang (its child process is stopped too), --minimal, and no omp on PATH. These run for install.sh, and under PowerShell for install.ps1 and install.cmd (when pwsh exists). It also checks the closing section and that the install.cmd PowerShell has no characters cmd.exe would read.
  • packages/server/inbox-agents-omp.test.ts: the start installs in the background from the home folder and writes no inboxTool key; an install slower than the total limit still finishes; one at a time; a failure is not retried under the same version and is after an update; npm lacking the release is said and not refetched; an unreadable package is reinstalled; a pin is left alone; OMP off and on restores a Pi on by name; the repo's extension carries the feature marker. It upgrades 0.29.0, runs nothing for a current extension, leaves a tool turned off by name alone, reports a failure and retries it, and Settings' switch installs, turns off and back on. Pi is not touched.
  • packages/inbox/connectSteps.test.ts: OMP without the extension is a one-click Connect, its tool-off step has no cost, and a pinned old extension is no step, with why.
  • packages/inbox/agents.test.ts, connectLine.test.tsx: a background install is news in the band, with the /restart line.
  • packages/inbox/agentsSettings.test.tsx: the shared-switch line on both rows, and the pinned reason.
  • packages/server/uninstall.test.ts: omp plugin uninstall runs; its failure and no omp are warnings with the command.
  • apps/hook/server/inbox-mcp-shim-pi.test.ts: the parent's start time is right under a non-UTC TZ; ps is never run without a claim file for the parent; a stale claim is ignored, a Claude Code client keeps its own identity, and the parent claim beats an inherited tag (deliberate).
  • apps/pi-extension/inbox-omp-dropped-send.test.ts: a send OMP drops once is delivered once with no report; one it always drops is reported after 4 sends.
  • apps/pi-extension/inbox-omp-tool-default.test.ts: the tool is on in OMP by default, off on Pi, and off in OMP when config or env says so.

Check it in a real Oh My Pi

These were not run against a real OMP session. To check:

  1. Install OMP, then run the Plannotator installer. It says "Oh My Pi: Plannotator extension installed (…)". omp plugin list shows @plannotator/pi-extension.
  2. Run plannotator inbox once, then start OMP with no inboxTool in ~/.plannotator/config.json. The agent has plannotator_inbox, and Settings → Agents shows Oh My Pi connected.
  3. In OMP's request log, the Inbox tool is one short line, not its full schema (19.1+: a tool command). The Inbox reminder appears once.
  4. Set { "inboxTool": { "pi": false } } and run /restart. The tool is gone and nothing polls.
  5. Add plannotator inbox mcp to OMP's mcp.json and have the agent ask a :::question through it. With omp ≥ 19.1's default (mcp.shared) expect a ses_ id and no wake; with mcp.shared: false the thread's author is "Pi" with the OMP session id, and the reply arrives in OMP as a new turn.
  6. Do the same with the entry as sh -c "plannotator inbox mcp" or through npx. Expect a fallback to a ses_ id (the shim's parent is then the shell, not OMP).
  7. Run /new (and /resume into another session) and send through MCP again. The author follows the new session, and the reply wakes it.
  8. Start a task subagent and, while it runs, send from the main agent through MCP. The author should be the main session. A subagent in the same process can take over the claim for a moment (documented, not fixed).
  9. Answer with Send now while OMP is mid-turn, and again just as a turn starts. The reply arrives once, with no "could not be delivered" toast. Then kill -9 an OMP: its inbox/pi-sessions/<session>.<pid>.json stays, and a new process with that pid does not pick it up.
  10. Run omp plugin install @plannotator/pi-extension </dev/null from ~. Check: no prompt; exit 0; the manifest is ~/.omp/plugins/package.json (with XDG_DATA_HOME set, where?); which spec it writes (^x or exact).
  11. Run omp plugin upgrade @plannotator/pi-extension against an exact pin. Does it override the pin? (The installer and the Inbox leave a pin alone either way.)
  12. Run omp plugin install on a package that is already installed. Does it reinstall or error? This is the Inbox's path when the package can't be read.
  13. SIGKILL the process group of omp plugin install at about 3 s, then at about 10 s. What is left in the plugins folder? Does OMP start? Does a rerun repair it? Does a bun or npm child outlive a TERM to omp?
  14. Time a cold install on a throttled link: it must finish past 30 s while the Inbox is already open, and the window then shows the /restart line.
  15. plannotator uninstall removes it with omp plugin uninstall @plannotator/pi-extension; with omp gone it warns with the command and finishes.
  16. Windows: is omp a .exe or a .cmd? Install from PowerShell 5.1 and from install.cmd; the time-limit kill.
  17. macOS in a UTC+ time zone: processStartedAtMs(pid) against the real start of an OMP. A live claim is accepted right after OMP starts.
  18. A dev extension linked into OMP (omp plugin link ./apps/pi-extension): the installer says "is a local build in OMP (), left as is", the Inbox's Settings says "A local build is installed in Oh My Pi, left as is.", and the link is still a link afterwards.
  19. Which spec omp plugin install @plannotator/pi-extension records (expected ^x), and which …@x.y.z records (expected exact; why a pinned installer run no longer installs one).
  20. omp plugin install over a disabled plugin turns it back on (OMP's docs: a reinstall resets enablement). Only the Inbox's "package can't be read" path and the pin advice do this.
  21. omp plugin uninstall @plannotator/pi-extension exits 0 and removes the manifest entry.
  22. set -m under curl | bash with no tty (CI or Docker) and under macOS /bin/bash 3.2: omp gets its own group, or the kill falls back to the pid.

The Pi extension's Inbox tool, and with it the reply wake, is on by
default in Oh My Pi (resolvePiInboxTool), as its agent tool already is.
OMP shares Pi's inboxTool.pi switch, whose default is off, and nothing
turned it on for OMP: the Inbox's connect step finds the extension only
in Pi's own settings.json. So an OMP session with the extension had no
Inbox tool and nothing polled for its replies.

The stdio MCP shim now sends as the Pi or OMP session its parent process
claims (inbox/pi-sessions, read at each call), so a thread an OMP agent
starts through an Inbox MCP server is that session's and the reply wakes
it through the extension, instead of a ses_ id nothing wakes.

The wake's send also handles OMP's sendUserMessage promise rejecting
when it drops the message, as it does a throw.
- Installers run omp plugin install/upgrade @plannotator/pi-extension when omp is on PATH (time-bounded, never fails the install, pinned runs respected)
- The Inbox knows Oh My Pi as its own agent: connect and Settings install the extension, no inboxTool key written, its own state in Settings
- INBOX_TOOL_OMP_DEFAULT: the Inbox tool's own OMP default
- MCP shim: client-confirmed identities win over the Pi parent claim; a claim older than the parent process is ignored
- A send OMP rejects waits for the next idle tick (InboxDeliverLater), reported after 3 retries
- inbox --help and docs: on in Oh My Pi, /restart, the shared pi key, the subagent caveat
# Conflicts:
#	packages/inbox/components/AgentsSettings.tsx
…n run, one install at a time, keep an overlapping install's record
…alling only when this run started it; the switch writes its own Installed line
# Conflicts:
#	apps/hook/server/inbox-help.ts
#	apps/hook/server/inbox-mcp-shim.ts
#	apps/marketing/src/content/docs/reference/environment-variables.md
#	apps/pi-extension/inbox.ts
#	docs/agent-guides/environment.md
@backnotprop backnotprop added the ci:e2e Run the full browser suite (Inbox window e2e) on this PR label Nov 28, 2026
…nces

`omp plugin link <path>` (and `omp plugin install <path>`) writes only a
symlink (a junction on Windows) at <plugins>/node_modules/@plannotator/
pi-extension and a lock entry, never a manifest entry, so the installers,
`plannotator update`, auto-update and the Inbox's connect step ran
`omp plugin install` over a developer's linked checkout. install.sh,
install.ps1, install.cmd and inbox-agents.ts now read that link as a local
build, with the existing local-build line, and the tests use omp's real
layout instead of `link:`/`file:` manifest specs omp never writes.

The plugin folder now follows omp's dirs.ts: the XDG folder once
$XDG_DATA_HOME/omp exists, on Linux and macOS only; the Windows scripts no
longer read XDG_DATA_HOME.

On omp 19.1 and later MCP servers run in omp's shared daemon by default, so
a thread sent over the Inbox's MCP server is not signed as the session and a
reply does not wake it: the two sentences saying it does are deleted. The
`xd://` mentions this PR added are dropped (omp 19.1 replaced it).
…he subagent MCP sentence

Oh My Pi keeps its plugins in ~/.omp/plugins instead of the XDG folder when another agent dir or a profile is in use, so a pin or a linked build there was missed and omp plugin install ran over it. The check now reads both folders; the install folder is unchanged. The Windows installers already read only ~/.omp/plugins.
…inbox-wake

# Conflicts:
#	apps/hook/server/inbox-help.ts
#	packages/shared/config.ts
@backnotprop
backnotprop merged commit 0ca2643 into main Nov 28, 2026
72 checks passed
DuongCoder04 pushed a commit to DuongCoder04/plannotator that referenced this pull request Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:e2e Run the full browser suite (Inbox window e2e) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant