Skip to content

openclaw: 1.0 phase 1 — host 2026.11.1, async sdk apis, shared connection - #157

Open
morajabi wants to merge 23 commits into
mainfrom
claude/openclaw-1.0
Open

morajabi wants to merge 23 commits into
mainfrom
claude/openclaw-1.0

Conversation

@morajabi

@morajabi morajabi commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

Phase 1 of the OpenClaw plugin 1.0 work: move onto the host APIs that survive OpenClaw's January 2027 removals, plus reliability groundwork for the 1.0 experience work (phase 2).

What changes

  • Host floor is now OpenClaw >=2026.11.1. Manifest, CI matrix (2026.11.1 + npm latest), README, setup doc and plugin AGENTS.md. 0.0.72 stays the line for 2026.8.2–2026.10.x.
  • Every SDK call with a 2026-12-31 removal date moved to its async replacement: approvals (capability, lazy runtime, origin/DM resolvers, exec profile, account matching), command authorization, arg menus, stored model override, session reads, session patch (applySessionEntryPatch), skill command listing, and fetchRemoteMedia → readRemoteMediaBuffer. A TypeScript language-service scan finds none left.
  • Buttons render from MessagePresentation instead of the removal-pending InteractiveReply bridge, as a plain mapping. Untyped legacy interactive input is still read because 2026.11.1 still emits it for approval and command replies. Presentation-only host replies now get native buttons in the monitor path; before, they arrived as text.
  • Service notices never wake the agent, new or edited, matching Hermes and the bridge.
  • One realtime connection per account. Tools, outbound sends, commands and pairing notices borrow the running monitor's client instead of opening one per call (12 call sites). The registry sits on a process-wide key because each plugin entry is bundled separately.
  • Realtime SDK 0.0.19 → 0.0.21: named WORKING and started_at are now available.
  • monitor.ts 8,150 → 5,766 lines: the top-level helpers moved verbatim into eight modules. The monitorInlineProvider closure is byte-identical; phase 2 rewrites it.
  • Zod 4 deprecations cleaned up.
  • Review fixes (from draft openclaw: harden 1.0 presentation and monitor delivery #158): typed command buttons run as native commands instead of agent turns, disabled buttons stay inert, presentation fallback text survives authored text, cancelled callers can't borrow the shared client, and the monitor's 15 direct sends share one sender that waits an explicit server flood hint (up to 60 s, twice) with a stable randomId, never retrying uncertain sends.

Breaking

  • Requires OpenClaw 2026.11.1 or newer. Users on older hosts stay on 0.0.72.

Protocol, database, schema

  • No protocol, wire format, database or plugin config schema changes.

Deferred on purpose (phase 2)

  • finalizeInboundContext / recordInboundSession → buildChannelInboundEventContext and the host's turn helpers. These are deprecated with no removal date, and adopting them is a structured rewrite of the dispatch path that phase 2 rewrites anyway.
  • Inbound acceptance (pre-existing): the SDK receipt completes when a message is scheduled in memory, before OpenClaw accepts the turn, so a crash in that window loses it. Fixing it means holding the receipt until host acceptance without hurting Stop/steer; this is first in phase 2.
  • The per-bot output mode (GET_AGENT_SETTINGS) needs the next protocol and SDK publish.

Testing

  • bun run typecheck, bun run lint, vitest (48 files, 777 tests) and bun run build pass locally.
  • New tests: client registry and cancellation, flood-wait sender, command/disabled/presentation-only buttons, service notices (the test fails if either guard is removed), async approval account matching, and approval card routing.
  • Not yet run on a real OpenClaw gateway with live bots.

🤖 Generated with Claude Code

Approvals, command auth, arg menus, session reads and patches, skill
command listing and remote media now use the async replacements that
2026.11.1 ships, ahead of the January 2027 removal. Buttons render from
MessagePresentation instead of the InteractiveReply bridge, including
presentation-only host replies. Zod 4 deprecations cleaned up.
Tools, outbound sends, commands and pairing notices reused nothing and
opened a connection per call. They now borrow the running monitor's
client for the same account, token and server, and fall back to a
short-lived client otherwise. The registry lives on a process-wide key
because each plugin entry is bundled separately.
Presence, reasoning, addressing, model menus, reply actions, history and
inbound media now live in their own files. Code moved verbatim; the
monitorInlineProvider closure is untouched and phase 2 rewrites it.
…itor sends

From the 1.0 review (draft #158): typed command actions keep their kind
and run as system commands instead of agent turns, disabled buttons stay
inert, presentation fallback text survives authored text, cancelled
callers can't borrow the shared client, and the monitor's 15 direct
sends share one sender that waits an explicit server flood hint (up to
60s, twice) with a stable randomId and never retries uncertain sends.
Covers prefixed and numeric thread targets, DM origins without threads,
non-numeric and foreign-channel turns, session-key fallback, and the
/approve reply when Inline exec approvals are off.
16e8562 added CreateSubthreadInput.reserved_chat_id to proto/core.proto
without regenerating crates/protocol/proto/core.proto, so the workflow
contract check fails on main and every PR. Output of proto:sync-rust.
@morajabi
morajabi force-pushed the claude/openclaw-1.0 branch from 620ca31 to 9cde5a6 Compare November 8, 2026 12:46
morajabi and others added 14 commits November 8, 2026 16:24
The synced Rust schema adds CreateSubthreadInput.reserved_chat_id; the
three struct literals that build it now pass None, keeping today's
behavior.
…st gate

Installed plugins get the host's exact-current read gate. An untyped
current id only matched user:/dm: in DMs, so chat:<id> reads and chatId
searches were rejected. Also tell agents read needs target and search
needs chatId, since targetless reads are denied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Apply chat setting changes (/threads, inline_reply_threads, the settings
  sheet) without a restart. With afterWrite none, 2026.11 keeps its old
  runtime snapshot, so the plugin keeps the committed config until the host
  snapshot changes.
- Don't post an error reply to another bot's hand-back.
- Mark parent history lines the bot already answered in a reply thread, so
  switching back to Auto doesn't answer them again.
- Handle /approve and /stop (typed, or as approval button data) outside the
  per-chat queue. Queued behind the run, an approval waited for the very run
  it was meant to unblock until it expired.
- Send an approval asked in the approver's own DM to that DM chat, so the host
  doesn't also post "I sent the approval request to Inline DMs, not this chat".
- With buttons, the approval card shows only what is being approved (the
  command in a code block), like Hermes, instead of OpenClaw's text-only
  fallback that lists every /approve command, host, cwd and id.
- A decided or expired card now says so ("Allowed once", "Denied",
  "Approval expired") instead of keeping the pending text with no buttons.
- Progress says "Running `cmd`" and "Ran `cmd`" instead of "Mcp Openclaw
  Exec" (Claude Code's MCP tool names) or "Exec: done".
Without streaming config, turns show the Working status and then the answer,
like Hermes in Inline, instead of posting a progress card every turn.
streaming.mode "progress" keeps the card (D2).
- Command progress shows the command only when the host's commandText allows
  it ("status", the default on every channel, hides it): "Running a command".
- Answered approval cards name who answered ("Denied by Mo"), as Slack,
  Discord and Telegram do. Bare ids are left out.

This branch has not been deployed

No deployments
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