Skip to content

feat(gateway): advertise chat input custody contract - #180651

Merged
RomneyDa merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-conversation-acceptance-contract
Nov 2, 2026
Merged

RomneyDa merged 1 commit into
openclaw:mainfrom
bkudiess:bkudiess-conversation-acceptance-contract

Conversation

@bkudiess

@bkudiess bkudiess commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Independently versioned chat clients cannot discover the existing queue-mode and exact input-receipt contract without guessing from a protocol version or an unrelated capability.

This is an additive compatibility-contract feature, not a fix for a demonstrated data-loss or model-steering bug. The regression below proves missing discovery before the change and correct advertisement afterward; it does not prove that the marker itself repairs queue execution.

User Impact

Clients can check hello-ok.features.capabilities for chat-input-custody-v1 before offering the existing chat.send.queueMode and chat.history.inputRunIds / inputReceipts contract. If absent, support is unknown and the client retains its existing send behavior.

The marker is not permission, active-backend injection availability, acknowledgment-as-consumption, or permanent exactly-once delivery. Requested scopes are not increased. No new RPC, protocol version, queue policy, backend, migration, bundled UI or consumer implementation is added.

Why This Change Was Made

The existing server capability registry and hello owner are the discovery boundary. One constant and one hello-array entry expose the transport contract; the owner regression also checks unchanged read-only scopes. The handshake documentation explains pending versus consumed receipts, bounded idempotency, and retention of uncertain input.

At upstream main 6c672d42f2dec42b7917f34dfe5ae8157b9b0abb (2026-10-29), both the capability registry and hello response still omit this marker. The existing chat-send-routing-contract is not this input-custody discovery contract. No current-main code was substituted for the tested historical base.

Evidence

Exact source and before/after regression

Ready for review, not merge-approved. Head remains 9c51b90ab5677c9fbae03a8a403d66d4df581c5b, tree 4558ea5743235ed344de40d93145675eeb107fcd; parent/tested production base is 776c8da8f06c6ed244b8ce22ea33165e4463f23b. No code changed or runtime was restarted for this description refresh.

The same advertises input custody without changing negotiated scopes regression and command were used on both sides. Test-file SHA256 was 0FC3C374ABE9B8DE48513DE1492330E1E36A7A5FBAF0E822161542C281C5ACFC in both runs and matches the committed head.

node scripts\run-vitest.mjs run src\gateway\server\ws-connection\connect-hello.update-scope.test.ts --maxWorkers=1 --testNamePattern "advertises input custody without changing negotiated scopes" --reporter=default --reporter="$HOOK_REPORTER"

$HOOK_REPORTER represents the same passive hook-timestamp reporter's private filesystem path, omitted from this public description; it changes no assertions.

Source under test Observed result
Base 776c8da8 production plus only the identical new test Expected RED: exit 1, 1 failed / 47 skipped. The assertion at test line 205 reports capabilities missing chat-input-custody-v1; not a setup failure.
Base plus the exact four-file bytes later committed as 9c51b90a GREEN: exit 0, 1 passed / 47 skipped. Capability is present and auth.scopes remains ["operator.read"]. This run preceded the commit; the recorded file hashes match the committed bytes.

Supporting validation at the fixed revision

Recorded command / boundary Result and limit
node scripts\run-vitest.mjs run src\gateway\server\ws-connection\connect-hello.update-scope.test.ts packages\gateway-protocol\src\schema\logs-chat.test.ts --maxWorkers=1 PASS: 48 hello-owner + 7 schema tests.
node scripts\run-tsgo.mjs -p test\tsconfig\tsconfig.core.test.gateway-server.json --noEmit --incremental --tsBuildInfoFile "$TASK_CACHE\marker-types.tsbuildinfo" PASS: owning Gateway-server test types; task cache path redacted.
node scripts\run-oxlint.mjs --tsconfig tsconfig.json packages\gateway-protocol\src\server-capabilities.ts src\gateway\server\ws-connection\connect-hello.ts src\gateway\server\ws-connection\connect-hello.update-scope.test.ts PASS: zero lint warnings/errors.
pnpm exec oxfmt --check packages\gateway-protocol\src\server-capabilities.ts src\gateway\server\ws-connection\connect-hello.ts src\gateway\server\ws-connection\connect-hello.update-scope.test.ts docs\gateway\protocol\handshake.md PASS.
pnpm run build ciArtifacts PASS: recorded Windows frozen-source build and subsequent Linux exact-head build.
Real built Gateway at exact 9c51b90a, unsigned token-authenticated test/backend client (2026-10-26) PASS: marker advertised, effective scopes empty, protected users.self rejected with FORBIDDEN / MISSING_SCOPE. This tests advertisement and the unchanged authorization boundary only.
Separate fresh live-05 at exact 9c51b90a (2026-10-29) Bounded PASS, independently reviewed: four immutable attachment-only chat.send cases passed hello/self/model, ack/matching final/history/provider and stored-byte length/SHA256 checks after verified quiescence. Input sizes: 3, 131, 2 and 68 bytes. This is supplementary actual behavior, not proof of backend steering or the marker's causal effect on storage.

