diff --git a/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.i18n.yaml b/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.i18n.yaml index 4d6e577790..ad1015da2e 100644 --- a/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.i18n.yaml +++ b/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.i18n.yaml @@ -2,5 +2,5 @@ # side as of the last confirmed-consistent state. Both languages carry equal authority; # after editing either side, bring the other along and re-record with: # pnpm run verify-translation-pairing --write .agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md -2026-07-31-code-runtime-python-settlement-fixes.md: 6a3b484a27906df2e9fd92785bb9b767d889b165 -2026-07-31-code-runtime-python-settlement-fixes.zh.md: 1c6223195308d764d3fa51f63d34e36873d49548 +2026-07-31-code-runtime-python-settlement-fixes.md: 62342c5ca6cd0d7454c122416b5176bd623c4063 +2026-07-31-code-runtime-python-settlement-fixes.zh.md: d8c48459b61890d856bc960bb935788a422e7188 diff --git a/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md b/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md index 6a3b484a27..62342c5ca6 100644 --- a/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md +++ b/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.md @@ -12,6 +12,10 @@ The CPython subprocess backend for Code Mode, built on the [fd-3 frame protocol] Independent corrections, each in the package that owns the defect. +### The unknown-binding preview is escaped from a 1 KiB prefix + +The unknown-binding reply built its message with `JSON.stringify` over the WHOLE capped target (`global` + `.` + `name`, each up to `maxValueBytes` code units) — the escaped form could reach ~6x the input under control-heavy fields, a multi-hundred-MB spike near the `maxValueBytes` ceiling that no hostile-peer bound would have admitted. The preview is now escaped from a 1 KiB prefix of the target (enough to identify the binding); `capMessage` still enforces the reply budget. + ### A merged open-log entry is billed once, split across its fragments An explicit `flush()` of an unterminated line emits a `log` frame with `open: true`, and the host appends the next frame to the SAME entry (`print('a', end='', flush=True); print('b')` reads back as one `'ab'` entry, not a fake newline). The split-billing arithmetic — first fragment pays quotes+content+separator, continuations and the closing frame pay content only, host caps `logBudget - 1`/`logBudget + 2`, the sub-2-byte walk guard, the child's `_open_started` keying — is stated once, in the [fd-3 protocol note's wire-contract section](../architecture/2026-07-31-code-runtime-python-fd3-protocol.md). diff --git a/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.zh.md b/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.zh.md index 1c62231953..d8c48459b6 100644 --- a/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.zh.md +++ b/.agents/notes/implemented/bug-fix/2026-07-31-code-runtime-python-settlement-fixes.zh.md @@ -12,6 +12,10 @@ Status: implemented 若干处相互独立的修正,各自位于拥有对应缺陷的包中。 +### unknown-binding 预览从 1 KiB 前缀转义 + +unknown-binding 回复用 `JSON.stringify` 对完整的限幅 target(`global` 加 `.` 加 `name`,各最多 `maxValueBytes` 个 code unit)构造消息——在控制字符密集字段下转义形式可达输入的约 6 倍,在 `maxValueBytes` 上限附近产生数亿字节峰值,这是任何敌意对等方边界都不会放行的。预览现在从 target 的 1 KiB 前缀转义(足以辨识 binding);`capMessage` 仍执行回复预算。 + ### 合并的 open 日志条目只计费一次,按片段分摊 未结束行的显式 `flush()` 发出带 `open: true` 的 `log` 帧,宿主把下一个帧追加到同一条目(`print('a', end='', flush=True); print('b')` 读回为一条 `'ab'` 条目而不是假换行)。拆分计费算术——首片段付引号加内容加分隔符、续接与闭合帧只付内容、宿主 cap `logBudget - 1`/`logBudget + 2`、低于 2 字节的 walk guard、子进程的 `_open_started` 键控——只登记一次,见 [fd-3 协议 note 的 wire-contract 段](../architecture/2026-07-31-code-runtime-python-fd3-protocol.zh.md)。