Skip to content

refactor(gateway): split session utilities - #113118

Merged
steipete merged 2 commits into
mainfrom
refactor/split-gateway-session-utils
Jul 23, 2026
Merged

steipete merged 2 commits into
mainfrom
refactor/split-gateway-session-utils

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

src/gateway/session-utils.ts had grown past 3,000 lines and required a grandfathered max-lines suppression, coupling client-visible row projection, store targeting, model/thinking metadata, search, and pagination.

Why This Change Was Made

Split the unchanged public facade into focused contracts, list-context projection, store access/target resolution, model/thinking projection, row construction, search, and pagination modules. Shared row/store contracts and model-cache identity live in a leaf module, keeping the runtime import graph acyclic and preserving client projection shapes.

The production diff grows by about 186 lines, almost entirely explicit imports and the public re-export facade. No projection path or compatibility behavior is duplicated.

User Impact

No user-visible behavior changes. Gateway clients receive the same session rows, thinking/model metadata, store resolution, search results, and pagination while every resulting module stays below 700 physical lines.

Evidence

  • node scripts/run-vitest.mjs src/gateway/session-utils.test.ts src/gateway/session-utils.fs.test.ts src/gateway/session-utils.subagent.test.ts — 232 tests passed.
  • node --import tsx scripts/check-madge-import-cycles.ts — zero cycles.
  • node scripts/check-changed.mjs -- <touched files> — passed on Blacksmith Testbox, including both typechecks, full core lint, max-lines ratchet, boundary guards, and zero runtime import cycles.
  • $HOME/.claude/skills/autoreview/scripts/autoreview --mode branch --base origin/main — clean.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XL maintainer Maintainer-authored PR labels Jul 23, 2026
@steipete
steipete force-pushed the refactor/split-gateway-session-utils branch from 20684e7 to e763fb0 Compare July 23, 2026 17:39
@steipete steipete self-assigned this Jul 23, 2026
@steipete
steipete marked this pull request as ready for review July 23, 2026 17:40
@steipete
steipete force-pushed the refactor/split-gateway-session-utils branch from 9263428 to 2061ca9 Compare July 23, 2026 18:37
@steipete
steipete merged commit be815ae into main Jul 23, 2026
117 checks passed
@steipete
steipete deleted the refactor/split-gateway-session-utils branch July 23, 2026 19:26
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 24, 2026
* refactor(gateway): split session utilities

* fix(gateway): privatize thinking row projection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gateway Gateway runtime maintainer Maintainer-authored PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant