Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors
Rust
Merge remote-tracking branch 'origin/pr/1798' into release/3.2.10
AkitaOnRailse10cd2f2a7b1
diff --cc CHANGELOG.mdindex 1c736739,02ab3cb2..53ab951a--- a/CHANGELOG.md+++ b/CHANGELOG.md@@@ -13,42 -13,11 +13,47 @@@ version in [`docs/changelog/`](docs/cha### Fixed+- Sorted recent page lists by timestamp rather than RFC3339 text, so updates+ with different fractional-second precision appear in chronological order+ in the legacy recent API, project activity, folder previews and namespace+ listings. Kept title-sort and equal-timestamp path tie-breaks (#1247).++- Fixed `restore` replacing live data when a backup without `config.toml`+ contains API keys that the configured pepper cannot verify. It now refuses+ before the swap, preserving the live wiki, database and config, and names+ the original configuration as the remedy (#1495).++- Preserved explicit DOCX/PPTX line breaks and DOCX tabs in document imports+ when XML uses paired tags, including formatted PowerPoint breaks in slides+ and speaker notes. DOCX carriage returns now also keep adjacent text runs+ on separate lines instead of joining their words. Paragraph tab-stop+ definitions no longer insert spurious tabs into the extracted text (#1786).++- Kept a wiki-sync server page when its repository file was recreated after+ the sync planned a deletion. `sync --propagate-deletes --apply` now rechecks+ local absence before sending the delete, preserves the page's baseline and+ reports the changed file for the next sync, including with `--prefer repo`+ (#1787).+- Transcript imports (`backfill`, the `run` ledger, `recover`) now drop Codex+ memory-writing agent runs by the same signals the live hook uses: the+ checkout cwd, an event's recorded cwd, or a Codex user prompt that opens+ with `## Memory Writing Agent`. A custom `CODEX_HOME` whose last path+ component is not `.codex` previously reimported those sessions (#1790).+- Admission webhook HTTP requests now follow redirects only within the+ configured `scheme://host:port` origin (up to 10 hops) and fail on+ cross-origin redirects without forwarding page payloads or applying foreign+ response mutations, surfacing the redirect refusal cause in logs and+ `reject`-policy errors (#1794).+- `ai-memory project access` and `ai-memory project grants` now refuse empty+ or whitespace-only `--workspace`, `--project`, and (for access) `--mode`+ values before sending any request to the server. These commands take+ required names and never call `resolve_scope`, so the #1774 choke point+ did not cover them (#1791).+ - `ai-memory user grant` and `ai-memory user revoke` now refuse empty or+ whitespace-only `--user`, `--workspace`, `--project`, and (for grant)+ `--level` values before sending any request to the server. These commands+ take required names and never call `resolve_scope`, so the #1774 choke+ point did not cover them (#1792).- Refused empty and whitespace-only `--workspace` and `--project` flags at theshared CLI scope-resolution choke point (`resolve_scope`,`resolve_scope_noting_marker_project`, `resolve_scope_with_marker`, anddiff --cc crates/ai-memory-cli/src/commands/grant.rsindex 051a88f0,afe9cb05..d170233d--- a/crates/ai-memory-cli/src/commands/grant.rs+++ b/crates/ai-memory-cli/src/commands/grant.rs@@@ -276,38 -282,102 +285,130 @@@ mod tests);}}-+ fn grants_args() -> ProjectGrantsArgs {+ ProjectGrantsArgs {+ workspace: "default".into(),+ project: "app".into(),+ json: false,+ }+ }++ fn dead_ep() -> ServerEndpoint {+ ServerEndpoint::from_pair(Some("http://127.0.0.1:1".into()), None)+ }++ #[tokio::test]+ async fn an_empty_project_flag_is_refused_before_listing_grants() {+ let mut a = grants_args();+ a.project = " ".into();+ let error = list_for_project(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--project was passed empty"),+ "unexpected error: {error}"+ );+ }+ #[tokio::test]+ async fn an_empty_workspace_flag_is_refused_before_listing_grants() {+ let mut a = grants_args();+ a.workspace = "".into();+ let error = list_for_project(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--workspace was passed empty"),+ "unexpected error: {error}"+ );+ }+ fn grant_args() -> UserGrantArgs {+ UserGrantArgs {+ user: "ana".into(),+ workspace: "default".into(),+ project: "app".into(),+ level: "write".into(),+ }+ }++ fn revoke_args() -> UserRevokeArgs {+ UserRevokeArgs {+ user: "ana".into(),+ workspace: "default".into(),+ project: "app".into(),+ }+ }+- fn dead_ep() -> ServerEndpoint {- ServerEndpoint::from_pair(Some("http://127.0.0.1:1".into()), None)- }-+ #[tokio::test]+ async fn an_empty_user_flag_is_refused_before_granting() {+ let mut a = grant_args();+ a.user = " ".into();+ let error = super::grant(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--user was passed empty"),+ "unexpected error: {error}"+ );+ }++ #[tokio::test]+ async fn an_empty_workspace_flag_is_refused_before_granting() {+ let mut a = grant_args();+ a.workspace = "".into();+ let error = super::grant(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--workspace was passed empty"),+ "unexpected error: {error}"+ );+ }++ #[tokio::test]+ async fn an_empty_project_flag_is_refused_before_granting() {+ let mut a = grant_args();+ a.project = " ".into();+ let error = super::grant(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--project was passed empty"),+ "unexpected error: {error}"+ );+ }++ #[tokio::test]+ async fn an_empty_level_flag_is_refused_before_granting() {+ let mut a = grant_args();+ a.level = "".into();+ let error = super::grant(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--level was passed empty"),+ "unexpected error: {error}"+ );+ }++ #[tokio::test]+ async fn an_empty_user_flag_is_refused_before_revoking() {+ let mut a = revoke_args();+ a.user = " ".into();+ let error = super::revoke(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--user was passed empty"),+ "unexpected error: {error}"+ );+ }++ #[tokio::test]+ async fn an_empty_workspace_flag_is_refused_before_revoking() {+ let mut a = revoke_args();+ a.workspace = "".into();+ let error = super::revoke(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--workspace was passed empty"),+ "unexpected error: {error}"+ );+ }++ #[tokio::test]+ async fn an_empty_project_flag_is_refused_before_revoking() {+ let mut a = revoke_args();+ a.project = " ".into();+ let error = super::revoke(&dead_ep(), &a).await.unwrap_err();+ assert!(+ error.to_string().contains("--project was passed empty"),+ "unexpected error: {error}"+ );+ }}