Skip to content

gateway: expose fork/upstream identity metadata with override - #14025

Closed
DeanoC wants to merge 45 commits into
openclaw:mainfrom
DeanoC:feat/workitem-18a-gateway-identity
Closed

DeanoC wants to merge 45 commits into
openclaw:mainfrom
DeanoC:feat/workitem-18a-gateway-identity

Conversation

@DeanoC

@DeanoC DeanoC commented Feb 11, 2026 •

Copy link
Copy Markdown

Upstreaming DeanoC#15.

This adds a lightweight gateway identity signal in the WS hello payload (server.identity) and supports override mode for compatibility testing.

Fork PR: DeanoC#15

Included

  • hello-ok.server.identity = { kind, mode, source }
  • config/env override support for identity mode
  • schema/type updates
  • tests for default/config/env behavior
  • docs updates

Greptile Overview

Greptile Summary

This PR adds gateway “instance identity” metadata (hello-ok.server.identity {kind,mode,source}) with config + env overrides, and introduces node health snapshot/telemetry plumbing (new node.health.get method, node.health.frame event, in-memory node health frame store, periodic node health snapshot refresh/broadcast).

It touches the gateway WS handshake payload/schema, config schema/types/docs for the new identity override (gateway.identity.mode and OPENCLAW_GATEWAY_IDENTITY_MODE), and wires a new maintenance timer + close handler cleanup for node health broadcasting and node disconnect cleanup.

Confidence Score: 3/5

  • This PR is close to mergeable but has a couple of correctness/compatibility issues that should be addressed first.
  • Main functionality looks coherent and includes tests/docs, but (1) the protocol schema change introduces Type.Union in a place where repo guardrails disallow it and downstream schema consumers may break, and (2) the identity override is cached at WS handler attach time, so runtime overrides/hot reload won’t take effect as described without a restart.
  • src/gateway/protocol/schema/frames.ts, src/gateway/server/ws-connection/message-handler.ts

(5/5) You can turn off certain types of comments like style here!

Context used:

  • Context from dashboard - AGENTS.md (source)

DeanoC and others added 30 commits February 6, 2026 11:22
fix(cron): honor explicit delivery channel; don't fail run on unsupported
gateway: accept + broadcast node health frames (schema + in-memory store)
…dows-20260206

ci: fall back to github-hosted runners (avoid blacksmith queue stall)
Prefer provider-qualified model ids when deriving session default contextTokens to avoid stale/mismatched ctx reporting.
…r-qualified

Fix default context window lookup for gpt-5.2 (use provider-qualified id)
…60206

protocol: add node health frame schemas
DeanoC and others added 15 commits February 7, 2026 14:22
Gateway: advertise node.health.frame in hello-ok features
…-20260206

cron: don't advance overdue nextRunAtMs on reload
…02-06

docs: draft node auth + pairing protocol fields
…20260206

docs: document connect.auth vs device signature payload
docs(gateway): WS connect auth + pairing fields
sync: merge upstream/main (2026-02-07)
…260210

gateway: persist node.health.frame telemetry + add node.health.get
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling labels Feb 11, 2026
@DeanoC

DeanoC commented Feb 11, 2026

Copy link
Copy Markdown
Author

Superseded by a clean upstream branch/PR with the same feature and minimal diff: #14026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

43 files reviewed, 2 comments

Edit Code Review Agent Settings | Greptile

Comment on lines 78 to +96
host: Type.Optional(NonEmptyString),
connId: NonEmptyString,
identity: Type.Optional(
Type.Object(
{
kind: Type.Union([Type.Literal("upstream"), Type.Literal("fork")]),
mode: Type.Union([
Type.Literal("auto"),
Type.Literal("upstream"),
Type.Literal("fork"),
]),
source: Type.Union([
Type.Literal("default"),
Type.Literal("config"),
Type.Literal("env"),
]),
},
{ additionalProperties: false },
),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TypeBox union breaks schema guardrails

This adds Type.Union(...) for hello-ok.server.identity.*. The repo’s schema guardrails (AGENTS.md:171) explicitly forbid Type.Union/anyOf/oneOf in tool/protocol schemas because some validators/codegen reject them. This will fail in environments that enforce those guardrails and can break downstream schema consumers. Please rework these fields to avoid unions (e.g., use an enum helper / stringEnum pattern consistent with the rest of the schema layer).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/protocol/schema/frames.ts
Line: 78:96

Comment:
**TypeBox union breaks schema guardrails**

This adds `Type.Union(...)` for `hello-ok.server.identity.*`. The repo’s schema guardrails (AGENTS.md:171) explicitly forbid `Type.Union`/`anyOf`/`oneOf` in tool/protocol schemas because some validators/codegen reject them. This will fail in environments that enforce those guardrails and can break downstream schema consumers. Please rework these fields to avoid unions (e.g., use an enum helper / stringEnum pattern consistent with the rest of the schema layer).

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines 194 to 197

const configSnapshot = loadConfig();
const gatewayIdentity = resolveGatewayInstanceIdentity({ cfg: configSnapshot, env: process.env });
const trustedProxies = configSnapshot.gateway?.trustedProxies ?? [];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Identity cached per connection

gatewayIdentity is resolved once when the message handler is attached, so changing gateway.identity.mode via hot reload (or setting OPENCLAW_GATEWAY_IDENTITY_MODE) won’t be reflected in hello-ok for new handshakes on existing server process until a full restart. If the intent is runtime override/compat testing without restart (as docs imply), identity should be resolved at handshake time (or tied into the config reload path).

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/gateway/server/ws-connection/message-handler.ts
Line: 194:197

Comment:
**Identity cached per connection**

`gatewayIdentity` is resolved once when the message handler is attached, so changing `gateway.identity.mode` via hot reload (or setting `OPENCLAW_GATEWAY_IDENTITY_MODE`) won’t be reflected in `hello-ok` for new handshakes on existing server process until a full restart. If the intent is runtime override/compat testing without restart (as docs imply), identity should be resolved at handshake time (or tied into the config reload path).

How can I resolve this? If you propose a fix, please make it concise.

@DeanoC DeanoC closed this Feb 11, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f5a594e71b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

status: "ok",
summary,
outputText,
deliveryResult: { status: "ok" },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Report failed best-effort deliveries in deliveryResult

When delivery.bestEffort is enabled and outbound delivery fails (for example, deliverOutboundPayloads throws on provider/API errors or announce flow fails), this function logs the error but still returns deliveryResult: { status: "ok" }. In those scenarios the message was not delivered, so returning ok can mislead schedulers/UI into treating delivery as successful and skipping retries or operator alerts.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes docs Improvements or additions to documentation gateway Gateway runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant