Skip to content

fix(gateway): return consistent unavailable response guidance - #191933

Merged
vincentkoc merged 2 commits into
mainfrom
fix/gateway-unavailable-responses-20261103
Nov 27, 2026
Merged

vincentkoc merged 2 commits into
mainfrom
fix/gateway-unavailable-responses-20261103

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Related: #191925

What Problem This Solves

Clients receive inconsistent recovery guidance when the Gateway is starting, paused, restarting, or unavailable during a WebSocket upgrade.

User Impact

Unavailable probe and WebSocket responses now include retry guidance and avoid caching. Rejected HTTP work describes the actual pause, restart, or shutdown state, while retaining its existing status and error schema. Unknown outages are not labeled upgrades.

Why This Change Was Made

Reuse the admission owner's existing message and preserve each transport's response format. No lifecycle protocol, configuration, or authentication changes.

Work from Vincent Koc.

Evidence

  • Native pinned formatting and git diff --check passed.
  • Fresh local autoreview of the final candidate against 2ac42c830f3eb28206f6570bf821b481ab02d3fa found no actionable P0–P2 issues; independent source/contract review also found none.
  • Added assertions in the existing probe and real socket suites for retry/cache headers, GET/HEAD parity, pause/restart/stop wording, and rejection delivery on reused connections.
  • Both touched HTTP suites passed all 33 cases on the exact head: 18 probe cases and 15 real-socket rejection cases (Bun job).
  • On the original head, changed lint, production types and test types passed. The test-line check failed as described below.
  • A base-side regression replay was not run: local dependencies were unqualified and the native remote wrapper rejected a mismatched tooling dependency.

Current test-line budget

The earlier ratchet job reported a failing test-lines step. Replayed the current scripts/check-test-lines-ratchet.mts in staged mode against the clean merge tree of this head and main at 1f3262a9e4dc. It passed with 46 net added test lines, a 400-line allowance, and 46 lines of allocation credit. The original hosted result remains red. Historical ratchet job

November 27 integration

Signed 0f45de9a incorporates main 33fa6a84. The five source and test files match the clean integration preview. The current regression-test allowance covers all 46 net added test lines, so this revision removes the obsolete allocation. The native ratchet passed with 400 allowed lines and zero allocation credit. Source syntax and patch checks passed. The 33 HTTP cases above are results for the previous revision. Current-head hosted qualification is pending.

@vincentkoc vincentkoc self-assigned this Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@vincentkoc
vincentkoc marked this pull request as ready for review November 3, 2026 13:33
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: S labels Nov 3, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 3, 2026
@clawsweeper

clawsweeper Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds retry and cache guidance to unavailable responses and reuses admission-state messages for rejected HTTP work.

Example: POST /v1/chat/completions while the Gateway is paused

  • Before: HTTP 503 says the Gateway is unavailable while suspending or restarting.
  • After: HTTP 503 says “Gateway is temporarily paused. Please try again shortly.”

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) A focused, source-supported correction with useful handler and real-socket coverage; confidence remains bounded by harness-only evidence and unresolved CI attribution.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its supplied evidence exercises real Gateway handlers and socket transports in tests, with no claimed shipped-entry-point demonstration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Clients receive inconsistent retry guidance and imprecise explanations when Gateway work is unavailable.
Reason: The maintainer-authored direction is explicit, the endpoint defect is source-confirmed, and this PR appropriately leaves the umbrella issue's UI and ingress work to separate changes.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a useful, focused correction that current main still needs; no introduced code defect was found, but the CI gate remains failed.

Priority: P2
Reviewed head: 03d50371a9622c6c0f861eebfb63d1e1f769acd7

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: The supplied validation is handler/socket test coverage rather than a shipped-Gateway run, and the PR explicitly reports that no base-side regression replay was performed.
Agent review details

How this fits together

Gateway HTTP routing receives probes, API requests, and WebSocket upgrades; existing readiness and admission owners determine availability, and transport helpers emit the rejection responses.

flowchart TD
  A[Client request] --> B[Gateway routing]
  B --> C[Readiness probes]
  B --> D[Work admission]
  B --> E[WebSocket upgrades]
  C --> F[HTTP response]
  D --> F
  E --> F
Loading

Technical review

Best possible solution:

Retain this narrow response correction using existing admission and transport owners, preserving authentication, status codes, schemas, and socket delivery.

Do we have a high-confidence way to reproduce the issue?

Source confirms missing retry headers on probe 503 responses, missing retry/cache headers on upgrade rejections, and generic HTTP admission wording on current main; no target code was executed.

Is this the best way to solve the issue?

The patch is the smallest complete endpoint correction: it adds headers at existing response boundaries and consumes the established admission message without introducing state, wrappers, or another policy owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against b640d4b95c1b.

Provenance checked

  • HTTP admission rejection keeps the original intent (35d6077: Centralize rejection and admission at the Gateway boundary while preserving plugin matching, authentication, and tracked work ownership.)
  • WebSocket exception rejection keeps the original intent (b827d20: Deliver a complete HTTP 503 before closing when an upgrade fails before socket ownership transfers.)
  • Existing probe and transport tests keeps the original intent (test(core): remove low-value tests (batch d171) #174237: Consolidate repetitive fixtures while preserving distinct lifecycle and transport contracts; this PR extends retained suites instead of recreating parallel scaffolding.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit 35d6077 adds src/gateway/server/http-work-admission.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 35d6077db8c2; files: src/gateway/server/http-work-admission.ts)

PR surface

Source +10, Tests +46, Other +1. Total +57 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 3 13 3 +10
Tests 2 50 4 +46
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 1 0 +1
Total 6 64 7 +57

Root-cause cluster

Relationship: partial_overlap
Canonical: #191925
Summary: This PR implements the endpoint-response portion of the broader downtime-guidance issue.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Unavailable-response guidance is a bounded improvement to recoverable downtime, with no demonstrated loss of messages or core availability.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Determine the baseline-ratchet failure's cause from its complete log and resolve any failure attributable to this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed November 3, 2026, 9:00 AM ET / 14:00 UTC.

@vincentkoc
vincentkoc merged commit 454adee into main Nov 27, 2026
121 of 122 checks passed
@vincentkoc
vincentkoc deleted the fix/gateway-unavailable-responses-20261103 branch November 27, 2026 07:39
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
…restoration-ci-189390-20261127

* commit '6feeb50a3f14fbf0aa5167d342f186dc4d67fc18': (9846 commits)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  fix(agents): skip the bootstrap ritual in one-shot runs (#206477)
  fix(test): preserve stack coordinates in redacted failure reports (#152384)
  fix(gateway): return consistent unavailable response guidance (#191933)
  fix: preserve emphasis in Markdown table row labels (#205349)
  fix(nextcloud-talk): keep webhook spool helpers private (#206470)
  perf(plugins): overlay native receipts once per visible root (#206464)
  fix: keep GitHub comment approvals alive and skip repeat approval on the session PR (#206129)
  perf(config): retain one snapshot for unchanged validation results (#206465)
  refactor(test): reuse canonical secret fixture cleanup (#189492)
  refactor(subagents): own descendant Stop cancellation (#206444)
  refactor(subagents): keep announce cleanup action type private (#206407)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant