Files
CyberGril/spike/hel857/ledger_child.py
T
zonggongandmultica-agent e31ae2d946 HEL-857: approved Mem0 isolation spike - zero-model gates all pass, A/B synthetic scenarios within 26/60 real-call budget
- Fixed mem0 source commit 2c81af3 (2.2.1) in isolated venv, qdrant embedded + fastembed local zh embeddings (95.3MB, within 500MB cap)
- Gate0 transport-level persistent debit ledger: 61st call blocked pre-send, failures count, cross-process persistence, retries disabled+counted (fake transport, zero network)
- Gate1 qdrant embedded checks: keyword_search functional (Chinese segmentation gap recorded honestly), restart subprocess, clean-copy restore, no telemetry collections
- Gate2 privacy with stub LLM: P1-P5 zero leak, first-share timing F1-F6 (failed/cancel/unconfirmed no migration, ack+judged migrates told content with anchors, duplicate receipt idempotent), full backup incl. unshared internal memories restores clean
- A/B same-material same-criteria: Mem0 paraphrase recall strictly better than current lexical path (S3, model answers in Chinese), S1-S9 all pass, no regression
- Headline findings: Chinese input extracted as English memories (default upstream prompt), BM25 lexical channel inert for Chinese, ADD-only infer confirmed with our update orchestration, custom metadata needs direct payload read
- 26/60 real outbound via persistent ledger (incl. one parse-failure retry), usage/latency per row; embeddings 28/500; HEL-835 quota untouched
- Experiment branch only: no merge to main/product, no deploy, no real-profile access; handoff JSON + dual-base requirement checks pass

Co-authored-by: multica-agent <github@multica.ai>
2026-10-25 23:19:26 +08:00

39 lines
1.0 KiB
Python

#!/usr/bin/env python3
"""T3 子进程:读取既有账本,尝试一次请求,应被拦且零出站。"""
from __future__ import annotations
import json
import sys
from pathlib import Path
import httpx
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
from spike.hel857.ledger import AccountingTransport, BudgetBlocked, FakeTransport, Ledger # noqa: E402
def main() -> int:
led = Ledger(Path(sys.argv[1]))
fake = FakeTransport()
client = httpx.Client(transport=AccountingTransport(fake, led), base_url="http://fake.invalid")
blocked = False
msg = ""
try:
client.post("/v1/chat/completions", json={"messages": [{"role": "user", "content": "跨进程"}]})
except BudgetBlocked as e:
blocked = True
msg = str(e)
print(json.dumps({
"blocked": blocked,
"message": msg,
"fake_attempts": fake.attempts,
"used_seen_by_child": led.used(),
"pid": __import__("os").getpid(),
}))
return 0
if __name__ == "__main__":
raise SystemExit(main())