Skip to content

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

Rust

Merge pull request #1359 from lhzapata/fix/auth-error-body

AkitaOnRails7c76cbbb150f
diff --cc CHANGELOG.md
index 44604fa1,31ae0570..2c7f8b61
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -12,33 -12,13 +12,38 @@@ version in [`docs/changelog/`](docs/cha
## [Unreleased]
### Fixed
+ - `ai-memory auth login openai-oauth` and `auth login copilot` no longer print
- a failed endpoint's whole response body. The body is read up to 1 MiB,
- scrubbed of secrets and terminal control sequences, and cut to 1 KiB, the
- same handling provider errors already had for size. Provider error bodies
- (`LlmError::Provider`, including `oidc-device` login and token refresh) are
- now scrubbed too, before the cut, so a secret at the 1 KiB boundary is
- still redacted. (#1359)
++ a failed endpoint's whole response body. Error bodies are bounded, scrubbed
++ of secrets and terminal control sequences, then capped for display; provider
++ errors, including OIDC login and refresh, use the same ordering so a secret
++ at the display boundary is still redacted. (#1359)
+- Fixed OIDC device login and refresh sending credential-bearing requests to
+ non-TLS endpoints. Issuers and advertised or persisted device/token endpoints
+ must now use `https` outside loopback, and authentication requests do not
+ follow redirects. Plain `http` remains available for local test issuers on
+ `localhost`, `127.0.0.1` and `::1`. (#1354)
+- Fixed `install-instructions` printing a false "Claude Code reads <file> instead
+ of AGENTS.md" note when `$HOME` is reached through a symlink. The home
+ `.claude/CLAUDE.md` skip now compares with the same canonicalising
+ `paths_match` helper the import check uses, so a symlinked home matches its
+ resolved path. (#1345)
+- Corrected stale claims in `docs/comparison.md` and `docs/competitive-parity.md`
+ that said Windows has no service step and the Windows install is experimental.
+ The 3.1 `install.ps1` + `setup` Windows service step is shipped production,
+ not experimental; the "3.0 (unreleased)" observation-stream note is corrected
+ to reflect the released 3.0 line. (#1271)
+- Made the executable auto-improvement eval policy server-owned. Manual CLI and
+ HTTP reviews now use `[auto_improve.eval]` from the server process, and legacy
+ requests that try to supply an `eval` object fail closed with an upgrade
+ message.
+- Made managed cross-harness continuation survive quota exhaustion without a
+ voluntary handoff. The startup packet now places its server-authored resume
+ directive outside the untrusted transcript fence, and refreshed
+ `CLAUDE.md` / `AGENTS.md` routing tells an incoming agent that "continue",
+ "resume", and "pick up where we left off" must consult the private
+ `AI_MEMORY_PREVIOUS_SESSION_HISTORY` dossier when the managed-run variables
+ are present. The dossier remains untrusted evidence and stays local to the
+ launcher machine.
## [3.1.0] - 2026-10-16
diff --cc docs/security-boundaries.md
index 9fbb3dbd,b5f1eaf4..42ed8610
--- a/docs/security-boundaries.md
+++ b/docs/security-boundaries.md
@@@ -65,7 -65,6 +65,8 @@@ means the boundary is not built yet
| 7b | New public page metadata is bounded and cannot supply scope, author or admission controls; admin kind retains its legacy adapter | `ai-memory-core/src/page.rs` `PageWriteMetadata::into_frontmatter`; MCP validates all four fields; admin consumes legacy kind explicitly and shares entities/abstract/relations validation before scope creation; both use `Wiki::write_page` for sanitization/admission/authenticated attribution | `admin_write_page.rs` `write_page_metadata_rejects_invalid_payload_before_scope_creation` (invalid shapes, unknown relation kinds, raw-input over-limit values, untrimmed relation scopes and escaping paths refused; legitimate control admitted), `write_page_metadata_preserves_admin_auth_and_sanitization` (anonymous/DB-user refused, root control admitted with scrubbed metadata and authenticated attribution); `server.rs` `memory_write_page_metadata_rejects_invalid_before_scope_creation`, `memory_write_page_metadata_preserves_scope_author_and_sanitization` (foreign user denied; writer control admitted, forged frontmatter/author ignored, secrets scrubbed, invalid rewrite leaves disk and SQL latest unchanged); core `page_write_metadata_scope_components_refuse_surrounding_whitespace` and `page_write_metadata_limits_apply_before_trimming_and_normalization`; admin `write_page_metadata_admin_legacy_kind_matches_base` compares long/control-character kind behavior with the base adapter; entity-bound refusal bite-checked with its validation removed | STRONG |
| 7c | A compaction checkpoint cannot bypass `consolidate` admission by deferring its provider rewrite (#1229) | `ai-memory-hooks/src/router.rs` `write_checkpoint_page` gives the PreCompact / PostCompaction rule-based write the `consolidate` admission operation whenever a consolidator is configured, and `process_authorized` queues the durable rewrite only after that write succeeds; the worker's rewrite runs admission again through `Consolidator::consolidate_session` | `router.rs` `checkpoint_admission_refusal_writes_no_page_and_queues_no_rewrite` (a policy refusing `consolidate` leaves no page and no queued job; control: a policy gating only `handoff_begin` writes the page and queues the job), `checkpoint_preserves_the_consolidate_admission_operation` (the hook path sends exactly one `consolidate` admission call and never calls the provider); both bite-checked with the admission context removed | STRONG |
| 7d | The Cursor Agent CLI child, which reads captured session text, never sees the server's own credentials | `ai-memory-llm/src/cursor_agent.rs` `complete_text` spawns `agent` with `env_clear()` plus `CursorAuth::child_env`, which `CursorAuth::new` filters through `cursor_child_env` (an allowlist of `PATH`/`HOME`/user, locale, temp/XDG, session bus, proxy/CA and Windows basics, plus `LC_*`/`CURSOR_*`); the environment and the workspace root are captured once by `ai-memory-cli/src/config.rs` `Config::cursor_auth`, so the provider reads no environment itself; a relative workspace root is refused | `cursor_provider.rs` `the_child_gets_only_the_allowlisted_environment` (`AI_MEMORY_AUTH_TOKEN` and `OPENAI_API_KEY` canaries and the test process's own `CARGO_*` variables never reach the child; control: `PATH`, `HOME` and `CURSOR_API_KEY` do, and the workspace sits under the injected root; bite-checked by dropping `env_clear()`), `a_relative_workspace_root_is_refused`; `config.rs` `cursor_provider_hands_the_child_only_allowlisted_env` | STRONG |
+| 7e | Executable auto-improvement eval policy is server-owned | `ai-memory-mcp/src/admin.rs` retains the legacy request `eval` key only as a rejected compatibility field and builds `AutoImproveReviewConfig.eval` exclusively from `AdminState`; `ai-memory-cli/src/commands/auto_improve.rs` sends no executable policy over HTTP | MCP `auto_improve_admin_refuses_request_eval_and_inherits_server_defaults` sends a request-controlled program path and receives 422, then omits the field and proves the configured server gate still runs | STRONG |
++| 7f | Remote authentication and provider error bodies cannot inject terminal controls or expose recognizable secrets at the display cap | `ai-memory-llm/src/response.rs` `provider_error_body` bounds the network read to 1 MiB, applies the built-in sanitizer to the complete bounded body, then caps terminal output to 1 KiB; every LLM provider and every failure branch in `ai-memory-cli/src/commands/auth.rs` uses that helper | `response.rs` `provider_error_body_redacts_a_secret_straddling_the_display_cut`, `provider_error_body_strips_terminal_control_sequences`, and `provider_error_body_caps_what_it_reads_and_what_it_shows` (legitimate prefix/control preserved while secrets and controls are removed) | STRONG |
| 8a | Messaging: recipient-only visibility | `ai-memory-store/src/ops.rs` pop target-select + `reader.rs` `list_messages` (`to_*` predicate) | `agent_messages.rs` `a_message_is_only_visible_to_its_recipient`; `agent_messages_tools.rs` non-recipient cannot pop | STRONG |
| 8b | Messaging: cancel-own-only | `ai-memory-store/src/ops.rs` `cancel_messages` (AND-gated on `from_*` sender coordinate) | `agent_messages.rs` — whole-outbox **and** a foreign **specific-id** cancel refused | STRONG |
| 8c | Messaging: pop-exactly-once | `ai-memory-store/src/ops.rs` `pop_message_in_transaction` atomic CAS `WHERE state='pending'` | `agent_messages.rs` — sequential **and** `tokio::join!` concurrent double-pop yields exactly one `Some` | STRONG |