fix(observability): tame log defaults + user config override (closes #519) (#686)

iii-observability worker emits a WARN every time its log subscriber falls behind, and that WARN re-enters the same broadcast stream the subscriber is failing to drain — positive feedback loop that wrote 137 GB to ~/.agentmemory/daemon.log.new on one reporter's laptop in a few days. Root cause sits in the iii binary (Rust upstream), but we can mute the trigger surface from this side.

Two changes:
- iii-config.yaml + iii-config.docker.yaml: sampling_ratio 1.0 → 0.1 and logs_console_output true → false. At 0.1 the subscriber catches up under sustained load; with console off, the WARN line that re-feeds the loop never reaches the amplifying layer.
- src/cli.ts findIiiConfig: precedence reversed so the bundled config no longer wins unconditionally. New order: AGENTMEMORY_III_CONFIG env var > project cwd > ~/.agentmemory/iii-config.yaml > bundled. Users who hit the loop on existing installs now have a documented override path that survives npm i -g upgrades.
This commit is contained in:
Rohit Ghumare
2026-05-27 20:46:17 +01:00
committed by GitHub
parent 0468407249
commit 6d9bfedc43
3 changed files with 23 additions and 5 deletions
+3 -2
View File
@@ -40,10 +40,11 @@ workers:
enabled: true
service_name: agentmemory
exporter: memory
sampling_ratio: 1.0
# See iii-config.yaml for the rationale on 0.1 / console-off (#519).
sampling_ratio: 0.1
metrics_enabled: true
logs_enabled: true
logs_console_output: true
logs_console_output: false
- name: iii-exec
config:
watch:
+11 -2
View File
@@ -40,10 +40,19 @@ workers:
enabled: true
service_name: agentmemory
exporter: memory
sampling_ratio: 1.0
# 0.1 instead of 1.0: at full sampling under sustained load the
# log subscriber falls behind, the worker emits a "Log trigger
# subscriber lagged" WARN, and that WARN re-enters the same
# stream the subscriber is failing to drain — a positive
# feedback loop that wrote 137 GB to daemon.log.new on one user
# in a few days (#519).
sampling_ratio: 0.1
metrics_enabled: true
logs_enabled: true
logs_console_output: true
# Console output is off by default; the feedback path needs the
# console layer to amplify. Re-enable per-session via env if you
# need verbose tracing for debugging.
logs_console_output: false
- name: iii-exec
config:
watch:
+9 -1
View File
@@ -302,10 +302,18 @@ async function isAgentmemoryReady(): Promise<boolean> {
}
function findIiiConfig(): string {
// Precedence (user-overridable wins): explicit env > project cwd >
// ~/.agentmemory/ > bundled. The bundled config used to win
// unconditionally, so users hitting the observability log-feedback
// loop (#519) had no way to drop a tamer config in place without
// editing node_modules.
const envPath = process.env["AGENTMEMORY_III_CONFIG"];
const candidates = [
...(envPath ? [envPath] : []),
join(process.cwd(), "iii-config.yaml"),
join(homedir(), ".agentmemory", "iii-config.yaml"),
join(__dirname, "iii-config.yaml"),
join(__dirname, "..", "iii-config.yaml"),
join(process.cwd(), "iii-config.yaml"),
];
for (const c of candidates) {
if (existsSync(c)) return c;