Thanks to visit codestin.com
Credit goes to github.com

Skip to content

context-synthesize: bridge supplies wrong MemoryPattern fields and fabricates reward=1 (3.41.2) #3314

Description

@sparkling

Narrow defect: context adapter fabricates outcomes and drops required fields

Reproduced with @claude-flow/[email protected], @claude-flow/[email protected], [email protected], Node 24.14.1. The real ContextSynthesizer works with its documented input; Ruflo supplies a different shape.

bridgeContextSynthesize() recalls hierarchical rows, then maps every row to:

{ content: r.value || r.content || '', key: r.key || r.id || '',
  reward: 1, verdict: 'success' }

AgentDB's ContextSynthesizer.synthesize() expects MemoryPattern[]: task: string, reward: number, success: boolean, optional critique, input, and output. It calculates success rate from success and extracts repeated patterns from critique; verdict and content do not supply these fields.

Controlled pure-function reproduction

Two synthetic episodes with the same meaningful critique, one success: true, reward: 0.8, the other success: false, reward: 0.2:

Input supplied to the actual installed synthesizer Success rate Average reward Repeated patterns
Current Ruflo mapper 0 1 none
Documented MemoryPattern fields 0.5 0.5 expected critique-derived phrase

This test touches no database. The controller's default minimum pattern frequency is 2: one note producing no repeated patterns is not by itself a defect.

The important semantic boundary

Current hierarchical storage also accepts ordinary fact strings with no task outcome at all. Merely renaming verdict to success would fabricate successful episodes from facts. Empty/factual recall must not be misreported as measured success or quality.

Proposed minimal correction / acceptance

  • Map only explicitly outcome-bearing, validated episode data to the documented contract, retaining both true and false success and the actual numeric reward.
  • Preserve task and critique; validate optional fields before calling the controller.
  • Plain facts and invalid/missing outcomes must be explicitly excluded/reported, or return an unsupported-input result when no eligible episodes exist. Do not invent reward or success defaults.
  • Clearly distinguish no recalled rows, recalled but ineligible facts, partial eligible input, and controller failure.
  • Test both hierarchical recall interfaces, asynchronous recall, mixed success/failure, zero reward, repeated critiques, plain prose, malformed JSON, inherited properties, and wrong-typed outcome fields.
  • Do not rewrite retained memories, create a new memory store, or silently change hierarchy/consolidation behavior.

Related, but distinct

A small reversible, exact-anchor downstream patch will follow with implementation and regression evidence.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions