Repository navigation
refactor: simplify Gateway session-name precedence - #147984
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 18, 2026, 4:12 AM ET / 08:12 UTC (Revision 6). ClawSweeper reviewWhat this changesSimplify Gateway conversation-name selection with early returns and extend existing row tests for padded labels, blank labels, and empty names. Merge readiness✅ Ready for maintainer review No actionable defect found. The cleanup remains absent from current main, preserves existing naming behavior, and belongs with the active maintainer-authored implementation. Priority: P3 Review scores
Verification
How this fits togetherThe Gateway combines stored session metadata and channel information into conversation names. Session listings, searches, and session resolution consume those names. flowchart TD
A[Session key and metadata] --> B{Explicit rename?}
B -->|Yes| F[Conversation name]
B -->|No| C{Human group title?}
C -->|Yes| F
C -->|No| D[Stored or generated name]
D -->|Absent| E[Filtered origin fallback]
D -->|Present| F
E --> F
F --> G[Session lists and resolution]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -9, Tests -3. Total -12 across 2 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Technical reviewBest possible solution: Keep naming precedence in the existing display owner and skip lower-priority work once the result is determined. Do we have a high-confidence way to reproduce the issue? Not applicable: the linked request explicitly describes internal cleanup rather than a title-rendering bug; current source confirms the unnecessary fallback computation. Is this the best way to solve the issue? Yes. Early returns preserve the existing nullish precedence and identity filters without adding state, abstractions, or another naming owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c8cfd5218888. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
914acc6 to
63aab13
Compare
Return when explicit labels or human group titles determine the name. Defer fallback parsing while preserving nullish precedence and identity suppression. Extend the existing row precedence case for blank labels and empty stored or generated names. Full row tests, selected sessions-read handlers, and the matching Gateway type graph passed. Fixed row/list measurements were small and mixed; no broad speedup is claimed.
|
Merged via squash.
|
Punchcard-Session: ember-river-harbor-t4 * commit 'fdbb2455ac991202051904501438f690d22a0701': (21 commits) fix(qa): restore Telegram skill integration checks (#151632) test(e2e): follow published plugin convergence restarts (#151607) perf(tasks): skip unnecessary maintenance record copies (#151578) refactor: simplify Gateway session-name precedence (#147984) fix(ui): keep suggested task launches in the background (#151611) fix(agents): preserve subagent progress across repeated restarts (#151450) fix(diagnostics): scale memory growth pressure to the heap limit (#151355) fix(ui): release reply previews when connections retire (#145907) fix(ui): disable skeleton shimmers when motion is reduced (#151314) fix(gateway): reduce worker overhead with large session stores (#149700) improve: defer unused work during Gateway startup (#151547) improve: reduce transcript freshness-check overhead (#151606) fix(ui): keep Home from appearing twice in the sidebar (#151401) improve(gateway): reduce allocations during large session refreshes (#151565) improve: reduce temporary allocations for long provider requests (#151603) fix: keep Gateway responsive and preserve completions during SQLite contention (#151594) fix(models): renew successful empty provider catalogs (#151580) fix: reveal preserved chat branches after rewind and resend (#151598) perf(outbound): skip inert plain-text preparation scans (#149829) improve(ui): make toast feedback compact and recovery readable (#151575) ...
Return when explicit labels or human group titles determine the name. Defer fallback parsing while preserving nullish precedence and identity suppression. Extend the existing row precedence case for blank labels and empty stored or generated names. Full row tests, selected sessions-read handlers, and the matching Gateway type graph passed. Fixed row/list measurements were small and mixed; no broad speedup is claimed.
What Problem This Solves
Gateway session-name selection computes fallback metadata even when an explicit label or human group title already determines the name.
User Impact
No user-visible behavior change. Name precedence, raw label fields, empty stored/generated names, iMessage identity suppression, and dashboard behavior remain unchanged. No configuration, storage, protocol, or migration changes.
Why This Change Was Made
Return at the existing label/title decisions, defer channel/origin/key parsing until needed, and remove the now-redundant title conditions. The existing display owner stays responsible; no cache or new abstraction is added. Production code shrinks by nine lines. The separate active-run projection is untouched.
Current validation (September 18)
Integrated current main
7bc487d39dc9e059bb9b19ea08152883022f83fethrough an ordinary merge, preserving the existing PR ancestry. The five-case precedence test now uses a typed tuple table with the same case names, inputs, expected values, and raw label/autoLabel assertions. Production remains nine lines smaller; tests are three lines smaller than the integrated main baseline. No cap, baseline, or assertion was weakened.session-utils.test.ts: 265 passed, no skips; 64.32 seconds wall time. This is correctness-suite duration, not a before/after performance result.The production simplification is unchanged. Main90f47f2e7a0076308f387a33e1faec85a11408ac was subsequently integrated to include the separately landed messaging type-graph repair (#151564). The full265-case row suite passed again with the current row-title preparation owner. Earlier performance measurements below remain historical and mixed; no new timing benefit is claimed for this refresh.
Historical evidence
session-utils.test.ts: 266 passed, no skips; the existing precedence case now covers padded/blank explicit labels and empty stored/generated names without duplicated setup.sessions-readhandler cases passed: presentation facts, short-ID ownership, describe ownership, and displayed-field search. Nineteen unrelated cases were outside the selected pattern. This is handler-boundary proof, not a live WebSocket Gateway test.gateway-roottype graph passed. No full build or broad local graph claim; hosted CI remains separate.The measurements are small and mixed and do not establish a broad speedup. At 1,000 rows, explicit-label row/list medians were about 0.9–1.6% lower in both orders. Other rows include regressions and sign changes; none were excluded.
Complete fixed-run wall medians and limitations
Milliseconds per complete roster pass; negative delta means candidate lower. Each median uses five within-process observations, with only two independent processes per source.
Node 26.8.2, fixed synthetic in-memory rosters, empty plugin/run/account state and model catalog, frozen wall clock, no transcript hydration. Row context/child index preparation is outside timing; list preparation is real per call. Controls cover explicit labels, human group titles, opaque/compact iMessage identities, an untitled internal dashboard, and empty stored/generated names. The dashboard fixture contains no sender-origin data and does not independently prove sender-identity suppression; existing tests cover that contract.
Other product jobs were held, but native/public I/O could continue. This was not an idle machine or isolated host. Cell CPU samples and whole-process resource receipts are retained; process metrics include imports, initialization, untimed parity, and cleanup, and do not isolate the resolver. There was no calibration, threshold selection, retry, outlier rejection, or added scale. No model, network, WebSocket, or full Gateway throughput claim.
All registry/database owners, processes, and groups closed. Raw samples, partial-result handling, inventories, source/runtime bindings, and used admissions are retained. Baseline:
0a8e1d5b91806f1503f3ef46bc2165cc2ceaa044; exact patch SHA-256:213e9d9b4f9f2c62837f515d9ecdfd68770468d336a6acf7ea5f8f4078fe9e81; independent data-audit SHA-256:c5ff2edbe825b2022e817bbd01bd9c10960b30b0cb7e266f46ca5dec0965df10.CI history: the original head failed the Control UI startup gzip gate. The unchanged two-file patch has now been replayed onto main
43d413bd39385ab04e1059c39aadafa4f30445cc, which contains the separate startup-code reduction in #147973 and the upstream budget-policy refresh in #148010. This PR changes neither policy nor UI source; neither upstream change is counted as its performance gain. Original failing logs and measurements remain preserved. Fresh exact-head CI is required before landing; no benchmark retiming or local dependency reconciliation was performed for this patch-identical replay.Closes #147982
Subsequent CI refresh: run
34829946379on63aab1365f3f222c05b5553187c032ae66140097failed the Docker ClawHub fixture expectation (355 cases passed, one failed in that job). That expectation was repaired separately on main by #148129 (abbdd5287afc59899721285bca79fdfd8e6d289d). The unchanged two-file patch is now replayed ontoac3bd358a87ae876fbbc23abbe8a0a7663ece325as9e67a06120788c45f184711872fd158070322ccf. Full touched beforeimages and the patch remain identical. Earlier UI and fixture failures stay recorded; this refresh is not a new benchmark or a green-CI claim. Fresh exact-head CI is required before landing.