Loosen surfacing governance defaults
Local tuning — recall was too quiet in practice. After one surface the old defaults required 10 further messages AND 300s before another, so a second relevant memory almost never appeared in a working session. threshold 0.30 -> 0.25 max_surfaces_per_session 5 -> 12 min_messages_between 10 -> 2 cooldown_seconds 300 -> 30 test_first_surface_ignores_spacing now passes an explicit config, so it exercises the spacing mechanism rather than tracking whatever the defaults happen to be. The value pin is updated to match. Not for upstream — keep off fix/passport-traits-email. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -26,10 +26,10 @@ from aipass.memory.apps.handlers.json import json_handler
|
||||
|
||||
DEFAULT_CONFIG: Dict[str, Any] = {
|
||||
"enabled": True,
|
||||
"threshold": 0.3,
|
||||
"max_surfaces_per_session": 5,
|
||||
"min_messages_between": 10,
|
||||
"cooldown_seconds": 300,
|
||||
"threshold": 0.25,
|
||||
"max_surfaces_per_session": 12,
|
||||
"min_messages_between": 2,
|
||||
"cooldown_seconds": 30,
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -142,20 +142,23 @@ class TestShouldSurfaceHappy:
|
||||
|
||||
def test_first_surface_ignores_spacing(self):
|
||||
"""Fresh session: first prompt with high relevance surfaces immediately."""
|
||||
# Explicit config: this exercises the spacing mechanism, so it must not
|
||||
# move whenever DEFAULT_CONFIG is retuned.
|
||||
cfg = {"min_messages_between": 10, "cooldown_seconds": 300}
|
||||
state = new_state()
|
||||
state["messages_since_last"] = 1
|
||||
ok, reason, updated = should_surface("compass-1", 0.8, state, current_time=100.0)
|
||||
ok, reason, updated = should_surface("compass-1", 0.8, state, cfg, current_time=100.0)
|
||||
assert ok is True
|
||||
assert "ready" in reason.lower()
|
||||
|
||||
for i in range(9):
|
||||
updated = record_message(updated)
|
||||
ok, reason, _ = should_surface("compass-2", 0.8, updated, current_time=100.0 + 400 + i)
|
||||
ok, reason, _ = should_surface("compass-2", 0.8, updated, cfg, current_time=100.0 + 400 + i)
|
||||
assert ok is False
|
||||
assert "spacing" in reason.lower()
|
||||
|
||||
updated = record_message(updated)
|
||||
ok, _, _ = should_surface("compass-2", 0.8, updated, current_time=600.0)
|
||||
ok, _, _ = should_surface("compass-2", 0.8, updated, cfg, current_time=600.0)
|
||||
assert ok is True
|
||||
|
||||
|
||||
@@ -246,7 +249,7 @@ class TestConfigMerging:
|
||||
assert "threshold" in reason.lower()
|
||||
|
||||
def test_default_config_values_match(self):
|
||||
assert DEFAULT_CONFIG["threshold"] == 0.3
|
||||
assert DEFAULT_CONFIG["max_surfaces_per_session"] == 5
|
||||
assert DEFAULT_CONFIG["min_messages_between"] == 10
|
||||
assert DEFAULT_CONFIG["cooldown_seconds"] == 300
|
||||
assert DEFAULT_CONFIG["threshold"] == 0.25
|
||||
assert DEFAULT_CONFIG["max_surfaces_per_session"] == 12
|
||||
assert DEFAULT_CONFIG["min_messages_between"] == 2
|
||||
assert DEFAULT_CONFIG["cooldown_seconds"] == 30
|
||||
|
||||
Reference in New Issue
Block a user