Repository navigation
refactor(http): share bounded response byte consumption - #140654
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 7, 2026, 7:52 AM ET / 11:52 UTC. ClawSweeper reviewWhat this changesShares HTTP response byte accounting across core, AI transports, memory-host, and Dashboard readers while retaining their existing decoding, timeout, and cancellation behavior. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this remains a useful consolidation, with no actionable introduced defect found. The previous migration-proof blocker is unsupported because the diff changes only transient response consumption. Priority: P3 Review scores
Verification
How this fits togetherHTTP response readers turn incoming response streams into bounded diagnostic snippets, JSON, or browser text. Shared byte accounting enforces their limits while each caller controls decoding, errors, and reader cleanup. flowchart TD
A[HTTP response stream] --> B[Caller headers and deadlines]
B --> C[Shared byte accounting]
C --> D{Byte limit reached}
D -->|No| E[Caller text or JSON decoding]
D -->|Yes| F[Caller cancellation and limit handling]
F --> G[Bounded snippet or size error]
E --> H[Decoded response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -36, Tests +26. Total -10 across 7 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep byte accounting shared while preserving caller-owned decoding, deadlines, errors, and cancellation lifetimes. Do we have a high-confidence way to reproduce the issue? Not applicable: this refactor addresses duplicated implementation rather than a reported runtime failure; no target code was executed during review. Is this the best way to solve the issue? Yes: sharing the byte loop while leaving different decoder and lifecycle policies with their callers is a bounded consolidation of the existing implementation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ff599bc8f736. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
c14ddfa to
67ec11a
Compare
Preserve caller byte caps, decoder modes, abort errors, and cancellation lifetimes. Keep distinct operation and per-read timeout policies. Proof: focused response and Dashboard suites (103 tests), changed checks, and 1232 differential reader cases passed.
67ec11a to
8b1054c
Compare
|
Merged via squash.
|
* commit 'b07b7d8bd1293c4e70ece7281b9cb8422318ae5a': (30 commits) fix(ui): keep reopened select menus visible (#141047) test(ui): fix dashboard gallery client fixtures (#141203) refactor(links): remove unused understanding results (#141200) refactor(plugins): share manifest contribution projection (#141193) refactor(logging): share portable redaction pattern mechanics (#140742) chore(ui): refresh control ui locales (#141208) refactor(minimax): reuse generated video asset downloader (#141094) fix(test): await Telegram loopback prompt reception (#141204) refactor(acp): remove unused in-memory event ledger (#141145) improve(models): reduce overhead in catalog discovery (#141154) refactor(channels): share approval reaction settlement (#140645) chore(i18n): refresh native locales (#141089) refactor: share one-shot tickets and WebSocket helpers across desktop, node, and browser streams (#141185) refactor(google-meet): share browser open and recovery setup (#140972) refactor(plugins): share npm version queries (#141166) refactor(http): share bounded response byte consumption (#140654) refactor(whatsapp): share prompt selection (#141195) fix: bound temporary storage for terminal upload batches (#141116) perf(markdown): reuse image parser configuration (#141126) fix(policy): align tool requirements with core vocabulary (#140628) ...
What Problem This Solves
Bounded HTTP response readers in core, AI transports, the memory host, and the Dashboard repeat their chunk loop and byte accounting. Fixes to exact-byte limits can drift between these paths.
Why This Change Was Made
A browser-safe
consumeResponseBytesleaf in@openclaw/normalization-coreowns the shared loop, retained byte prefix, and limit notification. Callers keep their decoding, header validation, timeout and abort errors, cancellation lifetime, and reader cleanup. Memory JSON and snippet reads also share their existing reader adapter.The core operation timer and AI per-read timer remain separate: they have different clamping, refresh, error, and cancellation contracts. Core/memory snippets still discard partial UTF-8; AI still emits the decoder replacement character; memory JSON still uses fatal UTF-8 decoding. Dashboard streaming decoding and its empty-chunk accounting are retained.
Related: #109245. That open PR correctly bounds the body-less error-snippet path by changing its fallback to empty text. This consolidation builds around it and does not duplicate that policy change. Inspected #136508 and #137230 too; those concern inbound Slack/Feishu request admission and do not overlap this response-reader change.
User Impact
None intended. Existing exported reader names and caller behavior are preserved. No configuration, dependency, schema, or protocol change.
Evidence
Fresh validation at
8b1054c820bebec32381a78515aba973e25722b6, rebased onto maine9a2a0298557451d28704b900bf3c4dfb0a4a99d.git range-diffconfirms an identical patch; concurrent AI transport changes and the node-host umask correction (#140771) are retained.node scripts/run-vitest.mjs src/infra/http-body.response.test.ts src/infra/http-error-body.test.ts packages/memory-host-sdk/src/host/response-snippet.test.ts ui/src/lib/response-body.test.ts ui/src/app/browser-bootstrap.test.ts ui/src/pages/chat/realtime-talk-webrtc-support.test.ts: 6 files, 103 tests passed.node scripts/check-changed.mjs: passed, including core/test/UI types, lint, dead-export scans and ratchets. No baseline change.pnpm build: passed in 7m 15.6s, including package and SDK declarations, plugin builds, runtime closure checks, and Dashboard assets/performance budgets.The former Workshop geometry CI failures are historical; this revision is being verified on current main. The ClawSweeper migration-proof checklist is inapplicable: only transient HTTP body consumption changes, with no schema or persistent-store semantics. No existing public export was removed or renamed. No live external-provider test is required for the unchanged transport policy; proof is at the response-reader/caller boundary.