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(providers): format the header fold and take decision D621
vastsa21af7d60f58e
diff --git a/crates/host-core/src/providers/credentials.rs b/crates/host-core/src/providers/credentials.rsindex 3a41951c6..9bff92dee 100644--- a/crates/host-core/src/providers/credentials.rs+++ b/crates/host-core/src/providers/credentials.rs@@ -67,7 +67,10 @@ pub(crate) fn retain_storable_headers(payload: &mut serde_json::Value) {if storable.is_empty() {object.remove("headers");} else {- object.insert("headers".into(), serde_json::to_value(storable).unwrap_or_default());+ object.insert(+ "headers".into(),+ serde_json::to_value(storable).unwrap_or_default(),+ );}}/// Set or clear optional headers. An empty map clears them and drops leftover `userAgent`.diff --git a/crates/host-core/src/providers/tests.rs b/crates/host-core/src/providers/tests.rsindex 44fbdda30..8d05ea680 100644--- a/crates/host-core/src/providers/tests.rs+++ b/crates/host-core/src/providers/tests.rs@@ -1436,7 +1436,9 @@ fn header_values_fold_fullwidth_and_reject_non_latin1() {// A control character is the same class of failure — it never reaches a// header either — so it is named too.- let err = normalize_one_header("X-Title", "ab\u{0}cd").unwrap_err().to_string();+ let err = normalize_one_header("X-Title", "ab\u{0}cd")+ .unwrap_err()+ .to_string();assert!(err.contains("U+0000 at character index 2"), "{err}");// A character above U+00FF is the fault wherever it sits, and the reported@@ -1472,7 +1474,9 @@ fn header_values_fold_fullwidth_and_reject_non_latin1() {// (4096 bytes, `MAX_HEADER_VALUE_BYTES`) becomes storable — the one input// class this change newly accepts.let long_fullwidth = "\u{FF41}".repeat(4096);- assert!(normalize_one_header("X-Title", &long_fullwidth).unwrap().is_some());+ assert!(normalize_one_header("X-Title", &long_fullwidth)+ .unwrap()+ .is_some());let long_ascii = "a".repeat(4097);let err = normalize_one_header("X-Title", &long_ascii).unwrap_err()@@ -1543,7 +1547,13 @@ fn provider_api_keys_fold_fullwidth_on_write_and_read() {);// The settings save path folds on write too.- set_provider_secret(&db, &secrets, &provider.id, Some("\u{FF53}\u{FF4B}-\u{FF11}")).unwrap();+ set_provider_secret(+ &db,+ &secrets,+ &provider.id,+ Some("\u{FF53}\u{FF4B}-\u{FF11}"),+ )+ .unwrap();assert_eq!(get_secret_for_provider(&db, &secrets, &provider.id).unwrap()diff --git a/crates/host-core/src/providers/validation.rs b/crates/host-core/src/providers/validation.rsindex ac2c64482..13172497f 100644--- a/crates/host-core/src/providers/validation.rs+++ b/crates/host-core/src/providers/validation.rs@@ -148,7 +148,7 @@ pub(crate) fn normalize_headers_input(/// when reading a stored map, exposed for data the user did not type here. A/// bundle written by a peer on an older build, or a backup taken before this/// rule existed, can hold a value this build refuses; dropping the row keeps-/// the rest of the revision applying instead of failing it whole (D619).+/// the rest of the revision applying instead of failing it whole (D621).pub(crate) fn storable_headers(raw: &BTreeMap<String, String>) -> BTreeMap<String, String> {let mut by_lower: BTreeMap<String, (String, String)> = BTreeMap::new();for (key, value) in raw {@@ -159,10 +159,7 @@ pub(crate) fn storable_headers(raw: &BTreeMap<String, String>) -> BTreeMap<Strin);}}- by_lower- .into_values()- .take(MAX_HEADERS)- .collect()+ by_lower.into_values().take(MAX_HEADERS).collect()}pub(crate) fn normalize_thinking_levels(levels: &[String]) -> Vec<String> {diff --git a/docs/adr/0178-per-provider-custom-headers.md b/docs/adr/0178-per-provider-custom-headers.mdindex c534b372c..820e1d2b3 100644--- a/docs/adr/0178-per-provider-custom-headers.md+++ b/docs/adr/0178-per-provider-custom-headers.md@@ -49,7 +49,7 @@ optional `headers` map in `config_json.headers`.ByteString` mid-turn. The interactive write refuses those with the characterand its index named; the read path and an incoming sync bundle fold and dropthem, so a store or a peer that predates the rule cannot fail a turn or a- whole revision. See D619.+ whole revision. See D621.- Not a secret. No SQLite or host-protocol version bump.- UI is an explicit Advanced settings button in the upper-right dialog actions(named, custom, and vendor account) that opens a separate compact modal. Thediff --git a/docs/spec/08-meta/decisions-log.md b/docs/spec/08-meta/decisions-log.mdindex 537b8289f..d539f62a5 100644--- a/docs/spec/08-meta/decisions-log.md+++ b/docs/spec/08-meta/decisions-log.md@@ -6947,7 +6947,7 @@ must keep splitting are covered by `markdown-blocks.test.mjs`.`Glob`, `Bash`, plugin and MCP names keep the spelling we register, and thesummarized text changes only where pi consumes the name.-## 2026-09-22 — Provider header values fold fullwidth input instead of failing the turn (D619)+## 2026-09-22 — Provider header values fold fullwidth input instead of failing the turn (D621)- A custom provider header value holding a fullwidth character — `0` (U+FF10)is what an IME or a fullwidth-formatted page gives for `0` — reacheddiff --git a/docs/zh-CN/spec/08-meta/decisions-log.md b/docs/zh-CN/spec/08-meta/decisions-log.mdindex 3fa7846ee..7ceb18b1f 100644--- a/docs/zh-CN/spec/08-meta/decisions-log.md+++ b/docs/zh-CN/spec/08-meta/decisions-log.md@@ -4916,7 +4916,7 @@ Markdown 源码,不是 `text/html` 负载;对禁用行内 HTML 的外部编- 只转换这三个名字。pi 的收集器不读其它名字,因此 `Grep`、`Glob`、`Bash`、插件与 MCP 名字保持我们注册的拼写,被摘要的文本只在 pi 真正消费该名字的地方发生变化。-## 2026-09-22 —— 供应商请求头里的全角字符改为折成半角,而不是让回合失败(D619)+## 2026-09-22 —— 供应商请求头里的全角字符改为折成半角,而不是让回合失败(D621)- 自定义供应商请求头的值里带一个全角字符——输入法或全角排版的网页会把 `0` 打成 `0`(U+FF10)——这个值进到 `Headers.set` 后让 undici 抛 `TypeError: Cannot convert