Repository navigation
refactor(native): share Gateway payload decoding - #139995
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed September 6, 2026, 9:58 AM ET / 13:58 UTC. ClawSweeper reviewWhat this changesShares 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 Review scores
Verification
How this fits togetherApple 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
Before mergeNone. Agent review detailsSecurityNone. PR surfaceTests +2, Other +93. Total +95 across 17 files. View PR surface stats
Review metricsNone. Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
This comment has been minimized.
This comment has been minimized.
df46dda to
32db0dc
Compare
|
Merged via squash.
|
* 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
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.d5efb43216baacc7e6c8b32a164d02a450ba3022(run 34029283371). Shared, Mac, iOS and Android suites also passed on the complete accent headdf46dda0bfcafda865816549aee91ecb1e3e98c5(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.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.windowsbefore AppKit initialization; it now uses existing once-onlyAppKitTestSupport.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.