Skip to content

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

Rust

fix(workstream): fail closed on unresolved checkout paths

AkitaOnRailsc1fd731d8ff5
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ce568cfa..7e60f857 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -24,6 +24,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
capture remains unsupported until its command-input payload is documented
and can be fixture-tested (#355).
+### Fixed
+- Native-session checkout matching now fails closed when either path cannot be
+ canonicalized, instead of treating two missing or inaccessible paths as the
+ same checkout during managed resume or adoption (#356).
+
## [1.23.0] - 2026-08-03
### Changed
diff --git a/crates/ai-memory-workstream/src/transcript.rs b/crates/ai-memory-workstream/src/transcript.rs
index 0ff9f787..ff8ff100 100644
--- a/crates/ai-memory-workstream/src/transcript.rs
+++ b/crates/ai-memory-workstream/src/transcript.rs
@@ -2418,7 +2418,10 @@ fn valid_native_session_id(value: &str) -> bool {
}
fn same_path(left: &Path, right: &Path) -> bool {
- left.canonicalize().ok() == right.canonicalize().ok()
+ match (left.canonicalize(), right.canonicalize()) {
+ (Ok(left), Ok(right)) => left == right,
+ _ => false,
+ }
}
fn deduplicate_losses(losses: Vec<String>) -> Vec<String> {
@@ -2435,6 +2438,20 @@ fn deduplicate_losses(losses: Vec<String>) -> Vec<String> {
mod tests {
use super::*;
+ #[test]
+ fn checkout_path_comparison_fails_closed_when_canonicalization_fails() {
+ let temp = tempfile::tempdir().unwrap();
+ let existing = temp.path().join("existing");
+ fs::create_dir(&existing).unwrap();
+
+ assert!(same_path(&existing, &existing));
+ assert!(!same_path(&existing, &temp.path().join("missing")));
+ assert!(!same_path(
+ &temp.path().join("missing-left"),
+ &temp.path().join("missing-right")
+ ));
+ }
+
#[tokio::test]
async fn jsonl_candidate_discovery_covers_every_file_adapter_and_checkout_scope() {
let temp = tempfile::tempdir().unwrap();
@@ -2664,20 +2681,22 @@ mod tests {
#[test]
fn omp_adapter_reads_complete_atomic_write_temp_transcript() {
let temp = tempfile::tempdir().unwrap();
+ let cwd = temp.path().join("repo");
+ fs::create_dir(&cwd).unwrap();
let session = "019f80c5-0148-7000-82d5-9a3c4c9b9be3";
let path = temp
.path()
.join(format!(".session_{session}.jsonl.nonce.tmp"));
std::fs::write(
&path,
- format!("{{\"type\":\"session\",\"id\":\"{session}\",\"cwd\":\"/repo\"}}\n"),
+ format!("{}\n", json!({"type":"session","id":session,"cwd":cwd})),
)
.unwrap();
let found = locate_session_file(
ManagedHarness::Omp,
temp.path(),
- Path::new("/repo"),
+ &cwd,
Some(temp.path()),
session,
)
diff --git a/docs/mcp-install.md b/docs/mcp-install.md
index 756f3431..fd80216c 100644
--- a/docs/mcp-install.md
+++ b/docs/mcp-install.md
@@ -795,8 +795,10 @@ same pattern as Gemini CLI.
## Kiro CLI
-**Status:** MCP and v2 lifecycle hooks supported. Managed workstreams are
-tracked separately.
+**Status:** MCP, v2 lifecycle hooks, and explicit v2 managed workstreams are
+supported. Bare automatic workstream selection remains unsupported pending a
+logged-in current-format v2 acceptance run. V3 hooks and managed sessions need
+their own documented, fixture-tested payload and store contracts.
**Config file:** `$KIRO_HOME/settings/mcp.json`, defaulting to
`~/.kiro/settings/mcp.json`. Use `--config-file .kiro/settings/mcp.json` when
@@ -850,8 +852,11 @@ agents, so `--config-file` is required when the active definition lives under
through `agentSpawn` stdout, and honors `$KIRO_HOME`. Kiro v3 hook capture is
not installed because its registration migration guide does not document the
command-input payload needed to validate capture and exclusion behavior. Follow
-[#356](https://github.com/akitaonrails/ai-memory/issues/356) for managed
-workstreams.
+[#355](https://github.com/akitaonrails/ai-memory/issues/355) for v3 hook support
+and [#356](https://github.com/akitaonrails/ai-memory/issues/356) for automatic
+selection and broader version-aware managed support. Explicit
+`ai-memory run kiro` (alias `kiro-cli`) manages the default v2 engine;
+non-v2 engine selections pass through without session injection or import.
Sources: <https://kiro.dev/docs/cli/mcp/configuration/>,
<https://kiro.dev/docs/cli/reference/settings/>,