Repository navigation
fix(gateway): reject blank session history keys - #85261
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 5, 2026, 3:33 AM ET / 07:33 UTC. ClawSweeper reviewWhat this changesThe PR makes the Gateway session-history endpoint reject blank or malformed encoded session keys with HTTP 400 instead of allowing them to continue through later routing. Merge readinessNo actionable finding: current main still lets a blank encoded session-history key fall through after the route was admitted, while this exact-head patch returns the endpoint-owned 400 and preserves valid-key handling. Priority: P2 Review scores
Verification
How this fits togetherGateway HTTP routing admits session-history paths before plugin and Control UI routing. The endpoint parser decides whether to serve history, return an invalid-request response, or leave a genuine route miss for later handlers. flowchart LR
A[HTTP request] --> B[Gateway route admission]
B --> C[Session-history parser]
C --> D{Path result}
D -->|Route miss| E[Later plugin or UI routing]
D -->|Invalid key| F[Owned HTTP 400]
D -->|Valid key| G[Session history response]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +11, Tests +18. Total +29 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Merge this exact head once the normal required CI and native merge gates complete successfully. Do we have a high-confidence way to reproduce the issue? Yes. Current main maps a decoded blank key to the same null sentinel as a route miss, and the supplied exact-head loopback Gateway proof exercises both blank and malformed encoded keys. Is this the best way to solve the issue? Yes. The three-state parse result repairs the fault at the endpoint owner boundary, mirrors the sibling session-kill contract, and leaves valid-key authorization and history behavior intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3faa2b088823. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (10 earlier review cycles; latest 8 shown)
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
Heads up: this PR needs to be updated against current |
|
This pull request has been automatically marked as stale due to inactivity. |
Preserve append-only text, fail impossible rewritten streams after usage resolves, and keep required client-tool output buffered until validation. Refs: #85261 Co-authored-by: Achyut Mukund <[email protected]>
…#115799) Preserve append-only text, fail impossible rewritten streams after usage resolves, and keep required client-tool output buffered until validation. Refs: openclaw#85261 Co-authored-by: Achyut Mukund <[email protected]>
|
@clawsweeper re-review The maintainer rewrite is now at exact signed head |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review Exact head
|
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
Co-authored-by: Achyut Mukund <[email protected]> Punchcard-Session: clear-orchard-lantern-bc
|
ClawSweeper rank-up disposition: no separate repair job is required because the exact review found no actionable findings. The branch is now rebased directly onto current main as |
|
@clawsweeper re-review |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(gateway): reject blank session history keys This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Merged via squash.
|
Punchcard-Session: clear-orchard-lantern-bc Co-authored-by: Vincent Koc <[email protected]>
What Problem This Solves
Fixes an issue where a blank encoded session-history key such as
%20matched the core route but was treated as a route miss, allowing the request to fall through to plugin, Control UI, or generic 404 routing instead of returning the endpoint's owned 400 response.Malformed percent encoding such as
%zzalready returned 400; the regression proof keeps that behavior covered alongside the repaired blank-key case.Why This Change Was Made
The session-history route parser now returns a tagged three-state result for route miss, invalid key, and valid key. This matches the adjacent session-kill route contract and removes the hidden
null/empty-string sentinel pair that caused the shipped fallthrough.The rewrite keeps parsing at the owning route boundary and leaves valid-key auth, canonical session lookup, transcript reads, pagination, SSE, plugin routing, and Control UI behavior unchanged.
User Impact
Blank session-history keys now receive a clear HTTP 400
invalid session keyresponse. They no longer escape into unrelated fallback routing. Valid session history requests are unchanged.The bug originated with the direct session-history endpoint in #50101 and is present in stable
v2026.6.11andv2026.7.2-beta.7.Evidence
Validated commit:
2b17804fbd537b75d850bbdd16e146be4bc700a7Stable patch ID:
9b37ea9d8aae7cf31acccbed47f9f817c7c91368. The signed commit is rebased directly onto current main3faa2b08882319e7eec039eabd21abf7d021b243and remains patch-identical to the clean P1 autoreview candidated1899a6cd63bac4b43fa86f26a152d02ded33297and prior reviewed head467e479798f23d6582d9128a553e50ab52ea51e4.Failure-first proof on untouched current
main:Real listening-Gateway proof after the repair:
Focused and sibling coverage:
src/gateway/sessions-history-http.test.ts: 73 passedsrc/gateway/session-kill-http.test.ts: 13 passedStatic and changed-surface proof:
oxfmt --check: passedoxlint: 0 warnings, 0 errorsgit diff --check: passednode scripts/check-changed.mjs -- src/gateway/sessions-history-http.ts src/gateway/sessions-history-http.test.ts: passed with exit 0 on Blacksmith TestboxThe backing Actions job shows
Run Testboxcancelled because the successful one-shot wrapper stopped its externally owned lease; the wrapper reportedexitCode: 0andrunStatus: succeeded.P1 autoreview on the patch-identical candidate returned no findings with 0.98 confidence. Independent owner-path and history reviews also found no blocking issue.
Production delta:
+18/-7(net+11) for the explicit owner-boundary state contract.Regression delta:
+18for real listening-Gateway coverage.No config, protocol, auth, persistence, migration, or public API changes.
Punchcard-Session: clear-orchard-lantern-bc