refactor(server): classify orchestration exports#10275

merged2
cleanup-server/runtime-internals
cleanup-server/orchestration-internals
openedSep 6, 2026byJJulius Marminge
View on GitHubTwo-way sync enabledPR last imported 4d ago

Orchestration modules had 11 unclassified runtime exports. This keeps the ThreadSettlementReactor service constructor public, narrows seven implementation values, and deletes three unused error adapters without changing command, event, or projection contracts.

This is layer 2 of 9 in the server Knip cleanup stack.

The reactor constructor added on main uses the same explicit @public annotation.

Verification after rebasing onto current main: server typecheck and the server-only Knip export audit pass. Changed-file lint and formatting pass, with one existing lint warning. Focused auth, provider, source-control, preview toolkit, orchestration, and Knip preprocessor tests pass: 90 tests across 9 files. This changes server export visibility and static analysis; screenshots do not apply.

Model: gpt-6 astra. Harness: Codex in T3 Code.

Summary by CodeRabbit

  • Refactor

    • Reduced the public surface of orchestration internals by making implementation details private.
    • Removed several internal error-construction helpers from the public API.
    • Kept orchestration behavior and budget limits unchanged.
    • No user-facing behavior changes.
  • Documentation

    • Clarified which orchestration service construction APIs are public.
Synced from GitHub

Bugbot is paused β€” on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

Synced from GitHub

Thread transfer impact

βœ… Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

ProviderMetricMain baselineThis PRImpactPR ceiling
CodexTotal thread wireβ€”13.6 KiBβ€”15.1 KiBβœ…
CodexThread snapshot wireβ€”7.0 KiBβ€”7.3 KiBβœ…
CodexLive turn WebSocket wireβ€”6.6 KiBβ€”7.8 KiBβœ…
CodexLive turn WebSocket decodedβ€”57.1 KiBβ€”66.4 KiBβœ…
CodexLive turn messagesβ€”10β€”21βœ…
ClaudeTotal thread wireβ€”13.5 KiBβ€”15.1 KiBβœ…
ClaudeThread snapshot wireβ€”7.1 KiBβ€”7.3 KiBβœ…
ClaudeLive turn WebSocket wireβ€”6.5 KiBβ€”7.8 KiBβœ…
ClaudeLive turn WebSocket decodedβ€”57.8 KiBβ€”66.4 KiBβœ…
ClaudeLive turn messagesβ€”8β€”21βœ…

Baseline: unavailable Β· PR result: 1c4dfee Β· Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 113.9 KiB
  • Claude decoded thread snapshot: 114.6 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

Synced from GitHub

Approvability

Verdict: Approved at 1c4dfee

Macroscope's review found this PR approvable β€” This PR tightens internal orchestration exports and adds API classification comments without changing runtime logic, configuration values, schemas, or service wiring. Repository usage confirms the removed symbols are not consumed in-tree; only unsupported deep imports of internal modules could be affected.

You can add or adjust custom eligibility rules. Learn more.

Added 2 commits

  • refactor(server): remove unused orchestration exports71d2591
  • refactor(server): classify thread PR reactor constructor1c4dfee
Synced from GitHub

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. πŸŽ‰

ℹ️ Recent review info
βš™οΈ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: e0bb0f5d-a570-44bd-bbe1-920bc98e244a

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 52679c3a00274b06fd2cc2a4e678bfe1455cd870 and 1c4dfeec34410f080a13c3201fd45494fea2350b.

πŸ“’ Files selected for processing (7)
  • apps/server/src/orchestration/Errors.ts
  • apps/server/src/orchestration/LiveStreamBudget.ts
  • apps/server/src/orchestration/ThreadPullRequestReactor.ts
  • apps/server/src/orchestration/ThreadSettlementPolicy.ts
  • apps/server/src/orchestration/ThreadSettlementReactor.ts
  • apps/server/src/orchestration/commandInvariants.ts
  • apps/server/src/orchestration/runtimeLayer.ts
πŸ’€ Files with no reviewable changes (1)
  • apps/server/src/orchestration/Errors.ts
🚧 Files skipped from review as they are similar to previous changes (6)
  • apps/server/src/orchestration/ThreadPullRequestReactor.ts
  • apps/server/src/orchestration/runtimeLayer.ts
  • apps/server/src/orchestration/ThreadSettlementReactor.ts
  • apps/server/src/orchestration/commandInvariants.ts
  • apps/server/src/orchestration/LiveStreamBudget.ts
  • apps/server/src/orchestration/ThreadSettlementPolicy.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.


πŸ“ Walkthrough

Walkthrough

The change narrows the orchestration module API by removing selected exports and error helpers. It also documents service construction APIs as public Effect module entry points without changing runtime behavior.

Changes

Orchestration API surface

Layer / File(s)Summary
Restrict orchestration module exports
apps/server/src/orchestration/Errors.ts, apps/server/src/orchestration/LiveStreamBudget.ts, apps/server/src/orchestration/ThreadSettlementPolicy.ts, apps/server/src/orchestration/commandInvariants.ts, apps/server/src/orchestration/runtimeLayer.ts
Selected error factories, budget constants, settlement constants, invariant helpers, and runtime layer constants are no longer exported. Their behavior and composition remain unchanged.
Document canonical service construction
apps/server/src/orchestration/ThreadPullRequestReactor.ts, apps/server/src/orchestration/ThreadSettlementReactor.ts
The make service construction APIs receive @public documentation annotations. Runtime code is unchanged.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: βšͺ Minimal Β· up to 1c4df

This change narrows internal orchestration exports and documents service construction APIs without intended runtime or contract changes. No concrete current-head merge risk remains.

πŸš₯ Pre-merge checks | βœ… 4 | ❌ 1

❌ Failed checks (1 warning)

Check nameStatusExplanationResolution
Docstring Coverage⚠️ WarningDocstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 6 files.Write docstrings for the functions missing them to satisfy the coverage threshold.
βœ… Passed checks (4 passed)
Check nameStatusExplanation
Title checkβœ… PassedThe title clearly identifies the server refactor and the classification of orchestration exports.
Description checkβœ… PassedThe description explains what changed, why the change was made, scope, verification results, and that UI evidence does not apply. It does not use the template headings or checklist, but it contains th…
Linked Issues checkβœ… PassedCheck skipped because no linked issues were found for this pull request.
Out of Scope Changes checkβœ… PassedCheck skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches πŸ’‘ 1
πŸ“ Generate docstrings πŸ’‘
  • Create stacked PR
  • Commit on current branch
πŸ§ͺ Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cleanup-server/orchestration-internals

Comment @coderabbitai help to get the list of available commands.