Repository navigation
feat(vika): treat peers as counterparts and give each instance its own OV user - #7092
Merged
Merged
Conversation
…n OV user OpenViking defines a peer as someone the user deals with. Vika used the instance id as actor_peer_id (the legacy agent_id meaning), so every sender's words were filed under one peer named after the bot, and the daemon's own session sync filed them under the owner. - Instances launched by Vika: the runtime plugins write nothing on their own and do not recall; their state lives under <dataDir>/openviking/. Only process env changes, so the owner's own Codex, Claude Code and Pi are unaffected. - Setup makes each instance an OV user of its own: dev/Trusted derive <connection user>.<instance id>; under an API key a key another instance or the OV CLI uses is shared only when the owner says so, and an administrator key can create the instance's user (reused within a run per account, and deleted again, waiting for OV's background deletion, when unused). - Session sync attributes each line: the owner as the user, others as a message-level peer_id named after their channel identity, the agent and daemon as assistant. Sync rows are bound to the authenticated namespace. - After /new, retired epochs are committed in full in a queue of their own, so short conversations reach memory extraction without delaying the next session's history. - The daemon recalls per line where the agent is likely to answer, with the sender as actor peer and who= on every memory. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
krsish
force-pushed
the
feat/vika-ov-peer-identity
branch
from
November 6, 2026 06:02
4ebae4a to
4cdb61e
Compare
This was referenced Nov 6, 2026
nexw
added a commit
to nexw/OpenViking
that referenced
this pull request
Nov 9, 2026
The branch had drifted 25 commits behind volcengine/openviking's feat/vika since volcengine#7012: the OpenViking tool surface work (volcengine#7079), per-instance OV users and peers (volcengine#7092), timers in OV (volcengine#7016), explicitSilence defaults (volcengine#7110), image-heavy turns (volcengine#7113), stale implicit turns (volcengine#7021), the email connector (volcengine#7144/volcengine#7145/volcengine#7148), Feishu chat scoping (volcengine#7149) and the Windows preview chain (volcengine#7218-volcengine#7245). Conflicts were all in files the superseded local commit a709961 touched; resolution takes the upstream side, because volcengine#7079 replaced that design: OpenViking tools now reach every runtime through the Core ActionService (ov-tools.mjs), so the durable host keeps registering durableCodingTools() and no longer wires its own MCP catalogue. The local-only durable-ov-tools.mjs, its test, the @earendil-works/pi-mcp dependency and DURABLE_OV are dropped with it; README.md, install.md and docs/pi-durable-runtime.md take the upstream (English) rewrites. vika/ is now byte-identical to origin-https/feat/vika; the merge keeps origin/main already merged in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
OpenViking defines a peer as someone the user deals with: a person or another agent. Its docs separate the message-level
peer_id(who said it) fromactor_peer_id(which peer a request may see). Vika setactor_peer_idto the instance id. That is the legacyagent_idmeaning of an agent's own identity, and it caused three problems:peer_id = <instance id>. Whatever anyone in a chat said was filed as memory about a peer named after the bot. On a local instance,peers/asd/memories/preferences/held the owner's own preferences, twice, under two spellings of the owner's name.usermessage without a peer, so extraction filed what other people said as the owner's own memory. It also sent control lines that way.This PR makes a peer mean the counterpart and makes each instance a user of its own. Decisions made with the requester:
peer_scope=allwith the sender as actor peer. Instances facing outsiders can useactor.What changes
Instances launched by Vika (
deployment-config.cjs)The runtime plugins no longer auto-capture, commit on compact, take over Pi compaction, derive a workspace peer or auto-recall. Pi's takeover is listed on its own because it syncs and commits the whole branch even with capture off.
Plugin session state, pending writes and the recall ledger move to
<dataDir>/openviking/. These directories were shared through the home directory, so a Vika-launched Codex's session-start sweep committed and replayed the owner's own sessions through the instance's identity.All of this is process environment, which the plugins rank above their config files, so the owner's own Codex, Claude Code and Pi keep their settings. Session-start injection and the plugins' MCP tools stay.
Setup: one OV user per instance (
ov.mjs,ov-setup.mjs,setup.mjs)actor_peer_id,peer_idoragent_id.<connection user>.<instance id>, for exampleweihan.liu.asd. The menu shows this with<instance name>until a new instance is named.register_user, including when editing the instance's current connection. Setup writes a new private config with the user's key; the existing config stays intact until the manifest is saved./healthto offer registration.Session sync attributes each line (
ov-peer.mjs,harness.mjs,store.mjs,ov-session-context.mjs)usermessage with no peer.usermessage with a message-levelpeer_idnamed after their channel identity:lark-<open_id>,slack-<team>-<user>,email-<address>or<source>-<id>. Names OV would reject are cleaned and get a digest.assistantmessages.ovSessionFor(epoch), which exposes only a session verified for the current namespace./new, the idle checkpoint syncs and fully commits retired epochs, including short conversations below the normal token threshold. Finalization retries survive restart and uncertain commit responses, and failures are logged with their cause.ov_epochs_left_behind) and excluded from subsequent finalization;session()only handles the current namespace.Recall by the daemon (
ov-recall.mjs,agents[].ovRecallScope)With
ovAutoRecall, every runtime gets the same recall./api/v1/search/search, modecontext) per direct message, mention of the agent, document comment or non-chat event such as mail. Bots and card clicks get none.all.ovRecallScope: "actor"keeps other people's memories out.who=(owner, sender, or another person's name or id).core.mdexplains the block and adds one boundary rule: memory that is not the current person's own came from other conversations and is not passed on.Human Involvement
A maintainer pointed out that the peer usage was wrong. The requester made the design decisions listed above: peer as counterpart, user per instance, daemon as only writer, scope
all, the naming rule, unverified mail senders and no migration. They also deployed the branch locally and reviewed the setup menu, which led to the instance-name placeholder. Implementation and tests are AI-assisted.Related Issue
No linked issue. Based on
feat/vikaatcfcc7b3b6, with the PR changes squashed into one commit. Conflict resolution preserves the upstreamexplicitSilencedefault and addsovRecallScope. Related: #6917 (MCPrememberignores the actor peer) and #7079 (Core OpenViking tools).Type of Change
Changes Made
deployment-config.cjs:openVikingAgentEnv: plugin writes and auto-recall off, per-instance plugin state.agents[].ovRecallScope.VIKA_OV_AUTO_RECALLandVIKA_OV_RECALL_SCOPE.packages/cli/src/ov.mjs:detectOpenVikingreportsroleandaccount.instanceOvConfigderives or creates the instance identity.writeInstanceOvConfigonly writes.OVRegistrationsreuses registrations per account, keeps the saved user by key, and polls deletion tasks for unused users.PEER_FIELDSdefinition is shared with setup.packages/cli/src/ov-setup.mjs:takenIdentities, the identity choice and the menu hint use a shared holder lookup.saveOVConnectionkeeps no peer and no administrator key.prepareInstanceOpenVikingno longer carries the old actor over and honors registration even on the current config path.packages/cli/src/setup.mjs: passes who else holds an identity; the success line names the instance's user.packages/daemon/src/ov-peer.mjs(new): the peer id for a sender.packages/daemon/src/harness.mjs: the peer at ingest, and recall on the ingress path.packages/daemon/src/store.mjs:ingest(..., { peer })stores the peer with the journal row.packages/daemon/src/ov-session-context.mjs:ovAttributionsets each line’s role andpeer_id; authenticated namespace binding protects sync cursors; retired epochs have durable finalization watermarks and a separate queue. Recall and archive reads shareovSessionFor, replacing separate link caches and raw-query fallbacks.packages/daemon/src/ov-recall.mjs(new): the context search, sender profile and rendering.packages/daemon/src/config.mjs,daemon.mjs: the recall switch and scope; the harness gets anOVRecall.packages/daemon/agent/core.md: the recall block and the boundary rule.README.md,install.md,docs/ov-session-context.md,config.example.json.peer_idreaching OV.Testing
npm run checkandgit diff --checkpass on the squashed commit4cdb61e3e. With dependencies installed from the branch’s lockfile,npm test: 1150 tests, 1149 pass, 0 failures and 1 skipped. The complete suite was rerun after the rebase and review.Against a local OpenViking 0.4.21 (Trusted, no key):
OPENVIKING_WORKSPACE_PEER=0, droppingactor_peer_idwould have made the peergithub.1485827954.workers.dev-volcengine-openviking.peer_idis stored. The session was deleted afterwards, and nothing was committed.origin, which maps towho=, in 0.4–0.9 s.weihan.liu.manboand mirrors intoviking://user/weihan.liu.manbo/sessions/…./newgives exactly one full commit of the retired epoch, and a second check adds none.Not run against a real server:
register_userwith an administrator key, and the hosted service's support for message-levelpeer_id.Checklist
Additional Notes
actor_peer_iduntil the owner picks a connection again in setup. Their data is not moved.peers/<instance id>memories may be recalled labelled as that id./newretires the epoch, and the next idle checkpoint commits its remaining conversation in full, including short conversations. OV performs memory extraction asynchronously after archiving.openviking.mdstill points to the skill and MCP tools and is left to feat(vika): expose the OpenViking tool surface to every runtime #7079. That PR will also conflict with this one indeployment-config.cjs,setup.mjs,config.mjs,README.mdandinstall.md.memory_policy.peeron, which is the default on main. With it off, OV skips a peer's lines rather than filing them under the owner.danger-full-access, so an agent can read other instances' OV configs on the same machine. A separate user keeps instances apart in normal operation, not against a hijacked agent.🤖 Generated with Claude Code