Skip to content

fix(integrations): detect Memory protocol mismatches across hosts - #2495

Merged
hidb4ai merged 4 commits into
masterfrom
codex/fix-memory-protocol-diagnostics
Nov 10, 2026
Merged

hidb4ai merged 4 commits into
masterfrom
codex/fix-memory-protocol-diagnostics

Conversation

@hidb4ai

@hidb4ai hidb4ai commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Which issue or RFC does this PR close?

Closes #2491.

Rationale for this change

After upgrading Server 1.2.0 to 1.5.0 while retaining the old DSH plugin, health checks and /pc doctor report success even though exact Memory reads and mutations fail. The plugin also replaces legacy_memory_operation_unsupported with invalid_request, hiding the recovery action. Plugin package versions alone cannot identify the supported Memory contract.

What changes are included in this PR?

  • Separate Server Memory contract discovery from service health in shared CLI diagnostics. Inspect installed protocol declarations for DSH, Pi, OpenCode, OpenClaw and Hermes; report undeclared packages as unverified/degraded.
  • Check the Memory feature contract in DSH/Pi/OpenCode Doctor and Hermes status. DSH also checks Atomic routes and rejects a stale native MCP mutation catalog.
  • Preserve legacy_memory_operation_unsupported with safe recovery instructions across these adapters and Server HTTP/MCP responses: update the client/plugin, repeat setup for the affected profile, restart, rerun diagnostics and obtain current Atomic references. Preserve CAS; never automatically replay writes. DSH results remain valid JSON when no request ID is available.
  • Update both documentation locales and rebuild the checked-in DSH/OpenCode bundles.

Host audit follows integrations/capabilities.toml: DSH, Pi, OpenCode, OpenClaw and Hermes have local HTTP adapters; Codex, Claude Code, WorkBuddy, ZCode and experimental Kimi Code use shared Server-native MCP. Cindy, MiniMax and portable-plugin paths were also inspected. Shared MCP rejection/readback is covered without claiming individual acceptance of every host.

Are there any user-facing changes?

Doctor exposes separate server_memory_protocol / plugin_memory_protocol results. Contract discovery uses the selected host’s URL-bound stored authorization, or MiniMax’s native headers, without forwarding credentials through redirects. When discovery requires authorization and no credential is available, it remains visibly skipped and does not independently fail setup or Doctor; rejected configured credentials remain degraded. Desktop accepts both checks while projecting only allowlisted field names and statuses. Older packages without a declaration, including previously compatible packages, require an update before this check can establish compatibility. Already running historical plugins cannot acquire this fix from a Server-only upgrade; restart the actual host/profile after setup.

Package declarations attest to installed support, not a running process or successful writes. Discovery failures remain distinct from health failures. No database tables, HTTP endpoints or generated HTTP schemas change; diagnostic output, plugin metadata and recovery messages are additive.

How was this change tested?

  • make check: passed, including pre-commit, Python type checks, generated-contract checks and integration manifest validation.
  • DSH pnpm test / pnpm build: 455 tests passed and bundle rebuilt. One full-suite attempt encountered an existing HTTP fixture's ephemeral-port fetch: bad port failure; the unchanged rerun passed. The new request-ID-absent regression failed before the fix and passes afterward.
  • Pi pnpm test / pnpm typecheck: 162 passed; OpenCode pnpm test / pnpm typecheck / pnpm build: 113 passed; OpenClaw equivalent checks: 99 passed (Node 22.22.3).
  • uv run pytest tests/integrations/test_hermes_provider.py -q: 103 passed. CLI, authorization, MiniMax HTTP and real WorkBuddy service-chain regressions: 311 passed, 42 conditional skips. This includes discovery with a saved credential after its setup environment has been removed, missing/rejected/URL-mismatched credentials, and redirect refusal. Native MCP regression verifies the original error/recovery and an empty Memory inventory after rejected legacy CAS.
  • Desktop Rust projection regression covers both protocol checks in all four statuses and redacts private detail fields. An isolated harness using the actual projection code also accepts current CLI JSON. The complete Desktop application build was not run locally because GTK/WebKit development dependencies are unavailable.
  • Real release-wheel Server processes, DSH SDK/Host subprocesses and native setup in isolated profiles: old 1.2 plugin + 1.5 Server yields non-success diagnostics; upgrading the same profile preserves a user patch and passes; current plugin + 1.2 Server detects the mismatch; current plugin + 1.5 Server passes search, remember, list, get, revise and retire (6/6). A native MCP legacy-CAS rejection retains recovery text and performs no write.

The real DSH runs use scripted loopback model responses. Desktop UI, external-model quality, non-SQLite backends and full model sessions for every host were not exercised. Other-host evidence consists of adapter/CLI regressions, Pi package loading, OpenClaw package/Skill discovery and shared MCP tests. DSH's supported test/build workflow passes; an additional raw tsc --noEmit probe encounters existing .ts import and test typing configuration errors.

AI usage statement

OpenAI Codex (GPT-6) assisted with reproduction, implementation, code review, tests and this PR description.

Refs #2491. Preserve legacy Memory errors and recovery across host adapters; distinguish protocol compatibility from health and registration.
Comment thread src/powercontext/cli/memory_protocol.py Resolved

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Two correctness blockers remain at this head: authenticated setup/Doctor fails during contract discovery (confirmed in the existing thread), and Desktop rejects the new diagnostic fields. The new Desktop regression is detailed inline.

Comment thread src/powercontext/cli/system.py Resolved
@AlexStocks AlexStocks added the 1.5.1 v1.5.1 release tracking label Nov 5, 2026

@hireview001 hireview001 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.

  • CI failed: CI result (failure).
  • CI failed: Upgrade release gate (failure).
  • CI failed: tests (3.12, e2e) (failure).
  • CI failed: Main (failure). Failed steps: tests (3.12, e2e) / Run end-to-end tests; Upgrade release gate / Require the selected parallel acceptance workflow; CI result / Require successful selected checks.

@knqiufan knqiufan 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.

The existing authentication and Desktop diagnostic projection findings still apply at this head. The authenticated WorkBuddy setup regression was reproduced locally; please address the existing threads.

@hidb4ai hidb4ai removed the 1.5.1 v1.5.1 release tracking label Nov 9, 2026
@AlexStocks AlexStocks added the 1.5.2 v1.5.2 release tracking label Nov 9, 2026

@PsiACE PsiACE left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks

@hidb4ai hidb4ai left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Re-reviewed 4477db71970e0ba3e41a19b11b8b96d92b603ba4: the previously reported authenticated-discovery and Desktop diagnostic-projection regressions are fixed. I found no additional correctness blocker in the focused re-review.

Merge validation is still incomplete: the e2e job was cancelled, upgrade acceptance and Desktop validation were skipped, and the Upgrade release gate and CI result remain failed. The upgrade gate explicitly reports UPGRADE_SELECTED=true with UPGRADE_RESULT=skipped. Please complete the required CI checks for this head before merging.

@hireview001 hireview001 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

@hidb4ai
hidb4ai merged commit 3dc14e2 into master Nov 10, 2026
37 of 40 checks passed
jasondeng1997 added a commit to jasondeng1997/powercontext that referenced this pull request Nov 11, 2026
… plugin

Merging master brought oceanbase#2495, which verifies the installed plugin's declared
Memory protocol on every `setup dsh` and fails the command when the
`powercontext-dsh` bundle does not declare `atomic-artifact-v1`. The runtime
include-tree fixture impersonates that bundle without the declaration, so the
expected-success phase of "setup validates native include trees" exited 1 with
`plugin_memory_protocol: unverified` before it could assert anything — the
`dsh-package` job fails the same way on the merged tree (master cannot see this
yet because its own job stops at an earlier step).

Declare the contract on the fixture, as the real plugin's package.json does. The
fixture keeps its third-party shape otherwise; oceanbase#2495's policy — setup and doctor
fail on an unverified or incompatible PowerContext plugin — is unchanged and
still covered by the unit tests in `tests/test_dsh_cli.py`.

Verified locally: the failing scenario passes, and the full
`node --test --test-concurrency=1 setup.test.mjs runtime.test.mjs` suite is
19/19 green.
jasondeng1997 added a commit to jasondeng1997/powercontext that referenced this pull request Nov 12, 2026
…ture

The `dsh-package` job reached "Verify DSH setup with customized profiles" for
the first time on this branch and failed one case:

    tests/test_dsh_transport.py::
        test_explicit_web_doctor_does_not_read_desktop_environment_profile

`doctor dsh --profile web` verifies the installed plugin's declared Memory
protocol (oceanbase#2495). The fixture's Web profile was an empty `bundles: []`, so
`read_dsh_settings(..., require_installed=True)` could not resolve a plugin,
the compatibility diagnostic degraded to `unverified`, and the command exited
1 before the assertion about profile selection ran. Master never observed it
because its own `dsh-package` run stopped at an earlier JS step; current master
(oceanbase#2306) fixes the same fixture by installing a bundle that declares the
contract.

Give the Web profile a resolvable `powercontext-dsh` bundle whose manifest
declares `atomic-artifact-v1`, then assert the diagnostic reports that exact
protocol. The Desktop profile keeps its empty bundle list and its own baseUrl,
so the original point of the test still holds: if doctor read the Desktop
profile selected by the DSH_PROFILE environment variable, the check would
degrade rather than pass. Upstream's policy (setup/doctor fail on an unverified
or incompatible plugin) is unchanged.

Verified locally with the real DSH runtime and config boot:
`uv run pytest tests/test_dsh_transport.py --require-dsh-runtime
--require-dsh-config-runtime` -> 109 passed. `ruff check`, `ruff format
--check` and `ty check` all pass.
@PsiACE
PsiACE deleted the codex/fix-memory-protocol-diagnostics branch November 16, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

1.5.2 v1.5.2 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: detect Memory protocol mismatches and preserve recovery errors across Agent hosts

5 participants