Skip to content

fix(openclaw): widen to unscoped recall when peer_role=sender has no sender - #5347

Merged
t0saki merged 2 commits into
mainfrom
fix/openclaw-sender-missing-recall
Sep 24, 2026
Merged

t0saki merged 2 commits into
mainfrom
fix/openclaw-sender-missing-recall

Conversation

@ZaynJarvis

@ZaynJarvis ZaynJarvis commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Description

With peer_role=sender, resolveOpenVikingActorPeerId threw openviking: peer_role=sender requires a sender identity whenever no sender was available. OpenClaw 2026.9.5 never passes runtimeContext to contextEngine.assemble(): neither the pre-turn call (assembleHarnessContextEngine) nor the tool-loop call does. attempt.senderId only reaches afterTurn, before_agent_run hooks and tools. So on every turn:

  • main assemble: recallForAssemble threw and was caught. OV session context was still assembled, but the long-term memory block was dropped and only an auto-recall failed warn was logged.
  • tool-loop assemble: passthrough, no recall.
  • tools and recall-trace routes without a sender (cron, heartbeat, webchat) errored.

Peer scoping is soft isolation, and a missing sender should not switch OpenViking off. The resolver now logs a warning and continues as an unscoped request (no X-OpenViking-Actor-Peer). This is the same posture as the MCP proxy's "a missing actor peer warns and widens" (#5132).

What "unscoped" reaches (server side)

  • Auto-recall (/search/search, peer_scope=actor): memories from user/memories only. The user/peers sweep runs only for peer_scope=all (gather.py:360). Resources include the user root.
  • Tool find with no target: the default target is the user root, which includes every peer's memories (retrieval_targets.py:62-67).

Writes and deletes

  • Capture (afterTurn and memory_store) already writes with no peer_id when the sender is missing (shared user scope), so it never attributes to a wrong peer. Unchanged.
  • memory_forget follows the same unscoped fallback as find: soft isolation, so a sender-less turn (cron, heartbeat, webchat) can forget what it can find. In channel turns, tools still receive requesterSenderId from OpenClaw and stay sender-scoped.

The root fix belongs in OpenClaw: pass runtimeContext (with senderId) to assemble().

Human Involvement

  • A human participated in the implementation or review loop
  • This PR was generated entirely by AI agents without human participation in the loop

Related Issue

Follows up the host gap noted while closing #5009. Upstream: openclaw/openclaw#148033 (fix PR openclaw/openclaw#148139).

Type of Change

  • Bug fix (non-breaking change that fixes an issue)

Changes Made

  • routing/identity-routing.ts: the throw becomes an optional warn callback. The resolver still returns undefined.
  • services/context-lifecycle-service.ts, plugin/openviking-session-routing-runtime.ts: pass the logger's warn.
  • Tests: resolver, assemble recall, tool routing, afterTurn no-peer capture. The resolver, assemble and routing tests fail on main (old throw).

Testing

  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have tested this on the following platforms:
    • macOS

tsc --noEmit clean. vitest run: 43 files, 795 passed. Unit tests only. The test files import plugin modules with fakes and never boot OpenClaw. I did not run OpenClaw itself.

Notes for review

  • The warning fires per resolution (each turn, each tool call). There is no rate-limit pattern in this plugin yet.
  • No version bump: openclaw-plugin is outside check-plugin-version-bumps.sh, and most recent openclaw-plugin PRs did not bump either.

…sender

OpenClaw does not pass runtimeContext to context-engine assemble(), and cron,
heartbeat and webchat turns carry no sender. With peer_role=sender the plugin
threw "requires a sender identity" there, so auto-recall failed every turn and
tools without a sender errored.

