Skip to content

Refactor oversized runtime modules into focused owner-aligned files #106503

Description

@steipete

Summary

Split five oversized runtime modules into focused owner-aligned files without changing public behavior.

Problem to solve

These modules each exceed 4,100 physical lines and combine unrelated responsibilities, making review, ownership, testing, and future fixes unnecessarily risky:

  • extensions/telegram/src/bot-handlers.runtime.ts
  • extensions/active-memory/index.ts
  • src/gateway/server-methods/agent.ts
  • extensions/codex/src/app-server/run-attempt.ts
  • extensions/diagnostics-otel/src/service.ts

Proposed solution

Land focused behavior-preserving refactors that extract cohesive runtime seams, keep new production TypeScript files within the 500-line LOC policy, preserve existing entrypoints, and retain or improve focused test coverage.

Alternatives considered

  • Renaming each large file behind a thin facade only moves the debt and is not sufficient.
  • One mega-PR mixes five independent owner boundaries and makes regression isolation harder.
  • Leaving the files under the oversized-file ratchet preserves growing review and maintenance cost.

Impact

Maintainers get smaller review units, clearer ownership boundaries, and safer future changes. Users should observe no behavior change.

Evidence/examples

Current main physical line counts: 4,200; 4,182; 4,168; 4,137; and 4,131 lines respectively. Each landing slice will include focused tests, changed gates, mandatory autoreview, and exact-head hosted proof.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requestmaintainerMaintainer-authored PR

Type

No type

Fields

Priority

None yet

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions