Repository navigation
fix(gateway): preserve static HEAD representation metadata - #117049
Conversation
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 5:46 PM ET / 21:46 UTC. ClawSweeper reviewWhat this changesThe PR preserves the pinned static file size through Control UI representation selection so static HEAD responses report the selected identity, gzip, or Brotli representation’s Content-Length. Merge readinessThis is a focused, correct-looking gateway fix with credible after-fix loopback TCP evidence for identity, gzip, and Brotli static assets. It remains open only for the protected Priority: P2 Review scores
Verification
How this fits togetherThe gateway serves Control UI static assets from a safely opened file descriptor, optionally selects a precompressed sidecar, then emits headers and either a body for GET or an empty response for HEAD. This change carries descriptor metadata from safe opening to the static HEAD response without changing dynamic HTML handling. flowchart LR
Client[HTTP client] --> Request[Control UI asset request]
Request --> SafeOpen[Safe file open and descriptor stat]
SafeOpen --> Select[Select identity or compressed representation]
Select --> Head[Static HEAD response]
Select --> Get[Static GET response]
Head --> Headers[Representation headers and length]
Get --> Body[Selected asset bytes]
Decision needed
Why: The patch has no supported correctness finding and the supplied real behavior proof covers the claimed static representations, but the Before merge
Agent review detailsSecurityNone. PR surfaceSource +4, Tests +32. Total +36 across 3 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the descriptor-metadata propagation after protected maintainer review confirms the clean merge result still sets Content-Length only for selected static representations and preserves dynamic HTML HEAD’s no-generation path. Do we have a high-confidence way to reproduce the issue? Yes—current main is source-reproducible: the selected static representation retains only its path and descriptor, then the HEAD branch ends the response without any Content-Length source. Direct execution was not run in this read-only checkout because its dependency installation is absent, while the PR supplies matching before/after loopback TCP output. Is this the best way to solve the issue? Yes—the patch repairs the owner boundary by carrying the already-pinned descriptor size rather than reopening or restatting files, and it deliberately leaves dynamic HTML HEAD responses on their existing no-body path. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 383363e36233. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
…odels-20260729 * origin/main: fix(tui): canonical terminal outcomes, cancellation, and error privacy (#117044) fix(cron): avoid phantom message tool guidance (#116908) fix(test): avoid macOS release gate deadlocks (#116972) fix(openai): canonical Chat cache-hit and billing accounting (#117043) fix(memory-wiki): salvage human Notes before pruning imported source pages (#102294) fix(memory): suggest reindex, not --fix, for a missing qmd index (#116958) chore(msteams): add private Gateway QA adapter fix(ui): make session controls and failures accessible (#117019) docs: fix tilde paths in CLI output examples (#114595) fix(plugins): canonical discovery diagnostics and deterministic lifecycles (#117025) fix(ui): honor Gateway readiness abort and subscription ownership (#117048) fix(updater): harden launchd replacement timing (#117030) fix(gateway): preserve static asset HEAD representation metadata (#117049) fix(gateway): abort embeddings when clients disconnect (#116146) fix(googlechat): retain fallback thread continuity (#117053)
…nclaw#117049) Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Control UI static assets returned correct representation bytes for
GET, but theirHEADresponses omittedContent-Length. This affected the uncompressed asset and both precompressed Brotli/gzip sidecars, so clients probing the selected representation could not discover its actual size.Why This Change Was Made
The existing safe-open owner already captures the authoritative pinned descriptor stat. Preserve that size through canonical representation selection and let the existing static-response owner emit the exact selected descriptor size for
HEAD. Dynamic HTML remains deliberately untouched: its response is rewritten or compressed, andHEADmust not start reading or generating a body merely to manufacture a length.User Impact
HEADresponses now report the same representation length as the equivalentGETfor identity, gzip, and Brotli.Content-Encoding, cache headers, and emptyHEADbodies stay correct.HEADretains its existing no-body/no-content-generation fast path.Evidence
Exact root cause and dependency contracts
src/gateway/control-ui.tsdiscardedopened.stat.sizeeven though installed@openclaw/fs-safeobtains that stat directly from the opened descriptor (node_modules/@openclaw/fs-safe/dist/root-file.js:48andnode_modules/@openclaw/fs-safe/dist/pinned-open.js:37). Node's HTTP implementation suppressesHEADbodies and cannot infer the representation length; the installedsendimplementation explicitly setsContent-Lengthbefore ending aHEADresponse (node_modules/send/index.js:582).Real production route and TCP, before/after
On exact base
e4568f6bdddfc38d0f8dfe8cd22bde155adac5dd, actual loopback TCP requests throughhandleControlUiHttpRequestobserved:{"encoding":"identity","getLength":"19","headLength":null,"getEncoding":null,"headEncoding":null} {"encoding":"gzip","getLength":"39","headLength":null,"getEncoding":"gzip","headEncoding":"gzip"} {"encoding":"br","getLength":"23","headLength":null,"getEncoding":"br","headEncoding":"br"}Exact immutable candidate
e58b1861129d1fe7fe03aa97d8188ae46986bc8d:{"encoding":"identity","getLength":"19","headLength":"19","getEncoding":null,"headEncoding":null} {"encoding":"gzip","getLength":"39","headLength":"39","getEncoding":"gzip","headEncoding":"gzip"} {"encoding":"br","getLength":"23","headLength":"23","getEncoding":"br","headEncoding":"br"} {"route":"dynamic-index","headLength":null,"empty":true}node scripts/run-vitest.mjs src/gateway/control-ui.http.test.ts --project gateway-core— 119 passed, 0 failed.node scripts/run-oxlint.mjs ... --tsconfig config/tsconfig/oxlint.core.json, targetedoxfmt --check, andgit diff --check: all passed.autoreview --mode branch --base e4568f6bdddfc38d0f8dfe8cd22bde155adac5dd --max-priority P3: zero P0/P1/P2/P3 findings, verdict “patch is correct”, confidence 0.97.