Repository navigation
fix(ui): reconcile every null tombstone and align session sort with the gateway - #124104
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 4:50 AM ET / 08:50 UTC. ClawSweeper reviewWhat this changesThe PR makes Control UI session reconciliation delete producer-sent null tombstones generically except for nullable row fields, matches Gateway key tie ordering, avoids stale no-op publishes, and relaxes one E2E layout tolerance. Merge readinessKeep open. Current main still has the hand-maintained tombstone list and non-deterministic UI tie ordering; this maintainer-authored PR replaces those drift points with the Gateway contract. No blocking correctness finding was found, but merge should wait for the current head’s checks and any required merge-result refresh. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI receives incremental Gateway session events and canonical session-list snapshots, reconciles them into sidebar rows, then sorts them for navigation. The changed code is the client-side boundary that must preserve Gateway clearing and ordering semantics. flowchart LR
Gateway[Gateway session events] --> Reconcile[UI reconciliation]
Gateway --> Snapshot[Canonical session list]
Reconcile --> Rows[Session row state]
Snapshot --> Ordering[Deterministic ordering]
Rows --> Sidebar[Sidebar navigation]
Ordering --> Sidebar
Before merge
Agent review detailsSecurityNone. PR surfaceSource -11, Tests +65. Total +54 across 6 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep the Gateway producer as the canonical tombstone and ordering authority, retain the UI’s two explicit nullable-field exceptions, and land only after current-head validation is green. Do we have a high-confidence way to reproduce the issue? Yes—source reproducible: current main’s event producer emits null tombstones that the UI’s fixed deletion list does not fully remove, leaving literal null in optional row fields. Is this the best way to solve the issue? Yes. Applying the producer’s null-tombstone rule at the UI merge boundary, while preserving the two schema-nullable fields, removes the duplicated policy rather than extending another manual list. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 4fc375654d34. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (2 earlier review cycles)
|
…he gateway The sessions.changed merge deleted null-tombstoned fields from a hand-kept eleven-field list while the gateway's tombstone policy (session-event-payload.ts) had grown past it: toolOverrides, observerDigest, controlOwnerSessionKey, restartRecoveryStatus, and goal leaked literal null into rows typed optional-not-null, and every new tombstoned field would silently repeat the drift. One loop over the event's null-valued keys now owns the rule; updatedAt/activeLeafEntryId (the schema's only nullable row fields) keep their explicit handling. Net −24 lines. Riders in the same owner neighborhood: - compareSessionRowsByUpdatedAt gains the gateway's ascending-key tie-break (session-list-order.ts: "Stable key ties keep offset paging deterministic") so tied rows — including all updatedAt:null rows — stop visibly swapping when the canonical refresh replaces an event-driven reconcile. - Deleted the unreachable kind === "cron" wire guards (gateway folds cron to direct before projection, #115299; both sites needed an `as string` cast because the protocol type has no such member). - The stale-active-snapshot path returns the original result identity when no defaults were passed, so the caller's result === state.result publish gate skips a spurious sidebar re-render on every stale event.
b894d53 to
32e2522
Compare
The 2px y-tolerance flaked at 2.41px on CI renderers; the #122809 regression this guards against shifts by a full indicator row (~20px).
|
Merged via squash.
|
…he gateway (openclaw#124104) * fix(ui): reconcile every null tombstone and align session sort with the gateway The sessions.changed merge deleted null-tombstoned fields from a hand-kept eleven-field list while the gateway's tombstone policy (session-event-payload.ts) had grown past it: toolOverrides, observerDigest, controlOwnerSessionKey, restartRecoveryStatus, and goal leaked literal null into rows typed optional-not-null, and every new tombstoned field would silently repeat the drift. One loop over the event's null-valued keys now owns the rule; updatedAt/activeLeafEntryId (the schema's only nullable row fields) keep their explicit handling. Net −24 lines. Riders in the same owner neighborhood: - compareSessionRowsByUpdatedAt gains the gateway's ascending-key tie-break (session-list-order.ts: "Stable key ties keep offset paging deterministic") so tied rows — including all updatedAt:null rows — stop visibly swapping when the canonical refresh replaces an event-driven reconcile. - Deleted the unreachable kind === "cron" wire guards (gateway folds cron to direct before projection, openclaw#115299; both sites needed an `as string` cast because the protocol type has no such member). - The stale-active-snapshot path returns the original result identity when no defaults were passed, so the caller's result === state.result publish gate skips a spurious sidebar re-render on every stale event. * test(ui): pin the ascending-key tie for equal-updatedAt sidebar rows * test(ui): tolerate CI renderer jitter in the typing-shift picker guard The 2px y-tolerance flaked at 2.41px on CI renderers; the openclaw#122809 regression this guards against shifts by a full indicator row (~20px).
What Problem This Solves
The Control UI's
sessions.changedmerge deleted null-tombstoned fields from a hand-maintained eleven-field list while the gateway's tombstone policy (session-event-payload.ts) had grown past it:toolOverrides,observerDigest,controlOwnerSessionKey,restartRecoveryStatus, andgoalleaked literalnullinto rows typed optional-not-null, and every future tombstoned field would silently repeat the drift. Today's consumers happen to be null-tolerant, so this is a type-lie plus drift trap rather than a crash — but it's exactly the "hand-kept copy of the producer's policy" disease.Why This Change Was Made
One loop over the event's null-valued keys now owns the tombstone rule (the producer's policy applied mechanically), with
updatedAt/activeLeafEntryId— the schema's only legitimately nullable row fields — keeping their explicit handling. Net −24 lines at the fix site.Riders in the same owner neighborhood (sessions-lane findings):
compareSessionRowsByUpdatedAtgains the gateway's ascending-key tie-break (session-list-order.ts: "Stable key ties keep offset paging deterministic") so tied rows — including allupdatedAt: nullrows — stop visibly swapping when the canonical refresh replaces an event-driven reconcile.kind === "cron"wire guards: the gateway folds cron/spawn-child intodirectbefore any projection (refactor(sessions): consolidate entry state #115299), and both sites needed anas stringcast because the protocol type has no such member. Real cron detection (isCronSessionKey) stays.reconcileSessionHistoryreturns the original result identity when no defaults were passed, so the caller'sresult === state.resultpublish gate skips a spurious sidebar re-render on every stale event.User Impact
Session rows no longer carry type-violating
nullvalues after patches that clear tool overrides, goals, control ownership, or restart-recovery status; sidebar ordering stays stable across the event→canonical-refresh handoff; stale events stop forcing needless sidebar re-renders.Evidence
updatedAtproven untouched by the loop), and tied rows sort by ascending key matching the gateway.node scripts/run-vitest.mjs run ui/src/lib/sessions— 280/280 across 29 files;ui/src/pages— 4625 passed.pnpm tsgo:ui,pnpm check:test-types, oxfmt/oxlint clean; autoreview clean (0.98).Production LOC +25/−38 (net −13); tests +63.