Skip to content

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

Rust

fix(bootstrap): tolerate a chunk that returns no pages (#614)

Pedro4e4cdaab2a28
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 758850e4..c0e61b97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
+- `bootstrap` no longer aborts the whole multi-chunk run when one chunk
+ returns no `pages` key (#614). Later chunks are told which paths
+ earlier ones wrote, so a model that judges the material already
+ covered legitimately answers with a rationale and no pages; because
+ Anthropic's `tool_use` schema does not enforce required fields the way
+ OpenAI's `strict: true` does, that answer reached serde and failed
+ deserialisation with `missing field 'pages'`. Since pages are only
+ written after every chunk completes, the error discarded the work of
+ all preceding chunks. `pages` now defaults to empty.
- `install-hooks --agent antigravity-cli` on native Windows now emits
an unquoted hook `command` (#611). The native-binary rendering wrapped
the executable, `--data-dir`, and `--server-url` in double quotes, but
diff --git a/crates/ai-memory-consolidate/src/bootstrap.rs b/crates/ai-memory-consolidate/src/bootstrap.rs
index 4ea6f999..8580695b 100644
--- a/crates/ai-memory-consolidate/src/bootstrap.rs
+++ b/crates/ai-memory-consolidate/src/bootstrap.rs
@@ -160,6 +160,15 @@ pub struct BootstrapPage {
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
pub struct BootstrapBatch {
/// Pages to create.
+ ///
+ /// Defaulted because a chunk legitimately has nothing to add: later
+ /// chunks receive the paths earlier ones already wrote, so a model
+ /// that judges the material covered answers with a rationale and no
+ /// `pages` key. Anthropic's `tool_use` schema does not enforce
+ /// required fields the way OpenAI's `strict: true` does, so that
+ /// answer reaches serde — and without a default it aborts the whole
+ /// multi-chunk run, discarding every page the earlier chunks paid for.
+ #[serde(default)]
pub pages: Vec<BootstrapPage>,
/// Brief one-paragraph note about what was processed, surfaced
/// in the wiki/bootstrap.md manifest + the auto-commit message.
@@ -1556,6 +1565,16 @@ mod tests {
assert_eq!(dropped, 27_872);
}
+ #[test]
+ fn batch_without_pages_key_deserialises_as_empty() {
+ let batch: BootstrapBatch =
+ serde_json::from_str(r#"{"rationale":"already covered by earlier chunks"}"#)
+ .expect("a chunk that adds no pages must not fail the whole run");
+
+ assert!(batch.pages.is_empty());
+ assert_eq!(batch.rationale, "already covered by earlier chunks");
+ }
+
#[test]
fn duplicate_page_paths_keep_first_page() {
let mut pages = std::collections::BTreeMap::new();