Peer scoping is soft isolation: a missing sender now warns and continues as an
unscoped request (no X-OpenViking-Actor-Peer), like the MCP proxy (#5132).
memory_forget refuses in that state, since an unscoped search could pick and
delete another sender's memory. Capture already stored no peer_id when the
sender is missing and is unchanged.
@ZaynJarvis ZaynJarvis added the agent-plugins Agent harness and plugin integrations label Sep 23, 2026
…issing

Peer scoping is soft isolation; forget follows the same unscoped fallback
as recall and find instead of refusing.
@t0saki
t0saki merged commit 8a0d362 into main Sep 24, 2026
9 checks passed
@t0saki
t0saki deleted the fix/openclaw-sender-missing-recall branch September 24, 2026 03:43
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Sep 24, 2026
frankyang2008-eng added a commit to frankyang2008-eng/OpenViking that referenced this pull request Oct 9, 2026
…I plugin, account-scoped embedding/VLM providers, resource permission management, ls/tree pagination)

Upstream: 7b07c4a -> 3949b51 (57 commits, 518 files, +29307/-7524), post-v0.4.21.

Themes
- plugins: Kimi Code CLI memory plugin (volcengine#4787) with manifest alignment (volcengine#5376);
  shared capture filtering across adapters (volcengine#5359, volcengine#5375); find the installer
  runtime in the fetched checkout (volcengine#5280); dsh bundle/plugin card (volcengine#5390, volcengine#5362),
  producer-owned source kind (volcengine#5318), broad MCP recall scope (volcengine#5346), per-session
  workspace peer settings (volcengine#5380); OpenCode v2 support (volcengine#5341), parallel
  session-inject and recall (volcengine#5149)
- config: isolate account runtime resources (volcengine#5323) - RuntimeConfigManager plus
  account-scoped embedding/VLM providers, which is what the embedding_provider /
  vlm_resolver plumbing in this merge serves
- acl: inherit full-management permissions by default with create-time
  authorization (volcengine#5266); web-studio resource permission management (volcengine#5329)
- fs: pagination state for ls and tree (volcengine#5330), unified URI normalization with
  Chinese path support (volcengine#5328), serialize mkdir abstract creation (volcengine#5183)
- grep: propagate later-page ACL denials (volcengine#5289); drop the ripgrep invoke
  (volcengine#5369)
- queue: requeue on semantic directory lock conflicts (volcengine#5340), fix the missing
  downstream index task on write-wait (volcengine#5357)
- metrics: queue processing latency (volcengine#5365), persisted HTTP retrieval result
  counts (volcengine#5294); observer JSON status format (volcengine#5316)
- openclaw: stop offering the legacy person peer role at install time (volcengine#5355),
  widen to unscoped recall when peer_role=sender has no sender (volcengine#5347)
- session: split session.py into sub-modules (volcengine#5363)
- hermes: gateway memory presets and sender attribution (volcengine#5293), rotate
  read-only session state (volcengine#5372), mirror native memory replacements/removals
  (volcengine#5281), bind settings to the initialized profile (volcengine#5374), skip writes for
  non-primary agent contexts (volcengine#5353)
- docs: enterprise deployment guides (volcengine#5361, volcengine#5388), browser-language docs
  preferences (volcengine#5351); feishu project auth refresh (volcengine#5350)

Conflicts (15) and resolutions - full analysis in
plans/upstream-sync-14-conflict-analysis.md

- openviking/models/vlm/token_usage.py - took upstream. The fork made
  TokenUsageTracker thread-safe with an RLock and hand-written locks; upstream
  shipped the same intent more completely (a @_locked decorator, _add_usage()
  that also merges last_updated, and a merge() that iterates a to_dict()
  snapshot instead of a live model map). Upstream is a superset, so the fork's
  version carries no information the merge would lose.
- examples/agent-hook-plugin/hosts/zcode-capture.mjs,
  examples/dsh-memory-plugin/index.mjs,
  examples/openclaw-plugin/tests/ut/identity-routing.test.ts,
  docs/en/agent-integrations/17-dsh.md,
  docs/zh/agent-integrations/17-dsh.md, docs/en/api/03-filesystem.md - took
  upstream. Every fork change on these files is Prettier/markdown noise
  (re-wrapping, table pipes, arrow parens); verified by comparing base to the
  fork tip with whitespace, commas and semicolons stripped. The repository has
  no prettier/markdownlint/yamllint config and CI does not run them, so keeping
  the formatting only re-conflicts on every sync. identity-routing.test.ts also
  had to take upstream on semantics: the fork still asserted a throw for a
  sender-scoped call without a sender, which upstream replaced with a warning
  plus unscoped fallback.
- openviking/service/core.py - union of three hunks. Kept the fork's
  _init_shared_rerank_runtime() call and the shared rerank client/executor, and
  took upstream's _init_runtime_config_manager() plus the VLM resolver check.
  Upstream's removal of the process-level embedder check is taken as-is: the
  attribute is no longer assigned anywhere upstream, so keeping the check would
  raise on every boot. The rerank runtime is initialized after the config
  manager, matching upstream's use of the same config reference for
  init_viking_fs(rerank_config=...).
- openviking/service/debug_service.py - the constructor and set_dependencies now
  accept rerank_client together with upstream's embedding_provider and
  vlm_resolver, in that positional order. The models-status path reuses the
  service-shared rerank client and only falls back to building one. The fork's
  "if self._config.embedding: embedding_instance = get_embedder()" block is
  dropped: upstream replaced the process-level embedder with the token-tracker
  namespace, so keeping it would resurrect the deleted embedder.
- openviking/storage/queuefs/queue_manager.py - union. The fork's shared
  "qfs-agfs" ThreadPoolExecutor and _agfs_call_timeout survive next to
  upstream's optional VLMResolver plus the TYPE_CHECKING import.
- openviking/session/memory/patch_merge_context_provider.py - union of imports;
  the fork's consumer="patch_merge" attribution survives.
- examples/pi-coding-agent-extension/index.ts - took upstream on both hunks
  (comment plus Prettier wrapping). The fork's omp getBranch() fallback and the
  WeakMap identity map live in non-conflicting regions and are preserved.
- examples/openclaw-plugin/commands/setup.ts, setup-helper/install.js - took
  upstream's peer-role semantics. Upstream added normalizePeerRoleInput(), which
  rejects "person" for setup input while still reading it from existing configs;
  the fork side of the setup.ts hunk lacks that definition while other code
  calls it, so taking the fork would break at runtime. All five install.js
  conflicts are the same change plus Prettier wrapping.
- examples/memory-plugin-shared/install.sh (20 hunks) - union. Upstream adds the
  kimicode harness, the fork adds qoder, codebuddy, omp and agy; both extend the
  same lists, so every hunk keeps both, in the order zcode, kimicode, qoder,
  codebuddy, omp, agy. copy_agent_integration() keeps upstream's explicit
  destination argument and the fork's host-specific source lookup side by side.
  This also fixes a fork bug found while resolving tui_item_at(): the missing
  i=$((i + 1)) between zcode and qoder left qoder without an index of its own
  (the row was unreachable and "add" was rendered twice), and
  tui_selectable_count() now says 12.
- docs/maintenance: plans/upstream-sync-14-conflict-analysis.md records the
  per-file evidence, the TUI index/count self-check, and the report-only
  convention for upstream-owned lint/type debt.

Not touched
- No file that is byte-identical to upstream/main was modified; upstream-owned
  lint/type debt stays report-only per the convention established in the 12th
  and 13th syncs (plans/upstream-type-debt-20260917.md).

Verified
- git grep for conflict markers: clean
- bash -n install.sh, node --check on every merged .js/.mjs, ast.parse on every
  merged .py: pass
- local work still present on top of main: core.py +49, debug_service.py 14,
  queue_manager.py 125, install.sh +682, install.js 1588, setup.ts 530,
  pi-coding-agent-extension 95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-plugins Agent harness and plugin integrations

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants