Skip to content

refactor(core): fold single-consumer request modules into model-request - #43958

Merged
kitlangton merged 1 commit into
v2from
collapse-model-modules
Aug 21, 2026
Merged

refactor(core): fold single-consumer request modules into model-request#43958
kitlangton merged 1 commit into
v2from
collapse-model-modules

Conversation

@kitlangton

Copy link
Copy Markdown
Contributor

What

Folds four session request-shaping modules into model-request.ts, their only remaining consumer. Zero behavior change — every moved function is byte-identical logic under a private name.

These modules existed to be shared across the four hand-rolled request sites (runner, generate, title, compaction). After the envelope unification (#42680, #43555) routed all requests through SessionModelRequest.prepare, that boundary became their sole importer — four files of indirection for ~30 lines each. This makes the code's shape match the architecture that already landed: prepare is the one place requests are shaped, and now it reads top to bottom in one file.

Deleted module Now
model-headers.ts (SessionModelHeaders.make) private sessionHeaders
prompt-cache-key.ts (SessionPromptCacheKey.make) private promptCacheKey
model-hook.ts (SessionModelHook.apply) private applyModelHooks
model-http.ts (SessionModelHttp.middleware) private httpMiddleware

How

  • packages/core/src/session/model-request.ts — the four functions land beside the file's other helpers, sharing one HookScope type for the identity plugin hooks see. Call sites renamed in place; nothing else touched.
  • Verified sole-consumer status before deleting: no other imports of these modules anywhere in src or tests (they were only ever exercised through prepare).

No changeset: internal refactor with no observable change.

Scope

Mechanical fold-in only. No signature, wire, or behavior changes; model-transport.ts keeps its own module (it has service/layer structure, not just a function).

Testing

  • bun typecheck (packages/core): clean
  • bun run test (packages/core): 1,935 tests, 0 fail

@kitlangton
kitlangton enabled auto-merge (squash) August 21, 2026 18:34
@kitlangton
kitlangton merged commit e68144c into v2 Aug 21, 2026
10 checks passed
@kitlangton
kitlangton deleted the collapse-model-modules branch August 21, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant