Skip to content

feat(gateway): admit sessions_send wake starts - #194376

Open
cubefarm-forge wants to merge 1074 commits into
openclaw:mainfrom
cubefarm-forge:forge/sessions-send-wake-admission-1548
Open

cubefarm-forge wants to merge 1074 commits into
openclaw:mainfrom
cubefarm-forge:forge/sessions-send-wake-admission-1548

Conversation

@cubefarm-forge

@cubefarm-forge cubefarm-forge commented Nov 7, 2026 •

Copy link
Copy Markdown

What Problem This Solves

sessions_send can fan out wake-starting work through the gateway agent RPC. Before this change, concurrent senders could bypass sender-local batching and rate limits. This adds an optional gateway-owned admission boundary for typed sessions_send wake traffic. It intentionally does not affect mode:notify, which does not create recipient work.

Summary

  • add a disabled-by-default gateway.sessionsSendWakeAdmission policy (six starts per 15 minutes by default)
  • enforce it at the common gateway agent admission boundary only for typed inputProvenance.kind=inter_session / sourceTool=sessions_send
  • persist one idempotent per-recipient decision in a separate SQLite database, atomically, and fail closed if state is unavailable

Evidence

  • node scripts/run-vitest.mjs run --config test/vitest/vitest.gateway.config.ts src/gateway/sessions-send-wake-admission.test.ts: 4/4 passed (default-disabled, seven-recipient load, restart/idempotency, fail-closed state error)
  • pnpm tsgo:core, pnpm format:check, and git diff --check passed locally
  • implementation is based on released OpenClaw v2026.10.9 / 8b18b557, matching the runtime that exposed the issue

Rollout

Feature remains off by default. This PR contains no config enablement, runtime rollout, or gateway restart. Rollback is retaining the disabled flag or reverting this commit; the receipt database remains as audit evidence.

Tracking: cbire880/the-roost#2473, OP#1548

roboclaw-bot and others added 30 commits October 23, 2026 19:50
Backport openclaw#181801 and the deterministic fixes exposed by the first 2026.10.7 Full Release Validation run.

Co-authored-by: Peter Steinberger <[email protected]>

Co-authored-by: RomneyDa <[email protected]>
Include backport openclaw#181801 in the audited stable contribution record and bind the ledger to the exact repaired product cut.

Co-authored-by: RomneyDa <[email protected]>
Remove internal maintainer handles from Thanks credits so the stable candidate passes the frozen release attribution gate.

Co-authored-by: RomneyDa <[email protected]>
…w#170122)

Empty session-deletion plans were sent through transcript archive materialization even when their captured snapshot contained no transcript rows. A repair with many empty sessions therefore reopened and admitted the database once per plan without producing an archive. The Doctor scale fixture timed out after entering this stage.

Skip archive-worker materialization when `snapshot.lastSeq` is null, while preserving the complete deletion plan. The deletion owner still compares the current snapshot inside its transaction before removing any rows. An append after empty-snapshot planning now fails at that final guard; its rows remain intact. Nonempty archives, history eviction, retention policy, schema, and update behavior are unchanged.

Local validation: `pnpm test src/config/sessions/session-accessor.sqlite-archive.worker.test.ts --maxWorkers=1` passed all 19 tests, including empty lifecycle deletion and preservation of later appends after both empty and nonempty snapshots. Vitest reported 489.63 seconds; the full wrapper took 540.73 seconds. The tested product and test files exactly match this patch. One scoped Codex review found no actionable findings.

The exact Doctor scale file, `pnpm test src/commands/doctor-session-canonical-keys.scale.test.ts --maxWorkers=1`, also passed (1/1), preserving the 200,000-event healthy transcript while repairing 12,000 aliases. The case took 66.30 seconds; Vitest reported 126.26 seconds and the wrapper 172.89 seconds. Both local runs completed cleanup with no surviving owned processes. They ran on the composed repair candidate, so this is behavior proof, not an isolated performance comparison. The observed timeout stage is established, but a recent culprit commit or deadlock has not been isolated. This change is two files, +34/-6.

Static validation reused the identical changed source from the composed candidate: [build-artifacts](https://github.com/openclaw/openclaw/actions/runs/38291089523/job/114951416399), [production types](https://github.com/openclaw/openclaw/actions/runs/38291089523/job/114951418205), [archive worker test types](https://github.com/openclaw/openclaw/actions/runs/38291089523/job/114951417771), and [lint for both changed files](https://github.com/openclaw/openclaw/actions/runs/38291089523/job/114951417815) completed successfully. Unrelated failed static stripes are not counted as passes. No update cell is required because this patch changes no update, Doctor, migration/schema, plugin loading, or service lifecycle implementation.

V16 also passed source contracts, Knip, topology/Madge, and database baseline ratchets. This red-main correctness repair makes no measured warmed-turn or T1 reduction claim. The accepted edge case is that a transcript appended after an empty snapshot is rejected at the final deletion guard rather than during archive preparation; the new regression verifies that its data survives. Direct-main pushes were refused by the repository ruleset, so this repair uses the authorized head-pinned PR squash fallback.

(cherry picked from commit 6f41da7)
Co-authored-by: RomneyDa <[email protected]>
screen, show_widget, suggest_task and dismiss_task follow the turn’s client (Control UI capabilities, gateway task delivery), so subagent-completion and channel turns drop them. Since the tool-name hash joined session reuse, every such flip discarded the Claude session and reseeded it from saved history.

Leave these four out of the session hash. The system prompt still lists them, so a warm process restarts with the current MCP catalog on a flip while the native session and its context carry over.

(cherry picked from commit 6cb5f16)

Co-authored-by: RomneyDa <[email protected]>
Keep origin/main as the authoritative refreshed audit bound while running changed-file gates from the audited merge base. This prevents main-only refactors from appearing as release-branch regressions.

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit a570580)
…79951)

Use the refreshed canonical release head as the changed-gate baseline when it is an ancestor of the candidate, while retaining current main as the authoritative audit bound.

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 70a1e9a)
Adapt openclaw#178955 without growing the over-cap preparation module.

Co-authored-by: RomneyDa <[email protected]>
Resolve the workspace helper from source so release prepush changed tests do not depend on an undeclared root workspace link.

Co-authored-by: roboclaw-bot <[email protected]>
Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 677dc28)
Drop the duplicate wrapper component introduced while resolving openclaw#181487, and
align the restart-recovery harness with the adapted openclaw#176682 contract: sender
loss without remaining custody retires the input as interrupted instead of
tombstoning it.
Exclude provider compaction checkpoints from generic empty-length recovery. Keep the existing compacted-transcript continuation and avoid emitting an incorrect truncated-tool notice. Regression introduced by 95af1b8; the unchanged gateway compaction replay fails before this guard and passes afterward. Focused recovery and terminal tests pass. Broader completion and widget replay failures remain outside this repair scope.

(cherry picked from commit 591aa77)
Backport the transcripts slice of openclaw#175309 (b326dc0). The stable branch
carries openclaw#176577, which invalidates CLI sessions on tool-name hash changes, but
not openclaw#175309, so completion turns dropped the caller-dependent transcripts tool,
reset the Claude CLI session, and failed the live CLI backend announce proof.
Registration now depends only on config; caller-less turns refuse at execute.

(adapted from commit b326dc0)
The adapted harness-recovery backport (a16ff7f) reworded the restart
recovery note, but the mock provider still matched only the previous wording,
so gateway-restart-inflight-run never reached its second checkpoint.
…claw#167459

The backport of openclaw#167459 in openclaw#181465 took the source change without main's test rewrite. Foreign bundled-runtime targets are now left intact without blocking setup, so the foreign scenarios expect no throw and byte-preserved targets. Test-only; shipped bytes, tag, and npm are unchanged.
(cherry picked from commit e111107)

Release adaptation: the stable test file keeps per-case Windows shell tests,
so the two new resolver cases are ported into that describe block.
…inventory

Ported from the 2026.10.7 main closeout (openclaw#182546, 556bb84) so the
2026.10.8 candidate qualifies upgrades from the shipped 2026.10.7 package.
…8480)

Share the Twitch messaging-target parser across routing, outbound target resolution, allowlist matching, and sending so internal channel prefixes do not reach Twurple. Reject unsupported DM/user addresses before fallback while preserving the configured-channel fallback for empty and hash-only channel targets.

Related openclaw#166672. This fixes target normalization; the separate runtime-handoff report remains out of scope.

Co-authored-by: Tak Hoffman <[email protected]>
Co-authored-by: Takhoffman <[email protected]>
(cherry picked from commit 51a117f)
…179506)

fix(matrix): stop tagging ordinary Matrix messages as text commands

Ordinary messages from authorized Matrix users were tagged as text commands, which bypassed normal reply visibility and intentional silence, so replies meant to stay private were posted to the room. Only real commands are tagged as commands now.

Evidence: built Gateway against a self-hosted Synapse homeserver. On main an ordinary message leaked a private final reply into the room (twice); with this change it stays private (twice). /status still works as a command, and NO_REPLY stays silent on both. A live gpt-5.4-mini turn passes.

Thanks @xiaopan-xydt.

Co-authored-by: Ayaan Zaidi <[email protected]>
(cherry picked from commit 5ee1182)

Release adaptation: handler.room-policy.test.ts does not exist on the stable
line; the two cases are ported into a new sibling handler.command-source.test.ts.
Replace references to retired fixture helpers with assertions against the real outbound adapter. Retains all nine target-normalization cases. Baseline: 9 failing and 24 passing; repair: 33 passing.

(cherry picked from commit 271329f)

Release adaptation: the stable outbound test file has no shared send mock or
sendParams fixture; import the mocked sender and define the fixture locally.
…rectory (openclaw#180174)

Fixes openclaw#179769. Doctor's state-integrity check treated a missing legacy OAuth directory as fatal even though credentials are SQLite-backed, so updates failed at git-runtime-backup-retention. The finding is now advisory; repair prompts and real data-integrity checks are unchanged.

(cherry picked from commit c3f0c51)
…ssion (openclaw#179949)

* fix(plugins): tolerate ctime-only stat drift in native companion admission

Native plugin admission re-checks a dev:ino:mode:size:mtimeNs:ctimeNs identity
after reading each companion to digest it. On Windows Endpoint DLP (and Code
Integrity) the first read stamps an extended attribute that advances only ctime,
so the strict !== in finishPluginNativeNamespace and the re-capture digest made
admission invalidate itself and native plugins could never load.

Use the module's existing pluginSourceIdentityChangedOnlyByCtime helper at all
three cited comparisons (and drop the managed||previous gate on the copy pass) so
metadata-only stamps are tolerated while a real size/mtime/inode/content change
is still rejected. Same principle as merged openclaw#164823 and openclaw#165982.

Adds plugin-native-namespace.test.ts covering ctime-only tolerance and
real-change rejection.

* fix(plugins): verify native companion bytes across metadata stamps

Reconcile first-read ctime drift without retaining stale mutable-source copies, and record verified identities for warm reuse. Cover all three admission phases and timestamp-preserving edits.

Co-authored-by: paulcam206 <[email protected]>

---------

Co-authored-by: paulcam206 <[email protected]>
(cherry picked from commit d5b96ae)
…penclaw#180880)

* fix(exec): require approval for test/[ -v operands in allowlist mode

Bash >= 4.2 evaluates the array subscript of a `test -v` operand even
inside single quotes, and that evaluation runs command substitution, so
`test -v 'a[$(cmd)]'` executed cmd without an allowlist match or an
on-miss approval prompt. The safe-builtins classifier trusted test/[
argument-blind, so the segment was satisfied as safeBuiltins, never
prompted, and rendered unchanged in enforced mode.

Stop classifying test/[ segments as safe builtins when any argv token is
-v, mirroring the existing guard in system-run-mutable-file-operand.ts.
Only the builtin stays untrusted: the approval flow re-renders the
segment through the external test binary, which treats the operand as a
literal. Plain predicates keep their existing auto-approval.

Also classify builtin heads case-sensitively: builtin lookup in
bash/zsh/dash is case-sensitive, so TEST/CD previously classified as
builtins while shells resolved external binaries on case-insensitive
filesystems.

Proof: pnpm test src/infra/exec-safe-builtins.test.ts src/infra/exec-approvals.test.ts src/infra/exec-approvals-allow-always.test.ts src/infra/exec-authorization-render.test.ts src/infra/exec-approvals-analysis.test.ts src/infra/exec-approvals-authorization.worker.test.ts src/agents/bash-tools.exec-host-gateway.test.ts src/agents/bash-tools.exec.security-floor.test.ts src/node-host/invoke-system-run-plan.shell-literals.test.ts src/node-host/invoke-system-run-allowlist.test.ts (139 tests pass); production-chain probe with bash 5.2.21 shows test/[ -v 'a[$(…)]' now prompts and executes nothing.

* test(exec): drop redundant ordinary-predicate helper assertions

Retained allowlist integration tests already cover ordinary test/[ predicates.

(cherry picked from commit 69cd9c5)
…w#181456)

pnpm-mode updates failed at pnpm-staging-preflight with 'The configured global bin directory ... is not in PATH' because the updater assumed pnpm lived under PNPM_HOME/bin and missed pnpm 10's home-level shim, so it ran a different pnpm with a PATH lacking the global bin dir. The package owner now selects the installation-local pnpm executable (home-level shim or bin/) and the staging child PATH includes both locations within the derived pnpm home; npm and bun selection are unchanged. Fixes openclaw#180688, reported by @rayluo88.

(cherry picked from commit 6508946)
…e channel (openclaw#181056)

* fix(slack): retry isolated invalid_auth before disabling a socket-mode channel

One invalid_auth from Slack — which can arrive while the configured
credentials still pass auth.test — was classified like a revoked token: the
channel turned terminal and every restart owner skipped it until the process
restarted. Isolated invalid_auth now counts toward a consecutive-failure
limit (3) with the normal reconnect backoff between attempts, and a
successful reconnect clears the count. Definitive credential and account
errors (token_revoked, account_inactive, ...) still block immediately.

* fix(slack): accept the optional status publisher in auth failure tracking

* fix(slack): end isolated invalid_auth retries at the declared limit

Compare the incremented consecutive-failure count against the terminal
limit so the channel turns terminal at the 3rd consecutive invalid_auth
instead of the 4th, and pin the exact cutoff plus the post-reconnect
counter reset in the reconnect-loop regressions.

(cherry picked from commit 9714331)

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

agents Agent runtime and tooling app: android App: android app: ios App: ios app: linux app: macos App: macos app: web-ui App: web-ui channel: a2a channel: buzz channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: googlechat Channel integration: googlechat channel: imessage Channel integration: imessage channel: irc channel: line Channel integration: line channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: qa-channel Channel integration: qa-channel channel: raft Channel integration: Raft channel: reef Channel integration: reef channel: signal Channel integration: signal channel: slack Channel integration: slack channel: sms Channel integration: sms channel: synology-chat channel: telegram Channel integration: telegram channel: tlon Channel integration: tlon channel: twitch Channel integration: twitch channel: voice-call Channel integration: voice-call channel: whatsapp-web Channel integration: whatsapp-web channel: x channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser cli CLI command changes commands Command implementations deploy: cloudflare Cloudflare deployment template and docs docker Docker and sandbox tooling docs Improvements or additions to documentation extensions: acpx extensions: admin-http-rpc extensions: arcee extensions: baseten Extension: baseten extensions: byteplus extensions: cerebras extensions: clawrouter Extension: clawrouter extensions: clickclack extensions: copilot-proxy Extension: copilot-proxy extensions: crabbox extensions: deepgram extensions: deepinfra extensions: deepseek extensions: diagnostics-otel Extension: diagnostics-otel extensions: diagnostics-prometheus extensions: document-extract extensions: duckduckgo extensions: featherless extensions: gmi extensions: llama-cpp extensions: llm-task Extension: llm-task extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: memory-wiki extensions: oc-path extensions: onepassword 1Password plugin extensions: policy extensions: qa-lab extensions: tencent extensions: tokenjuice Changes to the bundled tokenjuice extension extensions: vault Extension: vault extensions: web-readability gateway Gateway runtime plugin: azure-speech Azure Speech plugin plugin: beam Beam session sharing plugin plugin: bonjour Plugin integration: bonjour plugin: code-mode-quickjs plugin: cua-computer plugin: facetime FaceTime plugin plugin: file-transfer plugin: geolocation Geolocation plugin (IP to coarse city) plugin: google-meet plugin: imap plugin: linux-node plugin: logbook Logbook automatic work journal plugin plugin: migrate-claude plugin: migrate-hermes plugin: mxc plugin: onnx plugin: pixverse plugin: session-share plugin: slack-huddles plugin: team-reports plugin: teams-meetings Teams Meetings plugin plugin: typesafe plugin: visitor-access plugin: workboard plugin: zoom Zoom plugin scripts Repository scripts security Security documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.