Live-05 used only task-owned resources and a synthetic loopback provider, with the original native request bytes preserved except five routing identities. All owned processes are gone and its one-use permission is revoked. Public-safe frozen proof digests: terminal 56C4FE039ECEDDA8597F2BFD7E742865DDB9E24053DCDE193AF5C009AD6ADA9E, aggregate 4649B8E9BF754CCD19423ADB4ADBC0FF4374EDE232D3EC460F803C38D20786B6, independent postcheck A98115F9A1A1A881655B3D6622E4639D69EAAA5C45AA29B4830142EEC16E8D56. No private logs, credentials or machine dumps are attached.

Remaining limits and merge blockers: no current-main integration/rebase execution, Windows UI/adopting-consumer proof, or live backend injection/exactly-once guarantee is claimed. Earlier deferred-custody attempts timed out or failed setup and remain failures; live-01 through live-04 remain BLOCKED, not retroactively upgraded. Live-05 does not replace those deferred-custody tests. The observed legacy openclaw/security-sensitive-review and aggregate status still require a maintainer's exact-head approval; normal CI successes do not replace that approval. A maintainer must also accept this stable transport-discovery contract. No merge, release or CI rerun is requested here.

Actual real-Gateway terminal output — exact PR head

The probe started the built production CLI with fresh isolated state and a task-generated token, waited for readiness, and made real WebSocket requests. The following is captured output, not a constructed response; only selected wire fields are retained to omit credentials and volatile connection identities.

=== PR180651 REAL GATEWAY HELLO PROOF ===
Captured UTC: 2026-10-26T17:06:18.683Z
Source SHA: 9c51b90ab5677c9fbae03a8a403d66d4df581c5b
Source tree: 4558ea5743235ed344de40d93145675eeb107fcd
Tracked source: clean before Gateway launch
Node: v24.22.1; platform: linux/x64
Entry point: node openclaw.mjs gateway run --bind loopback --port <ephemeral>
Setup: fresh isolated state; token auth; unsigned test/backend client (not the first-party gateway-client); requested operator.read; no model or provider invoked.
Selected actual wire response fields (volatile identities and credentials omitted):
{
  "type": "res",
  "id": "proof-connect",
  "ok": true,
  "payload": {
    "type": "hello-ok",
    "protocol": 4,
    "server": {
      "version": "2026.10.5"
    },
    "features": {
      "capabilities": [
        "agent-session-id-create-v1",
        "system.run.execution-context.v1",
        "board-widget-put-canvas-doc",
        "chat-input-custody-v1",
        "chat-send-routing-contract",
        "gateway-restart-target-safe-v1",
        "local-state-owner-routing-v1",
        "models-auth-set-api-key-owner-v1",
        "models-auth-login-owner-v1",
        "channels-pairing-list-owner-v1",
        "channels-pairing-approve-owner-v1",
        "exec-approvals-get-owner-v1",
        "exec-approvals-set-owner-v1",
        "exec-approvals-native-commit-v1",
        "worktrees-remove-owner-v1",
        "worktrees-restore-owner-v1",
        "worktrees-gc-owner-v1",
        "worktrees-recover-removal-owner-v1",
        "worktrees-retire-snapshot-owner-v1",
        "model-catalog-snapshot",
        "node-worker-device-folders-v1",
        "node-permission-errors",
        "node-worker-bundle-retention-v1",
        "node-worker-bundle-status-v1",
        "node-worker-captured-exec-policy",
        "node-worker-workspace-quiescence-v1",
        "node-worker-environment-session-v1",
        "node-worker-host-diagnostics-v1",
        "node-worker-idle-retention-v1",
        "node-worker-launch-tool-names-v1",
        "node-worker-native-inference-v1",
        "node-worker-portal-stream-v1",
        "node-worker-prompt-context-v1",
        "node-worker-status-wait-v1",
        "profile-binding-v1",
        "published-model-catalog",
        "progress-card-agent-scope-v1",
        "session-scoped-chat-metadata",
        "session-scoped-model-catalog",
        "session-unread-ack-contract",
        "session-goal-start-v1",
        "session-settings-contract",
        "session-settings-cas-v1",
        "sender-restricted-hidden-helpers-v1",
        "openclaw-chat-wizard-cancel",
        "openclaw-setup-model-ref",
        "taskSuggestions.acceptModes",
        "talk-session-close-disposition"
      ]
    },
    "auth": {
      "method": "token",
      "role": "operator",
      "scopes": []
    }
  }
}
{
  "type": "res",
  "id": "proof-users-self",
  "ok": false,
  "error": {
    "code": "FORBIDDEN",
    "message": "missing scope: operator.read",
    "details": {
      "code": "MISSING_SCOPE",
      "missingScope": "operator.read",
      "requiredScopes": [
        "operator.read"
      ]
    }
  }
}
PASS: marker advertised; requested scope not granted; protected users.self RPC rejected.
Scope: capability advertisement and unchanged authorization boundary only. No custody, injection, or consumer claim.

Readiness follow-up — November 2, 2026

The PR is non-draft and GitHub reports no merge conflicts at unchanged head 9c51b90ab5677c9fbae03a8a403d66d4df581c5b. ClawSweeper's exact-head review reports no code findings, with diamond-lobster proof confidence and patch quality; its lower overall rating concerns the outstanding maintainer contract decision, not a code defect. Existing exact-head proof above remains applicable.

The latest PR CI run failed only the Android third-party unit-test job: NodeRuntimeAgentSelectionTest.coldStartUsesAnAllowedAgentBeforePatchingTheGatewayDefault timed out after 2,000 ms (3,769 tests, one failure). The four-file change does not modify Android sources or test/build inputs; the additional legacy security/aggregate red statuses still reflect the separately documented maintainer approval requirement. The automated failure report classified the Android failure as unknown because its then-current scheduled-main comparison had no comparable result; no matching-signature baseline claim is made.

A rebase is deferred under the requested allowance for unrelated main failures: the newest completed scheduled-main CI is red in UI E2E shards 1/7 and 4/7 and Node compact-small shards 4 and 42. This is not a claim that the Android timeout is repaired or that all checks are green. The maintainer public-contract decision and exact-head security approval remain before merge. No merge or CI rerun was performed.

Advertise the existing queue-mode and exact input-receipt transport shape without promising permission, consumption, or backend injection.

Co-authored-by: Copilot App <[email protected]>
@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: XS labels Oct 22, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

Adds and documents chat-input-custody-v1 in Gateway hello capabilities.

Example: An independently versioned chat client connects to the Gateway.

  • Before: Hello does not explicitly identify support for queue modes and exact input receipts.
  • After: Hello includes chat-input-custody-v1, allowing explicit discovery without granting additional permissions.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused code and shipped-entry-point proof are strong; readiness remains capped by the unresolved public-contract decision.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The PR body contains sanitized terminal output from the built production Gateway on Linux x64 at the exact head, showing the new hello capability and rejection of users.self for an unsigned token-authenticated client with empty effective scopes.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision · Fix scope: Complete
User problem: Independently versioned clients cannot explicitly discover the existing queue-mode and exact receipt transport contract.
Reason: The separate Windows client provides a concrete consumer, but establishing a stable public capability requires an owner decision.

Merge readiness

⛔ Blocked before merge - 2 items remain

Keep this PR open: the focused implementation has no actionable introduced defects, while adoption of the public discovery contract awaits an owner decision.

Priority: P3
Reviewed head: 9c51b90ab5677c9fbae03a8a403d66d4df581c5b
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should chat-input-custody-v1 become the stable discovery contract for queue modes and exact input receipts?
  • Recommendation: Accept the transport-only marker: Approve explicit discovery using the existing capability mechanism and the documented limits on permissions, backend injection, and delivery guarantees.
  • Why: The independent consumer establishes a concrete use, but neither the discussion nor recorded reviews contain owner approval of this new public contract.

Before merge

  • Await maintainer action - A maintainer must review head 9c51b90 and provide the enforced /allow-security-sensitive-change approval before merge.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Agent review details

How this fits together

The WebSocket hello owner consumes authenticated connection state and the shared capability registry, then sends clients server features and effective scopes.

flowchart LR
  A[Chat client] --> B[Connect authentication]
  B --> C[Hello owner]
  D[Capability registry] --> C
  C --> E[Hello response]
  E --> A
  A --> F[Chat send and history RPCs]
Loading

Technical review

Best possible solution:

If the owner accepts the transport-only discovery contract, retain this minimal registry-and-hello implementation with the documented permission and consumption limits.

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

This is an additive discovery feature; source inspection confirms the marker is absent on fetched main, and the supplied exact-head Gateway trace demonstrates its advertisement.

Is this the best way to solve the issue?

The patch is the smallest complete implementation using existing owners: one shared constant, one hello entry, a focused protocol regression, and matching documentation.

AGENTS.md: found and applied where relevant.

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

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

Likely related people:

  • Peter Steinberger: Raw commit da80fb5 adds packages/gateway-protocol/src/server-capabilities.ts:3 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: da80fb5d3835; files: packages/gateway-protocol/src/server-capabilities.ts)
  • Vincent Koc: Raw commit 9466d07 adds docs/gateway/protocol/handshake.md:238 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 9466d07256c0; files: docs/gateway/protocol/handshake.md)

PR surface

Source +3, Tests +9, Docs +26. Total +38 across 4 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 3 0 +3
Tests 1 9 0 +9
Docs 1 26 0 +26
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 38 0 +38

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a small interoperability feature with no demonstrated urgent runtime regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: ⏳ waiting on maintainer: Only explicit maintainer approvals or decisions remain; merge is still blocked.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-22T13:49:16.350Z sha 9c51b90 :: needs real behavior proof before merge. :: none

Reviewed October 26, 2026, 1:18 PM ET / 17:18 UTC (Revision 2).

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

The requested real-Gateway proof is now in the PR's Evidence section, including the actual sanitized hello/RPC trace and downloadable reproduction artifacts, tied to unchanged head 9c51b90ab5677c9fbae03a8a403d66d4df581c5b.

  • Real built Gateway advertises chat-input-custody-v1; the unsigned token-authenticated test client receives empty scopes and users.self is denied for missing operator.read.
  • 55 focused tests and the ciArtifacts build passed. Fresh independent P0–P3 source review found no actionable introduced defects.
  • Earlier unsuccessful broader custody attempts remain documented; they are not being claimed as passing or as proof for changed behavior.

The PR is ready for review, not merge-approved. Maintainer decision requested: should chat-input-custody-v1 be accepted as the stable transport-only discovery contract described here? No owner approval is inferred from the runtime proof.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Maintainer security review required

This external contributor PR changes sensitive security components. A maintainer must review these changes before merging.

Current SHA: 9c51b90ab5677c9fbae03a8a403d66d4df581c5b

These sensitive security changes were made:

  • src/gateway/server/ws-connection/connect-hello.ts: Controls Gateway authentication, pairing, or caller permissions. Check identity validation, scope checks, and revocation.

After reviewing the changes, post a new PR comment containing only approval commands, each on its own line:

/allow-security-sensitive-change

A later push requires a fresh approval comment.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 26, 2026
@bkudiess
bkudiess marked this pull request as draft October 29, 2026 14:44
@bkudiess
bkudiess marked this pull request as ready for review October 29, 2026 15:45
@RomneyDa
RomneyDa merged commit 323df21 into openclaw:main Nov 2, 2026
421 of 428 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 3, 2026
Advertise the existing queue-mode and exact input-receipt transport shape without promising permission, consumption, or backend injection.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. security-review-required security-sensitive-changed size: XS status: ⏳ waiting on maintainer Only explicit maintainer approvals or decisions remain; merge is still blocked.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants