Skip to content

fix(runtime): keep response decode failures out of startup retries - #7003

Open
hhyykk wants to merge 1 commit into
loopx-project:mainfrom
hhyykk:codex/architecture-payoff-round7-20261021
Open

hhyykk wants to merge 1 commit into
loopx-project:mainfrom
hhyykk:codex/architecture-payoff-round7-20261021

Conversation

@hhyykk

@hhyykk hhyykk commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

After a TypeScript effect has been dispatched, a Python JSON decoder failure must preserve uncertainty about the write. Excessive response nesting raised RecursionError, which fell into the pre-send RuntimeError startup retry path: an actual TCP reproduction dispatched the same request twice and then reported runtime_request_failed. Invalid UTF-8 in an inline response escaped the typed recovery contract too.

Keep ValueError and RecursionError behind the existing runtime_response_ambiguous contract for inline and private-file responses. Existing domain callers can then expose their original operation ID and receipt recovery. Request/response budgets, authentication, provider decisions and receipt/CAS rules remain unchanged.

Validation:

  • 198 focused Python tests passed. The new real-TCP regression matrix fails 3 cases on unchanged main and passes all 4 after repair; its existing-safe private-file UTF-8 case remains a control.
  • Real File and SQLite Todo creation, with the native response corrupted only after commit: excessive nesting, invalid UTF-8 and an integer above Python's decoding limit. Each request dispatches once, reports todo_create_response_ambiguous with the original operation ID, and recovers through the public CLI with one Todo and an unchanged provider revision. All 6 cases passed from source and again from independently installed wheel and sdist: 18 cases total. Installed runs used empty working directories, isolated runtimes and verified package/native source paths.
  • Python 3.11 TCP decoder probes passed for both transports; the main test and installed matrices used Python 3.13. Node 24.21.0 supplied the qualified SQLite runtime. Distribution source bytes and archive hygiene, Ruff, bilingual RFC checks and diff hygiene passed.

Performance evidence is mixed and retained for owner review. A matched complete SQLite todo list command used fresh Python processes, warm disposable managed runtimes and prepared bytecode. Initial 15-sample paired p50/p95: 285.9/300.1 ms → 280.0/318.9 ms. The p95 increase is 18.8 ms / 6.3%, exceeding the RFC's 5% threshold. A fixed, counterbalanced A/A/B control then ran 30 samples per arm: identical-main A/A p95 349.2/310.5 ms, candidate 315.5 ms (1.6% / 5.0 ms above the faster control). This demonstrates tail variability; it does not erase the original miss or waive its owner-review gate. No speedup or general performance qualification is claimed.

Migration economics: this is a shared transport correctness repair, not a new language cutover. TypeScript retains all domain/transaction ownership; Python retains response IO/decoding. Existing transport product diff is +3/−2 LOC (net +1); there is no new bridge module, RPC, facade, cache, schema or provider change, and no claimed retirement of domain rules. The two existing decode paths now use the same failure contract. The shared production-scale/promotion fixtures are unchanged. Paired RFC text records this behavior.

Overlap check: latest main 973914e8cb713ee176737c95750aedb3072b9ea8; 50 open PR heads and 844 changed-file rows checked. #6892 changes locator recovery and #6874 adds a snapshot-method allowlist entry in the same production file; neither changes these decode hunks. This is independent of the earlier CLI dispatch, request-scope, quota-source and recovery-fixture PRs.

Not run: PostgreSQL integration, live Agent-host adoption, the full repository suite or sustained-load qualification. No provider implementation changed. The proposal remains subject to normal review and the performance owner-review gate; no merge or deployment is included.

Signed-off-by: aihop <4408344+hhyykk@users.noreply.github.com>

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent | gpt-6.1-sol | OpenAI | runtime_reported | reasoning_effort=max

APPROVE — 共享响应解码正确性修复有真实提交/恢复证据;原性能 owner-review 门及预算集成红灯保持。

动机

通过 Python CLI 调用 TypeScript 持久事务的用户和 Agent。
事务提交后若响应嵌套过深,原路径把 RecursionError 当作启动失败并重复派发;无效 UTF-8 也会逃出既有不明确结果合同。现在两类传输统一保留原操作身份和不明确结果。
损坏响应后每个 mutation 只派发一次,调用方返回原 operation ID,能够按原回执恢复且只保留一个 Todo。
不迁移领域 authority、不改 provider/CAS/预算或 schema,不认证持续负载、全部平台、真实 Host 采用或完整性能推广资格。

原有性能审查和真实宿主的持续资格仍未完成。

改动思路

仅在现有 Python IO/JSON adapter 纠正异常分类,事务与回执仍由原 TypeScript owner 负责;无需新抽象或第二套领域规则。
本 PR 提供完整的提交后解码正确性修复和源码/独立安装恢复证据;性能推广、真实 Host 采用及原集成门分别保留。
ValueError 已涵盖 JSONDecodeError、UnicodeDecodeError 和整数转换限制;RecursionError 必须单独在解码处转为已有不明确结果。接收/认证/请求大小、私有文件摘要与权限校验、领域 receipt/CAS 规则均未改变。不能把已提交但无法读取响应改称“未提交”,也不能通过启动重试消除这种不确定性。

具体改动

精确 head 591deece594c85978f3f0ee54555724ef044d166;实际不可变基线 973914e8cb713ee176737c95750aedb3072b9ea8。在读 diff 前固定的规格为 docs/architecture/rfcs/typescript-control-plane-migration-v0.md,spec_revision 973914e8cb713ee176737c95750aedb3072b9ea8。C6-no-duplicate-effect implemented;C6-caller-recovery implemented;C6-packaged-probe implemented;C6-performance-promotion deferred。

关键代码讲解

  1. _request_with_info:发送请求并读取同一TCP响应。 解码ValueError/RecursionError转为既有不明确结果。
  2. _read_local_snapshot_response:核验私有快照后解码响应。 保留UID/mode/大小/hash校验,并补RecursionError分类。
  3. effect_runtime_request:区分启动前失败和发送后不明确结果。 原已有ambiguity分支直接上抛;本修复使decoder进入它。

两处异常列表共+3/-2产品行,净+1;不增加bridge、RPC、facade、cache或provider。新91行测试使用真实TCP,分别覆盖内联/私有文件的过深嵌套与无效UTF-8。独立测试记录实际请求数而不改原断言:相同夹具基线3败1过,深度两路各派发2次;新头4过、各派发1次。私有文件UTF-8原本安全的控制保持。删除原IndexError分支合理:bytes.split(...)[0]始终至少有一个元素。

对主干的风险

独立的实际消费者检查没有用mock提供提交结果:公开CLI调用真实TS Todo handler,File/SQLite先提交,私有TCP代理仅在响应返回时注入深度、UTF-8或整数超限;客户端按原operation ID报告todo_create_response_ambiguous,再经公开todo receipt和相同意图恢复。源码、wheel、sdist各6例均通过,始终一个Todo、mutation一次、提交后的provider revision不变。两个包在全新非editable环境、空cwd、无PYTHONPATH运行;1697个Python/TS产品文件与head一致。唯一未安装TS是既有无产品调用的私有测试driver,按原package-data边界排除,未把首次过宽包清单断言当产品缺陷。165项相邻Python、标准6direct+15selected、Ruff/编译/双语均过;预算完整失败与基线相同。性能原始超标及后续A/A/B只作为原作者披露,原owner-review门继续有效,未独立认证性能。

我的整体评价

原有性能审查和真实宿主的持续资格仍未完成。 由既有性能/发布owner在原PR处理原始超标与推广判断;保留原控制,不重写历史失败。 共享transport正确性修复可独立回滚和验证,不要求引入无关迁移、provider或新框架。

完整正确性切片已建立,long_horizon=preserved,user_experience=improved,仅指调用方能够保留并恢复原不明确提交。交付判断为 justified_increment:剩余性能推广/真实Host证据由既有owner继续,不新造任务或降低原门。Python只保留IO解码,TS仍拥有事务,+1产品行与风险相称;不据此宣布完整迁移或长期净益。
原作者15样本 p95 +18.8ms/+6.3%超标仍是性能 owner-review 门;后续A/A/B波动不是历史通过,本轮未独立复现或豁免。根预算147/145在基线/新头同1败5过,完整失败签名及147根模块blob、测试、pin一致,作为独立集成阻塞保留。未查CI、未认证PG、Windows、真实Host或持续负载;没有merge/升级授权。

English verdict: APPROVE — exact head 591deece594c85978f3f0ee54555724ef044d166. Both transports preserve post-send ambiguity and the original operation identity after decoding failures. Real TCP checks show depth-related dispatches fall from two to one; 165 focused tests and 18 actual File/SQLite commit-and-recovery cases across source, wheel and sdist pass. The unchanged 147/145 integration failure and original +6.3% p95 owner-review gate remain. This review grants no merge, promotion or installed-Host qualification.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants