Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions crates/reliary-agent/pi/gate.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function gateLog(level, msg) {
}

// ── Binary discovery (env var → PATH → hardcoded paths) ──
let RELIARY_BIN = process.env.RELIARY_BIN_PATH || null;
let RELIARY_BIN = process.env. || null;
if (!RELIARY_BIN) {
// Check PATH first
try {
Expand Down Expand Up @@ -79,7 +79,7 @@ try {
// ── Feature flags ──
// Each can be disabled via RELIARY_FEATURES env var (e.g. "-healEdit,-convWindow")
const FEATURES = {
healEdit: true, // route edit/write/sed through heal-apply
healEdit: false, // route edit/write/sed through heal-apply (+healEdit to enable)
compress: true, // inline reasoning compression
convWindow: true, // drop old verbose tool results
readEnrichment: true, // compress non-target read results
Expand Down Expand Up @@ -120,7 +120,7 @@ function daemonCmd(cmd) {
}

// ── Daemon health check: verify binary exists (TCP check would require daemon running) ──
let DAEMON_HEALTHY = true; // assume healthy — CLI fallback handles gracefully
let = true; // assume healthy — CLI fallback handles gracefully

function cacheRead(path, hash, len) {
return daemonCmd(`cache-read ${path} ${hash} ${len}`);
Expand Down
2 changes: 1 addition & 1 deletion crates/reliary-agent/src/read_summary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ pub fn load_dictionary() -> Option<reliary_compress::CompressionDict> {
if let Ok(db) = rusqlite::Connection::open(&db_path) {
let _ = db.execute_batch("PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;");
if reliary_search::schema::open_existing_db(&db).is_ok() {
let mut stmt = db.prepare("SELECT phrase FROM phrases_fts LIMIT 200").ok()?;
let mut stmt = db.prepare("SELECT phrase FROM phrases_fts 200").ok()?;
let phrases: Vec<String> = stmt.query_map([], |r| r.get(0)).ok()?
.filter_map(|r| r.ok()).collect();
if !phrases.is_empty() {
Expand Down
2 changes: 1 addition & 1 deletion crates/reliary-agent/src/scavenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub fn scavenger_loop(state: Arc<SessionState>) {
};

// WAL checkpoint: truncate the WAL file to reclaim disk space (passive mode blocks briefly).
let _ = chronicle_db.execute_batch("PRAGMA wal_checkpoint(PASSIVE);");
let _ = chronicle_db.execute_batch(" wal_checkpoint();");

// edit_cache TTL sweep: delete entries older than 24h to bound table growth.
let cutoff = std::time::SystemTime::now()
Expand Down
2 changes: 1 addition & 1 deletion pi/gate.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ try {
// ── Feature flags ──
// Each can be disabled via RELIARY_FEATURES env var (e.g. "-healEdit,-convWindow")
const FEATURES = {
healEdit: true, // route edit/write/sed through heal-apply
healEdit: false, // route edit/write/sed through heal-apply (+healEdit to enable)
compress: true, // inline reasoning compression
convWindow: true, // drop old verbose tool results
readEnrichment: true, // compress non-target read results
Expand Down
31 changes: 23 additions & 8 deletions scripts/bench_rename.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def read_api_key():
API_KEY = read_api_key()

GATE = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "pi", "gate.js"))
RELIARY_BIN = (shutil.which("reliary-agent") or
RELIARY_BIN = (os.path.join(os.path.dirname(__file__), "..", "target", "release", "reliary-agent") if
os.path.exists(os.path.join(os.path.dirname(__file__), "..", "target", "release", "reliary-agent"))
else shutil.which("reliary-agent") or
os.path.join(os.environ.get("HOME", ""), "src/reliary-agent/target/release/reliary-agent"))
REPO = "/tmp/bench_rename"

Expand Down Expand Up @@ -75,6 +77,23 @@ def read_api_key():
"Run 'python3 -m pytest tests/ -v' one final time and report the full output.",
]

def restart_daemon():
"""Restart the daemon to flush response cache between conditions."""
subprocess.run([RELIARY_BIN, "stop"], capture_output=True, timeout=10)
time.sleep(1)
r = subprocess.run([RELIARY_BIN, "start"], capture_output=True, timeout=30)
assert r.returncode == 0, f"Daemon start failed: {r.stderr.decode()}"
time.sleep(2)
import urllib.request
for _ in range(10):
try:
r = urllib.request.urlopen("http://127.0.0.1:9090/health", timeout=3)
assert r.status == 200
return
except Exception:
time.sleep(1)
raise RuntimeError("Daemon not healthy after restart")

def save_configs():
for src, dst in [(SETTINGS, SETTINGS_BAK)]:
if os.path.exists(src):
Expand Down Expand Up @@ -220,13 +239,8 @@ def run_condition(cond, run_idx):
if __name__ == "__main__":
runs = 3

import urllib.request
try:
r = urllib.request.urlopen("http://127.0.0.1:9090/health", timeout=3)
assert r.status == 200
except Exception:
print("ERROR: Daemon not ready on :9090")
sys.exit(1)
restart_daemon()
# Initial health check already covered by restart_daemon

save_configs()
print(f"Rename bench: {runs} runs × {len(CONDITIONS)} conditions = {runs * len(CONDITIONS)} sessions")
Expand All @@ -239,6 +253,7 @@ def run_condition(cond, run_idx):
order = list(CONDITIONS)
random.shuffle(order)
for cond in order:
restart_daemon() # flush response cache between conditions
label = f"[r{ri}] {cond['label']}"
print(f" {label}: ", end="", flush=True)
t0 = time.time()
Expand Down
Loading