Skip to content

The write-gate check is duplicated in four call sites #195

Description

@RobertSigmundsson

Description

write_gate.auto_capture_mode = "off" reads like "do not auto-capture", but it does not stop auto-capture - it removes the quality gate from the auto-capture path, so more gets written, not less. Everything the hooks would have captured is still captured; it just no longer has to pass the filter.

The setting is documented in unified_config.py as:

auto_capture_mode: str = ""  # "" (inherit) | off | shadow | enforce

and every consumer treats it purely as a gate switch:

src/surreal_memory/hooks/stop.py:434:            if gate_mode != "off":
src/surreal_memory/hooks/stop.py:511:            if gate_mode != "off":
src/surreal_memory/hooks/pre_compact.py:227:            if gate_mode != "off":
src/surreal_memory/mcp/remember_handler.py:231:    if gate_mode != "off":

In all four places, "off" is the branch that skips the gate call. There is no code path anywhere that reads this value and declines to capture.

To Reproduce

  1. Set auto_capture_mode = "off" in the write-gate config.
  2. End a session so the stop hook runs.
  3. Inspect what was written.

Expected Behavior

One of two things, whichever you intend:

  • If the name is the contract: "off" disables automatic capture, and the hooks write nothing.
  • If the gate is the contract: the option is named for what it switches, so an operator cannot read it as "auto-capture: off".

Actual Behavior

Auto-capture continues, and the material that the gate would have rejected is now admitted, because "off" is the ungated branch.

Why this matters

The failure is in the safe-looking direction, which is what makes it worth reporting. An operator who wants to stop the system writing to their brain will reach for the setting called auto_capture_mode and set it to off. The result is the opposite of the intent, and it is silent - there is no warning that turning capture "off" widened what gets stored.

Environment

  • Surreal-Memory version: 3.8.0 (ae8e8743)
  • Installation method: source

Additional Context

I have not sent a PR because the fix depends on which contract you want. Renaming the option is a breaking config change; making "off" actually suppress capture changes behaviour for anyone currently using it to mean "no gate". Happy to prepare whichever you prefer.


Measured on v3.8.0 (ae8e8743). Thanks for the pace on v3.7.0 and v3.8.0 - and for closing
#174, #175 and #176 along the way. Filing this while it is fresh against the current tree.

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