Skip to content

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

Rust

fix(store): name the separate arguments when a project carries a workspace

AkitaOnRails7e1b50f39d21
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1b9fcf5a..75ac4618 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
+- Fixed an explicit-scope miss giving no hint when an agent passed a
+ `workspace/project` label as the project (for example `project:
+ "myorg/myproject"` with the default workspace): project names never contain
+ `/`, so the error now names the separate `workspace` and `project` arguments
+ to pass. (#1152)
- Fixed the cross-project profile rewriting a settled entry whenever new
evidence merely agreed with it: a statement now changes only when the ruling
or its scope does (the LLM merge reports `changed`), so the line every project
diff --git a/crates/ai-memory-store/src/scope.rs b/crates/ai-memory-store/src/scope.rs
index 2214e610..0ad8f38e 100644
--- a/crates/ai-memory-store/src/scope.rs
+++ b/crates/ai-memory-store/src/scope.rs
@@ -257,7 +257,21 @@ impl fmt::Display for ScopeResolutionError {
write!(
f,
"project '{project}' not found in workspace '{workspace}'"
- )
+ )?;
+ // A project name never contains '/', so this is a
+ // `workspace/project` label passed as the project (#1152).
+ if let Some((ws, proj)) = project.split_once('/')
+ && !ws.is_empty()
+ && !proj.is_empty()
+ && !proj.contains('/')
+ {
+ write!(
+ f,
+ "; project names never contain '/': pass workspace \"{ws}\" and \
+ project \"{proj}\" as separate arguments"
+ )?;
+ }
+ Ok(())
}
ScopeResolutionError::ProjectNameAmbiguous { workspace, project } => {
write!(
@@ -1236,6 +1250,27 @@ mod tests {
use crate::{AccessMode, GrantLevel};
+ /// A `workspace/project` label passed as the project names the split
+ /// (#1152); an ordinary miss keeps the plain message.
+ #[test]
+ fn a_slashed_project_name_points_at_the_separate_arguments() {
+ let glued = ScopeResolutionError::ProjectNotFoundInWorkspace {
+ workspace: "default".into(),
+ project: "myorg/myproject".into(),
+ }
+ .to_string();
+ assert!(
+ glued.contains("pass workspace \"myorg\" and project \"myproject\""),
+ "{glued}"
+ );
+ let plain = ScopeResolutionError::ProjectNotFoundInWorkspace {
+ workspace: "default".into(),
+ project: "ghost".into(),
+ }
+ .to_string();
+ assert_eq!(plain, "project 'ghost' not found in workspace 'default'");
+ }
+
async fn user_named(store: &Store, username: &str, byte: u8) -> UserId {
store
.writer