Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

Merge remote-tracking branch 'origin/main' into fix/backfill-dry-run-state

AkitaOnRails7df410fb5973
diff --cc CHANGELOG.md
index 8e79a88d,2c0755eb..db10e0f2
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -7,10 -7,60 +7,63 @@@ and this project adheres to [Semantic V
## [Unreleased]
+ ### Changed
+ - `memory_consolidate` accepts an omitted `session_id`. Omitting the field (or
+ sending `null`) no longer fails deserialization with `missing field
+ session_id`; the tool consolidates the latest completed session in the
+ resolved project — the same default `memory_auto_improve` and
+ `memory_read_session_observations` already use. Pass an explicit UUID to
+ target a specific session, and `dry_run=true` for the cheap admission
+ preflight. A project with no completed session now fails as
+ `no completed session in <scope>` instead of a deserialization error.
+ - A consolidation LLM call that fails on a transient provider error (`429`, any
+ `5xx`, a transport timeout or connect failure) is retried twice, two seconds
+ apart, before the failure is reported — the same bounded policy `bootstrap`
+ already applies to its chunks. Deterministic failures (auth, schema, a
+ malformed-request `4xx`, unparseable or truncated output) are still reported
+ on the first attempt, since retrying them only burns another call.
+
### Fixed
+- `backfill --dry-run` recorded a completed attempt and suppressed the next
+ automatic import. Planning now leaves the backfill sentinel untouched, even
+ for populated projects or an opted-out automatic invocation (#785).
+ - `ai-memory serve` no longer hard-fails to take its single-instance lock on a
+ transient error under load. Acquiring the serve lock now retries `open` and
+ `try_lock_exclusive` a few times with a short (~25ms) backoff when they hit a
+ transient failure (EMFILE/ENFILE fd exhaustion, EINTR), mirroring
+ `acquire_drain_lock`. A genuinely contended lock (`WouldBlock`, another server
+ holds it) is never retried and still refuses startup immediately. The
+ serve-lock tests also assert with the concrete errno so any remaining
+ environmental flake is diagnosable rather than silent (#745).
+ - GitHub Copilot completion requests now select the model-advertised API
+ endpoint from `/models`: existing Chat Completions remains preferred when
+ available, while Responses-only models use `/responses`. Responses requests
+ preserve strict JSON Schema structured-output constraints and report empty,
+ refused, or rejected output without silently downgrading the contract. A model
+ the `/models` catalogue does not enumerate (enterprise/custom deployments,
+ aliases, a model newer than the list) falls back to Chat Completions with a
+ warning instead of erroring, matching the graceful fallback already used when
+ `/models` is unavailable. As a related behavior change, a Copilot chat
+ completion that returns empty content now reports `UnexpectedShape` rather
+ than yielding an empty string. (#761)
+ - The V62 page-ingestion-window migration no longer runs its backfill inside a
+ single migration transaction, which on a large store ran for hours and grew
+ the WAL to roughly the size of the database with no progress. V62 is now
+ DDL-only (the two columns plus their index); the window backfill moved to a
+ chunked, resumable, WAL-bounded boot-path step that processes pages in bounded
+ batches, checkpoints the WAL (`TRUNCATE`) between each, and logs progress. The
+ end state is byte-identical to the original V62, the step resumes rather than
+ restarts if interrupted, and it is a fast no-op on a store that already applied
+ the original V62. Because that reshape changes the migration's checksum, the
+ runner now intentionally tolerates a divergent checksum on an already-applied
+ migration (`abort_divergent = false`) so correctly-migrated stores still open;
+ the schema-ahead guard (`abort_missing`) is unchanged (#776).
+ - Page writes now refuse git-reserved and non-portable page paths (a `.git`
+ component or an 8.3 `git~1`..`git~4` alias, Windows-reserved names and
+ characters) on every write funnel, including MCP `memory_write_page` and
+ consolidation `apply_batch`; reads of already-stored pages stay tolerant so
+ a bad row never breaks a listing. The git-reserved check is byte-safe and no
+ longer panics on a 5-byte multibyte path component (#781).
- The generated OpenCode and OpenCode 2 plugins now forward a subagent session's
`parentID` as the `agent_id` marker, so `[capture] drop_subagent_captures` can
recognize and drop OpenCode subagent sessions. Previously both plugins emitted
diff --cc crates/ai-memory-cli/tests/suite/main.rs
index d6ee0e94,1386b9a9..79e481e8
--- a/crates/ai-memory-cli/tests/suite/main.rs
+++ b/crates/ai-memory-cli/tests/suite/main.rs
@@@ -6,8 -6,8 +6,9 @@@
//! so a new file must be declared here (`scripts/check-test-suites.*` enforces it).
mod autoscope_env;
+mod backfill_dry_run;
mod backfill_e2e;
+ mod backfill_failures;
mod completions;
mod doctor_e2e;
mod e2e_support;
diff --cc docs/design-boot-backfill.md
index 80fd3f9a,b39dfd04..3c5f61f2
--- a/docs/design-boot-backfill.md
+++ b/docs/design-boot-backfill.md
@@@ -23,11 -23,14 +23,17 @@@ behavior and touches the trust boundar
re-spawning. Live hook capture (install-time forward) and backfill (before-install
history) do not overlap, so there is no double-capture to reconcile.
+`backfill --dry-run` only plans the import; it neither creates nor overwrites
+the local sentinel, so it does not suppress a later automatic attempt.
+
The automatic path runs detached and silent (like Claude Code's own auto-memory); the
`📼 imported N session(s)` summary is shown on a **manual** `ai-memory backfill` only.
+ Failed imports are always written to stderr (the detached worker's
+ `logs/backfill.log`), including with `--quiet`. Any failed session makes the
+ command exit nonzero after emitting its report; `--json` still produces the
+ complete report on stdout. Other selected sessions are still attempted, and
+ the one-attempt sentinel policy is unchanged.
+
Surfacing the count in the next session's on-start context is a possible follow-up
(§ "Notice delivery" describes the delivery path it would reuse).