Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
TypeScript ai-agentcoding-agentdesktop-appelectronglobali18nlocal-firstmcppipi-agentpi-desktoppluginsreactrusttypescript
fix(tools): document legacy terminal newline behavior
vastsa3c2017543312
diff --git a/crates/host-core/src/tools/mod.rs b/crates/host-core/src/tools/mod.rsindex ffbaa39b2..41dd50ad1 100644--- a/crates/host-core/src/tools/mod.rs+++ b/crates/host-core/src/tools/mod.rs@@ -4942,6 +4942,25 @@ mod tests {assert_eq!(std::fs::read(&target).unwrap(), input.as_bytes());}+ #[tokio::test]+ async fn edit_legacy_terminal_newline_only_change_reports_no_change() {+ let dir = tempfile::tempdir().unwrap();+ let target = dir.path().join("legacy.txt");+ let input = "keep\n";+ std::fs::write(&target, input).unwrap();+ let result = execute_tool(+ Some(dir.path()),+ None,+ "Edit",+ &json!({"path": "legacy.txt", "old_string": "\n", "new_string": ""}),+ 5_000,+ )+ .await;+ assert!(!result.ok);+ assert_eq!(result.error_code.as_deref(), Some("EDIT_NO_CHANGE"));+ assert_eq!(std::fs::read(&target).unwrap(), input.as_bytes());+ }+#[tokio::test]async fn read_missing_file_reports_file_not_found() {let dir = tempfile::tempdir().unwrap();diff --git a/docs/spec/03-runtime/18-line-anchored-edit-contract.md b/docs/spec/03-runtime/18-line-anchored-edit-contract.mdindex 177acb090..33c0f7def 100644--- a/docs/spec/03-runtime/18-line-anchored-edit-contract.md+++ b/docs/spec/03-runtime/18-line-anchored-edit-contract.md@@ -545,7 +545,9 @@ first line and after the match on its last line is kept. The substring resultis lowered to one line-anchored op over only the lines that change and appliedagainst the live tag, so line-ending and BOM preservation and the provenancecheck behave as for any other `Edit`. A replacement identical to `old_string`-fails with `EDIT_NO_CHANGE`.+fails with `EDIT_NO_CHANGE`. A replacement whose only effect would be toggling+the file's terminal newline also fails with `EDIT_NO_CHANGE`, because line-+anchored operations preserve that newline state.`MUTATION_RETRY_BUDGET_EXHAUSTED` is not in this table because it is not an`Edit` result: the tool call already failed with one of the codes above, and thediff --git a/docs/spec/06-delivery/04-e2e-test-plan.md b/docs/spec/06-delivery/04-e2e-test-plan.mdindex 5e64dab12..738b8523c 100644--- a/docs/spec/06-delivery/04-e2e-test-plan.md+++ b/docs/spec/06-delivery/04-e2e-test-plan.md@@ -11256,13 +11256,15 @@ This test plan spec is accepted when:end, the whole-line deletion removes that line without leaving a blank line ortouching its neighbours, and the CRLF file keeps CRLF endings. The missing`old_string` fails with `EDIT_LEGACY_MATCH_FAILED` and leaves the file- unchanged.+ unchanged. A replacement whose only effect would be toggling the terminal+ newline fails with `EDIT_NO_CHANGE` and leaves the file unchanged.- **Specs linked**: `03-runtime/18-line-anchored-edit-contract.md` §11- **Acceptance**: E (tools & permissions)- **Milestone**: M5+- **Status**: Automated (host-core unit tests:`edit_legacy_replacement_preserves_unmatched_bytes`,`edit_legacy_identical_replacement_leaves_file_unchanged`,+ `edit_legacy_terminal_newline_only_change_reports_no_change`,`edit_accepts_legacy_old_string_new_string_shape`)#### E2E-142: Background delegation converges through TaskWait and honors permission scopes