Skip to content

feat(magpie): unify OpenViking memory and model management - #7290

Merged
ZaynJarvis merged 17 commits into
mainfrom
feat/magpie-models-plugin
Nov 10, 2026
Merged

ZaynJarvis merged 17 commits into
mainfrom
feat/magpie-models-plugin

Conversation

@yufeng201

@yufeng201 yufeng201 commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Installing memory integration and model management separately produces two OpenViking entries. This change combines both into @openviking/magpie-plugin@0.2.0: one installed entry with Agent and request-hook capabilities, retaining the middleware Discovery category.

Users select the VLM model in Agents → OpenViking, with separate Query Planner and VikingBot model IDs configurable through the plugin's existing Options. The model adapter saves the gateway binding, automatically restarts OV, and verifies activation. Memory recall/capture/tools and model management have independent memoryEnabled / modelsEnabled switches. No configuration page, settings panel, or Magpie host changes are required.

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

N/A

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Test update

Changes Made

  • Keep the existing @openviking/magpie-plugin package identity and prepare version 0.2.0; move the model adapter, Agent declaration, CLI and lifecycle tests into its models/ module.
  • Retire the separate models package; its old directory retains migration pointers. Ship one self-contained package and one middleware marketplace entry, with no nested package or UI runtime.
  • Preserve existing memory configuration and authentication. Explicitly disabled memory skips hooks before reading credentials and registers no memory tools; model management can continue independently.
  • Discover OV's connection through the CLI/config and privately read Root credentials for the revision-checked startup configuration and restart APIs. Ordinary memory credentials are never implicitly elevated.
  • Default model changes to automatic restart, checking the saved revision, a new OV instance and managed Bot health. External pending configuration blocks writes before the plugin can claim a new revision; ownership/recovery journals remain intact until the external changes are explicitly applied or reverted. Consecutive plugin-owned pending model changes remain supported.
  • Make the recovery CLI read this installation's Magpie Options (including disabled entries), with an explicit custom-profile directory override and rejection of ambiguous entries. Root credentials no longer need duplicate configuration for CLI recovery.
  • Honor global client-file plugin.enabled: false for background model synchronization and automatic restart, including live flag changes; explicit recovery CLI commands remain available.
  • Preserve unrelated configuration and existing generation parameters, validate known output budgets, detect Bot availability without enabling disabled Bots, and restore owned fields on disconnect.
  • Add queryMode (preserve by default, follow, independent), queryModel and queryParameters in existing plugin Options. Independent Query validates its own catalog model/output limit; follow removes the optional section to use OV's native VLM fallback. Query-only changes use the same automatic restart verification.
  • Journal the optional Query section atomically so null/absent sections, legacy credential chains and parameters restore exactly. Mode transitions preserve the initial snapshot, manual edits block restoration, and runtime Query overrides block management. Account model overrides remain outside scope.
  • Retain ambiguous-save recovery, duplicate-restart protection, stale-lock serialization, and native OV traffic bypass to avoid recursive recall/capture.
  • Remove the unused planning return field and obsolete UI wording; rename CI for the unified plugin and move the unchanged license to the package root. Keep migration pointers and recovery paths for existing installations.
  • Update the combined package tests, CI, English/Chinese documentation and migration instructions. The migration instructions require retaining each feature's previous enabled state; the verified dev migration keeps memory disabled and model management enabled.

Testing

  • Combined suite: 203 passed, one optional Bun memory-host case skipped locally.
  • Regression tests cover external pending changes before first binding, model reselection and restoration, preservation of ownership journals, own pending revisions, real CLI subprocess authentication from Magpie Options, custom profiles, duplicate entries and live global-disable changes.
  • Query regressions cover independent/follow/preserve transitions, null/absent restoration, ambiguous-save recovery, invalid/non-chat models, per-model budgets, manual-edit conflicts, runtime overrides, and Query-only restart without enabling Bot.
  • Real OV/Bot Python configuration contract passed, including independent Query and native fallback for absent/null/empty Query sections.
  • Factory-level reproduction with global plugin.enabled: false: zero Root configuration writes, zero automatic restarts, original model retained.
  • The Query feature artifact passed an isolated smoke test using dev's official Magpie 0.1.3528 and Bun: Agent registration, catalog validation, Bot inheritance, independent Query remaining fixed across main-model switches, model switching, automatic restart verification and exact restoration; generation parameters preserved, zero real inference calls. This test did not change the installed dev plugin or live OV configuration.
  • Syntax, diff and artifact-content checks passed after cleanup, including the root package license and exclusion of the obsolete nested license, model tests and UI assets. The tarball includes the CLI Options resolver, memory/shared runtime and model adapter, without model tests or a nested manifest.
  • Prior unified-plugin verification: optional Bun memory-host test passed on dev; in-place migration preserved selection/recovery journals and existing feature switches; Chrome showed one installed entry with Agent and request-hook tags. The latest combined build (86a781074) has now been deployed in place to dev and Magpie restarted. Installed files match the package; plugin Options, selection and recovery records are unchanged; memory remains disabled and model management enabled. OV configuration/revision and process instance are unchanged, with no pending restart. Final interactive verification is left to the user.

Checklist

  • Reviewed model lifecycle and independent feature switches.
  • Updated English/Chinese installation, migration and model-management documentation.
  • Uses released Magpie interfaces without a companion host patch.

Additional Notes

Prompt-cache utilization was investigated separately. This PR does not change prompt ordering, cache keys, routing affinity, or the extraction strategy.

Version 0.2.0 has not been published. The existing release workflow publishes changed versions only after merge to main. Root configuration/restart APIs are required for model management. Standalone Bot restart and Embedding/Rerank/Account overrides remain outside scope. Manual two-plugin migration instructions are included; do not install both old and unified model Agents simultaneously.

Declare VLM, VikingBot and activation groups for Magpie's native settings
panel extension, reusing the host's rows, menus, switches and numeric
fields. Preserve unset, explicit default and custom parameter values.
Retain a localized standalone form for released Magpie versions and
replace JSON textareas with validated controls. Save through the options
bridge directly because sandboxed panels cannot submit HTML forms.

Validation: syntax checks and all 35 bridge/activation tests passed;
Chromium sandbox form tests passed in Chinese/English at wide/narrow
widths. The actual native declaration passed embedded role-isolation and
save tests, and was installed on dev with the companion Magpie build.
Add a positive-integer vlm.max_concurrent control to native Agent settings
and the sidebar form. Preserve omission and journal the original value
for disconnect restoration. Concurrency changes use the existing Root
configuration save and verified restart flow. Reject the parameter for
VikingBot, which has no corresponding request-concurrency setting.

Document that semantic/Compile capacity is not a global gateway limit.
Validation: syntax checks, all 37 adapter/activation tests, Chinese/English
sandbox form checks, and native settings save checks passed. The dev
server accepted concurrency=4 in dry-run validation. The updated plugin
is installed on dev; its current value of 100 was preserved.
Ignore retained Bot model IDs outside independent mode and treat an empty
independent ID as the Agent selection, keeping native mode switches usable.

Persist the target, full-document fingerprint and revision of plugin saves.
Report external pending restarts separately and recheck ownership inside
the activation lock before any automatic restart. Recover ambiguous save
responses by matching the complete intended document.

Serialize stale-lock recovery so concurrent contenders cannot remove a new
owner's lock. Ambiguous recovery-guard crashes fail closed; document recovery.

Validation: syntax checks and all 42 adapter/activation tests passed.
Five new regression checks fail against the old implementation. Coverage
includes mode switches, external changes, lost save responses, restoration,
activation target checks and deterministic competing stale-lock recovery.
Remove the custom Agent-panel declaration and the dependency on a modified
Magpie application. Keep parameter configuration in the plugin's standard
page, using the released options bridge and theme. Preserve model wiring,
concurrency controls, verified activation and recovery inside the plugin.

Freeze the plugin's own form during saves to retain the save-race fix without
any application changes. Document the supported entry point and allow an
explicit installed Bun path for offline isolated-host verification.

Validation: syntax checks, all 42 bridge/activation tests, and Chinese/English
Chromium form tests at wide/narrow widths passed. The isolated smoke passed
against original Magpie 0.1.3493 on dev with zero inference calls. Dev now uses
its original executable; the custom service override is removed, and the
plugin update preserved options and OV configuration.
@yufeng201 yufeng201 changed the title feat(magpie): manage OpenViking and VikingBot models feat(magpie): switch OpenViking models and restart automatically Nov 10, 2026
@yufeng201 yufeng201 changed the title feat(magpie): switch OpenViking models and restart automatically feat(magpie): unify OpenViking memory and model management Nov 10, 2026

@ZaynJarvis ZaynJarvis left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ZaynJarvis
ZaynJarvis merged commit ba531a6 into main Nov 10, 2026
17 of 18 checks passed
@ZaynJarvis
ZaynJarvis deleted the feat/magpie-models-plugin branch November 10, 2026 07:57
@github-project-automation github-project-automation Bot moved this from Backlog to Done in OpenViking project Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants