Skip to content

refactor(native): share Gateway payload decoding - #139995

Merged
steipete merged 4 commits into
mainfrom
codex/deslop-native-chat-projection
Sep 6, 2026
Merged

steipete merged 4 commits into
mainfrom
codex/deslop-native-chat-projection

Conversation

@steipete

@steipete steipete commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Apple chat transports repeated the same agent-list projection, and Mac and iOS separately decoded and validated the same profile-accent response. Two private Mac session helpers also forwarded unchanged arguments to existing shared request builders.

Why This Change Was Made

Use the existing shared chat payload codec for agent catalogs and the existing rewind/fork request builders directly. A small Foundation-only owner now decodes profile-accent responses and performs their identical strict hex normalization. Each platform keeps its request routing, eight-second timeout, current-route checks, fallback selection and color renderer.

Preserve generated protocol decoding, server default agent ID, list order, system-agent filtering, optional display/worktree metadata and captured connection leases. Profile responses retain exact status checks, permissive handling of unrelated fields, malformed-JSON error behavior and lowercase six-digit ASCII validation. The Mac renderer's different numeric acceptance and iOS's preference-over-seam precedence remain unchanged.

Production is 47 lines smaller (+45/−92). Test source gains 130 lines and shared test support gains 12. New shared Swift methods are additive; no existing public API, wire protocol, configuration, storage, dependency or signing policy changes.

User Impact

No intentional change to appearance or behavior. Agent choices, rewind/fork actions and profile accents retain the same meaning with fewer independent implementations.

Evidence

Final source: 32db0dc02881cb038ff8631107eb94dce70952cb.

  • Independent P0–P2 reviews of the transport refactor, fixture fixes and full accent extension found no actionable issues. Committed source matches the frozen reviewed/compiled inputs.
  • The original native refactor and fixture repairs passed full native CI at d5efb43216baacc7e6c8b32a164d02a450ba3022 (run 34029283371). Shared, Mac, iOS and Android suites also passed on the complete accent head df46dda0bfcafda865816549aee91ecb1e3e98c5 (run 34032828960). Its overall CI exposed a separate Darwin relay-reaping race, fixed and landed in fix(process): join relay reaping before extinction probe #140134. This branch is now rebased onto main containing that repair. Range-diff confirms all production commits unchanged; main already absorbed part of the fixture readiness fix. The rebased head still requires its own green CI.
  • Isolated iOS execution passed 29 transport test methods / 35 parameterized invocations, including selectable-agent projection and rejected dispatch after connection retirement. Connected synthetic Mac tests cover direct/leased lists and real rewind/fork wire mappings. Shared cases preserve empty lists and malformed envelopes.
  • Accent preservation: original iOS tests passed 7/7; a fresh candidate iOS build and retained platform-precedence tests passed 3/3, with no failures or skips. Four normalization/profile tests moved to the shared owner, with full Data-response coverage added there: six methods / 25 invocations. Shared and Mac test bundles compile; their final runtime proof belongs to disposable Mac CI.
  • Fresh accent-candidate shared test compilation, Mac product compilation, Mac test compilation and iOS build-for-testing all passed. Pinned SwiftFormat, strict SwiftLint and diff checks passed. All 1,623 recorded inputs stayed unchanged through validation. Normal simulator signing verified; the owned simulator was deleted, preserving all 36 pre-existing simulators.

CI Follow-through

The earlier Dependency Guard request failed with a GitHub API 500 and passed on its targeted rerun. Periphery identified an unused Mac import, which was removed. An optional local Periphery scan crashed before findings; no passing local scan is claimed. Disposable CI subsequently passed the earlier native head.

CI also exposed two existing fixture failures, both present on inspected main. The Mac lifetime fixture read NSApp.windows before AppKit initialization; it now uses existing once-only AppKitTestSupport.application. Android's contrast fixture observed approval text before separately forwarded refresh state necessarily settled. The original Android test reproduced the exact CI assertion failure; its existing bounded waits now include their already-asserted state. The remaining fixture changes preserve the existing ten-second limits, cleanup and pixel checks; main already contains the earlier readiness predicates. All 31 themes / 155 measurements passed, minimum contrast 4.85:1 against the unchanged 4.5:1 threshold, with terminal readback/dismissal and zero approval-resolution requests. Full Mac and Android CI passed those fixes.

This PR uses disposable CI for Mac runtime proof and never launches against an operator Gateway. Exact-head native CI remains required after the rebase; prior-head results are not substituted for it.

@clawsweeper

