Skip to content

Incompatible with OpenClaw 2026.4.5: model call never fires after before_prompt_build hook #1283

@fkc0p

Description

@fkc0p

Bug Report

Environment

  • OpenViking plugin: 2026.3.25 (installed via ClawHub)
  • OpenClaw: 2026.4.5
  • Platform: Linux x86_64, Kali

Symptom

After upgrading OpenClaw from 4.2 → 4.5, the OpenViking context-engine plugin causes the agent pipeline to silently stop. Messages are received, OpenViking auto-recall runs and injects memories, but the model call never happens. The typing indicator times out after 2 minutes with no response.

Slash commands (INTERACTION_CREATE) still work because they bypass the context-engine pipeline.

Works on: OpenClaw 2026.4.2, 2026.4.3
Broken on: OpenClaw 2026.4.5

Root Cause Analysis

OpenViking registers both a before_prompt_build hook (for auto-recall memory injection) and a context-engine (via api.registerContextEngine()).

In OpenClaw 4.5, the execution order changed:

  1. contextEngine.assemble() runs first — assembles and locks the message array
  2. before_prompt_build hook runs second — returns { prependContext: "..." }

The hook's prependContext return conflicts with the already-assembled message array. The runtime detects this inconsistency and silently aborts — the model API call is never made.

Relevant OpenClaw 4.5 Changes

From the changelog:

  • assemble() now receives a new prompt field (PR #50848) — legacy engines get a retry without it, but the retry path may conflict with the hook
  • before_prompt_build hook result merging logic changed (PR #58375) — higher-priority systemPrompt preservation may affect how prependContext is applied

OpenViking Server Status

OpenViking server itself works fine (HTTP 200, rerank completes, memories returned). The issue is purely in the plugin-side hook/context-engine interaction with OpenClaw 4.5's runtime.

Suggested Fix

When OpenViking is registered as a context-engine in OpenClaw 4.5+:

  1. Move auto-recall memory injection logic from the before_prompt_build hook into assemble()
  2. Skip the before_prompt_build hook when context-engine mode is active
  3. This avoids the dual hook + context-engine conflict

Workaround

Setting contextEngine: "legacy" and disabling OpenViking (enabled: false) restores normal operation. Agents respond normally without OpenViking's semantic recall.

Logs

[plugins] openviking: auto-recall failed: Error: openviking: auto-recall search timeout
[plugins] openviking: injecting 3 memories (~54 tokens, budget=1000)
[gateway] openviking: session message POST ... 
// No [agent] embedded run or model call logs after this
// 2 minutes later:
typing TTL reached (2m); stopping typing indicator

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions