Repository navigation
fix(diagnostics-prometheus): send Content-Length on metrics HEAD responses - #120212
Conversation
c341c6a to
9f0436e
Compare
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed August 8, 2026, 7:39 PM ET / 23:39 UTC. ClawSweeper reviewWhat this changesThe PR adds a byte-accurate Content-Length header to the Prometheus metrics endpoint so HEAD returns the same representation length as GET without returning metrics bytes. Merge readinessKeep open: current main still omits Content-Length on the Prometheus HEAD response, and this active, assigned PR supplies the narrow plugin-owned repair with suitable loopback proof and no blocking review finding. Priority: P2 Review scores
Verification
How this fits togetherThe diagnostics-prometheus plugin converts OpenClaw diagnostic events into Prometheus text and serves it at an authenticated gateway HTTP route. Monitoring probes use GET or HEAD on that route, then consume the response body or its metadata. flowchart LR
A[Diagnostic events] --> B[Prometheus metric store]
B --> C[Metrics HTTP route]
C --> D{Request method}
D -->|GET| E[Metrics body and headers]
D -->|HEAD| F[Matching headers and empty body]
E --> G[Monitoring client]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +1, Tests +53. Total +54 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the plugin-local header calculation after exact-head merge and CI confirmation, retaining GET bytes and the empty HEAD body. Do we have a high-confidence way to reproduce the issue? Yes. A loopback Node HTTP server around the real registered handler can reproduce the current-main asymmetry: GET has a body-derived length while HEAD ends without that header. Is this the best way to solve the issue? Yes. Computing the length once from the already-rendered representation at the plugin handler is narrower and safer than altering gateway-wide framing behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2bc314475c7c. 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)
|
Punchcard-Session: ember-willow-timber-gk Co-authored-by: zenglingbiao <[email protected]>
afea681 to
d5338b6
Compare
|
@clawsweeper re-review |
|
🦞👀 Command router queued. I will update this comment with the next step. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
ClawSweeper rank-up moves are resolved for exact head
No ClawSweeper finding or repair remains. |
|
Merged via squash.
|
Punchcard-Session: amber-workshop-workshop-36 * origin/main: (28 commits) perf(doctor): keep bundled doctor contract closures dependency-light (#120698) fix(elevenlabs): preserve repeated committed speech segments (#120792) fix(ai): fence Responses replay metadata (#120777) fix(ai): invalidate stale compaction replay (#120786) fix(telegram): clean up every failed webhook startup phase (#120788) fix(codex): preserve configured MCP tools in scheduled turns (#120366) fix(ui): show dev checkout commit lag in Updates (#120769) fix(agents): repair XML-polluted tool names (#113814) fix(discord): remove only the bot own reactions (#120785) fix(macos): complete ChatGPT subscription setup (#120782) fix(plugins): surface safe administrator install warnings (#120783) fix(release): keep upgrade survivor sessions fresh (#120778) fix(providers): preserve realtime tool-result delivery ownership (#120776) fix(plugins): retain incognito scope for embedded session ownership (#120215) fix(elevenlabs): surface realtime provider error events (#120772) fix(agents): preserve exact steering delivery ownership (#120770) fix(telegram): prevent session-count routing slowdown (#120774) fix(agents): preserve authoritative background process outcomes (#120754) test(process): make Linux adapter wiring portable (#120741) fix(diagnostics-prometheus): send Content-Length on metrics HEAD responses (#120212) ...
…onses (openclaw#120212) * fix(diagnostics-prometheus): send Content-Length on metrics HEAD responses * fix(diagnostics-prometheus): harden HEAD metadata proof Punchcard-Session: ember-willow-timber-gk Co-authored-by: zenglingbiao <[email protected]> --------- Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes an issue where
HEAD /api/diagnostics/prometheusomitted the representation length even though the equivalentGETreturned a fully rendered metrics body.HTTP permits
Content-Lengthon a HEAD response. When present, its value must match the octet count that the corresponding GET response would send.Why This Change Was Made
The metrics handler already materializes the canonical Prometheus text before it branches on the request method. It now records
Buffer.byteLength(body)once for both GET and HEAD, while preserving the existing empty HEAD body.The regression uses the existing diagnostics listener to record a real non-empty metric, then serves the real handler over a loopback HTTP server. It verifies:
Content-Length.Content-Length.No auth, routing, cache, content type, config, SDK, or plugin contract changes.
User Impact
Monitoring clients that probe the Prometheus endpoint with HEAD now receive accurate representation metadata without downloading the metrics body. GET behavior and body bytes are unchanged.
Evidence
2972bytes withContent-Length: 2972; HEAD returned noContent-Lengthand zero body bytes.Content-Length: 2972; HEAD returned zero body bytes.git diff --check: passed.ddb4fcc2877d57503214f57c71423a951bef4419: complete, high confidence, no actionable P0/P1 findings, no rank-up moves.Production delta: +1 line. Test delta: +53 lines.
Punchcard-Session: ember-willow-timber-gk