Repository navigation
Triage batch 1: backpressure, eviction, project scoping and 10 more fixes - #57
Merged
Merged
Conversation
added 17 commits
September 25, 2026 18:29
A busy self-hosted backend (429 queue_full, Retry-After: 30) tripped the summarize breaker after three calls, so every summary for the next 30s failed with circuit_breaker_open. Providers now throw ProviderHttpError carrying the status; ResilientProvider does not count 429/503 as a failure. Retry-After is honored in full when it fits the call's budget instead of being cut to 5s. All LLM calls share one slot pool, AGENTMEMORY_LLM_MAX_CONCURRENCY (default 4). Upstream PR#1259. Generated-By: Claude Opus 5.5 (1M context)
countObservationTokens sent one /tokenize per Observation, 16 at a time, on every summarize. On a broker that schedules tokenize beside generation those calls queued, timed out (1331 in three days) or drew 429s (205), adding load in front of the summary they were measuring. Only 12 of ~1800 summaries needed more than one chunk. The chars/3 estimate overcounts, so when it fits the budget the Session is summarized without measuring. Generated-By: Claude Opus 5.5 (1M context)
Claude Code writes plain PreToolUse stdout to the debug log and never shows it to the model, so AGENTMEMORY_INJECT_CONTEXT=true fetched /enrich on every file tool call for nothing. When the payload names hook_event_name "PreToolUse" the context now goes out as hookSpecificOutput.additionalContext; hosts that send no event name keep the plain text. Upstream rohitg00#1278. Generated-By: Claude Opus 5.5 (1M context)
mem::evict was registered but no timer called it, so Eviction only ran when someone POSTed /agentmemory/evict. It now runs every 24h beside the lesson and insight decay sweeps; EVICTION_ENABLED=false opts out. Upstream PR#1287. Generated-By: Claude Opus 5.5 (1M context)
lesson-recall defaulted minConfidence to 0.1 while the decay sweep floors a reinforced lesson at 0.05 and keeps it live, so every correction old enough to have decayed was invisible to default recall. The default is now 0, matching lesson-list; soft-delete remains the gate and confidence still ranks decayed lessons last. Upstream rohitg00#1065. Generated-By: Claude Opus 5.5 (1M context)
recordAudit wrote a row per state change and nothing ever removed one, so mem:audit grew for the life of the install. A daily sweep now keeps the newest AGENTMEMORY_AUDIT_MAX entries (default 50000) and logs what it removed; AGENTMEMORY_AUDIT_STORE=off still skips the store entirely. Upstream PR#1176. Generated-By: Claude Opus 5.5 (1M context)
A trigger word matched mid-sentence dropped the subject and could invert the lesson; a dot inside a filename cut it short. Lessons are now whole sentences that open with a trigger, with balanced markup, within 220 chars. A re-import no longer bumps reinforcements or lastReinforcedAt, so a re-derived lesson can still decay out (rohitg00#1292). Generated-By: Claude Opus 5.5 (1M context)
OpenAI's reasoning models, including the default gpt-5.6-luna, reject max_tokens with a 400, so every compress/summarize call failed on a default config. api.openai.com accepts max_completion_tokens on every model; compatible servers keep max_tokens (rohitg00#1219). Generated-By: Claude Opus 5.5 (1M context)
…ault A memory_smart_search observation contains its query verbatim, so it outranked the real answer on the next identical search. Unset AGENTMEMORY_INDEX_EXCLUDE_TOOL_PREFIXES now means both agentmemory MCP prefixes; set it empty to index everything. Rows stay stored (rohitg00#993). Generated-By: Claude Opus 5.5 (1M context)
import-jsonl recorded these background jobs as sessions the Operator never worked in. A transcript whose first prompt is Warmup or the conversation-list summary instruction is now skipped (rohitg00#1064). Generated-By: Claude Opus 5.5 (1M context)
At MAX_OBS_PER_SESSION, mem::observe refused every new observation, so the end of each long session was silently lost; ten live sessions sat at exactly 500. The cap now evicts the lowest-importance row, oldest first on a tie, from KV and both indexes, and logs a warning (PR#1174). Generated-By: Claude Opus 5.5 (1M context)
…branch Generated-By: Claude Opus 5.5 (1M context)
…e project An unscoped consolidation run (the 2h timer, session stop) merged the 20 newest summaries from every project into one semantic pass and ran reflect over all facts, crystals and concepts, so insights mixed repos and carried no project. It now consolidates each project with summaries newer than the last unscoped run on its own, and mem::reflect with a project only reads that project's facts, crystals, lessons and graph concepts. results.semantic and results.reflect are keyed by project. Refs rohitg00#1344 Generated-By: Claude Opus 5.5 (1M context)
resolveProject took the basename of --show-toplevel, so every linked worktree (e.g. orca's <repo>/<fishname>) became its own project and its Memory never reached the main checkout or sibling worktrees. It now takes the parent of --git-common-dir when that is a .git folder, falling back to the toplevel for submodules and bare-repo worktrees. Existing Sessions keep the project they were filed under. Refs rohitg00#728 Generated-By: Claude Opus 5.5 (1M context)
Generated-By: Claude Opus 5.5 (1M context)
- Eviction and audit Eviction first run 5 min after boot, then daily, so a daemon restarted more often than daily still sweeps. - Consolidation retries a project whose merge or reflect failed, and a fact another project already holds gains this project's Sessions, so scoped reflect still sees it. - Session cap eviction is audited and logs a failed delete; the audit retention sweep is named Eviction, per CONTEXT.md. - A 429 for an exhausted OpenAI quota opens the breaker instead of retrying. - Summarize skips tokenize only when the character count fits one chunk, so dense (CJK) text is still measured. - Lessons accept a curly apostrophe in "Don't"; reflect no longer swallows a failed Session list. - Restore CRLF on files the branch had converted to LF. - Triage: rohitg00#969 is already-fixed, not wont-fix; rohitg00#1278 notes part 3 is open. Generated-By: Claude Opus 5.5 (1M context)
Generated-By: Claude Opus 5.5 (1M context)
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes picked from
docs/upstream-issue-triage.yamlanddocs/upstream-pr-triage.yaml. Each fixed row is re-scored asalready-fixedwith its commit. 2e3e215 also records rows verified as already fixed in this tree (rohitg00#938, rohitg00#1020, rohitg00#1047, rohitg00#1163, rohitg00#1180, rohitg00#1335, rohitg00#1341, rohitg00#969, PR rohitg00#1005), with the code that fixes them as evidence.What changes for you
Retry-After, andAGENTMEMORY_LLM_MAX_CONCURRENCY(default 4) caps how many run at once. A 429 for an exhausted OpenAI quota still opens the breaker./tokenizeround-trip, so no more "Token count failed" warnings for them.EVICTION_ENABLED=falseopts out.AGENTMEMORY_AUDIT_MAXrows (default 50000), trimmed 5 min after boot and then daily, so it no longer grows forever.max_tokens.AGENTMEMORY_INDEX_EXCLUDE_TOOL_PREFIXESto index them again.After merging
systemctl --user restart agentmemory. It runs from this checkout'sdist/.AGENTMEMORY_LLM_MAX_CONCURRENCY=2in~/.agentmemory/.envkeeps that burst gentle on the provider.Behaviour notes
mem::consolidate-pipelinenow returnsresults.semanticandresults.reflectkeyed by project. An unscoped run (the timer, or session stop) only processes projects with summaries newer than the last unscoped run.plugin/scripts/*.mjswere rebuilt withnpm run build.Review
Standard review (standards, spec, correctness/logic) fixes are in 585f7f0: the timers now run after boot, retries on failure, shared facts, the quota 429, dense text in the tokenize skip, audited cap eviction, glossary naming, and CRLF restored.
Verification
npm test: 2013 passed, 1 skipped.tsc --noEmit: unchanged at 20 errors, all pre-existing.🤖 Generated with Claude Code