clawsweeper Bot commented Sep 6, 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 app: ios App: ios app: macos App: macos size: M maintainer Maintainer-authored PR labels Sep 6, 2026
@steipete
steipete marked this pull request as ready for review September 6, 2026 09:41
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 6, 2026
@clawsweeper

clawsweeper Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 9:58 AM ET / 13:58 UTC.

ClawSweeper review

What this changes

Shares Apple Gateway agent-list and profile-accent decoding, removes redundant Mac request wrappers, and strengthens transport tests and native fixture readiness.

Merge readiness

✅ Ready for maintainer review

Keep open: this remains a useful, maintainer-authored cleanup absent from inspected main. No actionable correctness or security defects were found in the introduced changes.

Priority: P3
Reviewed head: 32db0dc02881cb038ff8631107eb94dce70952cb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving extraction with meaningful boundary coverage and no actionable findings.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR, and authority is unchanged. Reported native CI and synthetic transport tests cover catalog decoding, accent handling, and session dispatch; they are not characterized as live Gateway proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR, and authority is unchanged. Reported native CI and synthetic transport tests cover catalog decoding, accent handling, and session dispatch; they are not characterized as live Gateway proof.
Evidence reviewed 10 items Introduced changes inspected: Read the complete merge-base-to-head diff, including hunks truncated in the supplied context. Production changes extract existing expressions and remove forwarding wrappers; no dependency, workflow, storage, or configuration changes are introduced.
Agent catalog contract preserved: The shared decoder retains generated AgentsListResult decoding, server default ID, input order, optional metadata, and system-agent filtering. The owned Gateway protocol documents selector filtering and legacy rows without kind; this is an OpenClaw protocol boundary with no affirmative Codex dependency.
Documented roster semantics: Kind-aware clients exclude system rows from ordinary selectors, while older gateways may omit kind.
Findings None None.
Security None None.

How this fits together

Apple chat transports receive Gateway responses and turn them into agent choices and profile colors. Shared decoding now supplies those values while platform code retains connection routing, fallback selection, and rendering.

flowchart LR
  A[Gateway responses] --> B[Platform connection checks]
  B --> C[Shared payload decoding]
  C --> D[Selectable agent choices]
  C --> E[Validated profile accent]
  D --> F[Native chat]
  E --> G[Platform fallback and rendering]
  G --> F
Loading

Before merge

None.

Agent review details

Security

None.

PR surface

Tests +2, Other +93. Total +95 across 17 files.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 3 1 +2
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 16 241 148 +93
Total 17 244 149 +95

Review metrics

None.

Technical review

Best possible solution:

Keep one shared decoder for each payload contract while preserving platform-owned routing, fallback colors, and rendering.

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

Not applicable to the central refactor: duplicated production logic is directly visible in source. The fixture failure reproductions are contributor-reported and were not rerun during this read-only review.

Is this the best way to solve the issue?

Yes. The patch consolidates identical decoding in existing shared native layers and removes forwarding wrappers without changing the surrounding request or rendering contracts.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is behavior-preserving native cleanup with bounded test-fixture repairs and no demonstrated urgent user-facing regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary external-contributor proof gate does not apply to this MEMBER-authored PR, and authority is unchanged. Reported native CI and synthetic transport tests cover catalog decoding, accent handling, and session dispatch; they are not characterized as live Gateway proof.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (4 earlier review cycles)
  • reviewed 2026-09-06T09:57:15.505Z sha d089735 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T10:11:18.476Z sha b5b5baf :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T11:23:40.629Z sha d5efb43 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-06T12:28:51.364Z sha df46dda0bfcafda865816549aee91ecb1e3e98c5 :: needs maintainer review before merge. :: none

@blacksmith-sh

This comment has been minimized.

@openclaw-barnacle openclaw-barnacle Bot added the app: android App: android label Sep 6, 2026
@steipete steipete changed the title refactor(native): share chat agent catalog decoding refactor(native): share Gateway payload decoding Sep 6, 2026
@steipete
steipete force-pushed the codex/deslop-native-chat-projection branch from df46dda to 32db0dc Compare September 6, 2026 13:52
@steipete
steipete merged commit de7d253 into main Sep 6, 2026
70 of 72 checks passed
@steipete
steipete deleted the codex/deslop-native-chat-projection branch September 6, 2026 14:42
@steipete

steipete commented Sep 6, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 7, 2026
* refactor(native): share chat agent catalog decoding

* refactor(native): remove unused protocol import

* test: initialize native fixtures and await complete readiness

* refactor(native): share profile accent decoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: android App: android app: ios App: ios app: macos App: macos maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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