Repository navigation
[gateway] expose fork/upstream identity metadata with override - #15
Merged
Merged
Conversation
This was referenced Feb 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements work item 18a (minimal first slice): expose a lightweight fork/upstream identity signal in gateway metadata, with config/env override for compatibility testing.
What changed
Gateway metadata identity payload
server.identitytohello-okpayload (WS connect response):kind:"fork" | "upstream"mode:"auto" | "fork" | "upstream"(effective mode)source:"default" | "config" | "env"(where mode came from)src/gateway/server/ws-connection/message-handler.ts.HelloOkSchema) insrc/gateway/protocol/schema/frames.ts.Override options (config + env)
gateway.identity.mode: "auto" | "upstream" | "fork"OPENCLAW_GATEWAY_IDENTITY_MODE=auto|upstream|forkauto)autoresolves to build default (fork in this distribution)src/gateway/instance-identity.tsTests
src/gateway/instance-identity.test.tshello-okidentity presenceDocs
docs/gateway/configuration.md— documentedgateway.identity.mode+ env overridedocs/gateway/protocol.md— documentedhello-ok.server.identitydocs/gateway/ws-connection-auth.md— updatedhello-okexampledocs/gateway/index.md— noted identity metadata inhello-okBackward compatibility
server.identityis optional in schema and response payload.Verification
Ran locally:
pnpm exec oxfmt --check src/gateway/instance-identity.ts src/gateway/instance-identity.test.ts src/gateway/server/ws-connection/message-handler.ts src/gateway/protocol/schema/frames.ts src/config/types.gateway.ts src/config/zod-schema.ts src/config/schema.ts src/gateway/server.auth.e2e.test.ts docs/gateway/configuration.md docs/gateway/protocol.md docs/gateway/ws-connection-auth.md docs/gateway/index.mdpnpm exec oxlint --type-aware src/gateway/instance-identity.ts src/gateway/instance-identity.test.ts src/gateway/server/ws-connection/message-handler.ts src/config/types.gateway.ts src/config/zod-schema.ts src/gateway/protocol/schema/frames.ts src/gateway/server.auth.e2e.test.ts src/config/schema.tspnpm exec vitest run src/gateway/instance-identity.test.tspnpm exec vitest run src/gateway/client.test.tspnpm exec vitest run --config vitest.e2e.config.ts --globals src/gateway/server.auth.e2e.test.ts -t "hello-ok identity"pnpm exec vitest run --config vitest.e2e.config.ts --globals src/gateway/server.auth.e2e.test.ts -t "hello-ok payload"Results: