Skip to content

chore(protocol): refresh Swift gateway models#80436

Closed
anyech wants to merge 1 commit into
openclaw:mainfrom
anyech:fix/generated-protocol-runtime-handoff
Closed

chore(protocol): refresh Swift gateway models#80436
anyech wants to merge 1 commit into
openclaw:mainfrom
anyech:fix/generated-protocol-runtime-handoff

Conversation

@anyech

@anyech anyech commented May 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Refresh the generated shared Swift gateway protocol model.
  • Add the generated internalRuntimeHandoffId Codable property/mapping to AgentParams in apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift.

Why

pnpm protocol:check on current main regenerates this file and reports a dirty diff, which causes checks-fast-protocol to fail on unrelated PRs rebased onto current main.

Real behavior proof

  • Behavior or issue addressed: Current main regenerates apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift with a missing internalRuntimeHandoffId mapping, leaving the protocol output dirty.
  • Real environment tested: Disposable OpenClaw source checkout on Linux arm64 using Node 22 and the repo-declared pnpm via Corepack; no live Gateway, service config, or production state was used.
  • Exact steps or command run after the patch: Regenerated the protocol schema and Swift model output, then compared the generated artifacts with git diff --exit-code.
  • Evidence after fix: Terminal output from the after-fix run:
$ corepack pnpm protocol:gen
wrote dist/protocol.schema.json

$ corepack pnpm protocol:gen:swift
wrote apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift

$ git diff --exit-code -- dist/protocol.schema.json apps/macos/Sources/OpenClawProtocol/GatewayModels.swift apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift
exit code: 0; no diff
  • Observed result after fix: The regenerated protocol artifacts matched the committed tree, so the generated Swift protocol model is no longer dirty after regeneration.
  • What was not tested: No live Gateway/runtime canary was run because this PR only refreshes generated protocol output.

Validation

  • Reproduced the drift from latest upstream main with the protocol generation/check sequence.
  • Confirmed the generated diff is limited to one file: apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift (4 insertions).
  • After committing the generated output, reran the same protocol generation/check sequence and it exited cleanly with no working-tree diff.

Regenerate the shared OpenClawKit GatewayModels.swift output so the Swift protocol model includes internalRuntimeHandoffId from the gateway schema.
@openclaw-barnacle openclaw-barnacle Bot added size: XS triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 10, 2026
@clawsweeper

clawsweeper Bot commented May 10, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I did a careful shell check against current main, and this is already implemented.

Current main already contains the generated Swift AgentParams refresh this PR adds, with the schema, generator contract, and protocol check aligned around that field; the implementation is current-main-only and not in a release tag yet.

So I’m closing this as already implemented rather than keeping a duplicate issue open.

Review details

Best possible solution:

Keep the generated Swift model already present on current main; no separate merge from this PR is needed.

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

Yes. Source inspection shows the schema requires internalRuntimeHandoffId in AgentParams, the generator emits schema properties into Swift model fields, and the PR supplies terminal proof that regeneration is clean after the generated output is present.

Is this the best way to solve the issue?

Yes. Refreshing the generated OpenClawKit model is the narrowest maintainable fix, and current main already contains that exact generated output.

Security review:

Security review cleared: The diff only refreshes generated Swift Codable model output and does not alter CI, dependency resolution, secret handling, or the runtime handoff trust gate.

What I checked:

  • Current schema source includes the field: AgentParamsSchema defines internalRuntimeHandoffId as an optional non-empty string, so Swift generation should emit it for AgentParams. (src/gateway/protocol/schema/agent.ts:178, 00453a9607a5)
  • Current generated Swift model already has the PR output: Current main's shared OpenClawKit AgentParams already has the property, initializer parameter, assignment, and CodingKeys mapping for internalRuntimeHandoffId, matching the PR's four-line generated hunk. (apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift:747, 00453a9607a5)
  • Swift generator contract supports the generated shape: The Swift generator iterates object schema properties and emits a Swift property, initializer parameter, assignment, and coding key for each property, which is the exact shape of the PR change. (scripts/protocol-gen-swift.ts:181, 00453a9607a5)
  • Protocol check covers the generated artifact: protocol:check runs both protocol generators and diffs the generated schema and Swift model outputs, which is the dirty-output failure mode described by the PR. (package.json:1505, 00453a9607a5)
  • Runtime path is already gated: The gateway request type carries internalRuntimeHandoffId, and runtime use is guarded by canUseInternalRuntimeHandoff, so this generated model refresh does not add a new runtime trust path. (src/gateway/server-methods/agent.ts:599, 00453a9607a5)
  • Security-sensitive behavior has current tests: Current tests cover backend-only consumption and forged handoff rejection for the same field, supporting this as a generated client-model sync rather than a new security behavior. (src/gateway/server-methods/agent.test.ts:1696, 00453a9607a5)

Likely related people:

  • Peter Steinberger: Local blame and shortlog for the schema, generated Swift model, Swift generator, gateway request handling, and related tests attribute the relevant current-main area to this person in the available history. (role: recent protocol/runtime area contributor; confidence: medium; commits: a51a9631ccda, 00453a9607a5; files: src/gateway/protocol/schema/agent.ts, apps/shared/OpenClawKit/Sources/OpenClawProtocol/GatewayModels.swift, scripts/protocol-gen-swift.ts)

Codex review notes: model gpt-5.5, reasoning high; reviewed against 00453a9607a5; fix evidence: commit 00453a9607a5, main fix timestamp 2026-05-12T00:17:49+01:00.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 10, 2026
@clawsweeper clawsweeper Bot closed this May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: supplied External PR includes structured after-fix real behavior proof. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant