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>

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.

1 participant