Skip to content

refactor(contracts): retire the legacy orchestration schemas - #14024

Merged
juliusmarminge merged 1 commit into
t3code/codex-turn-mappingfrom
v2/retire-legacy-orchestration-schemas
Sep 28, 2026
Merged

juliusmarminge merged 1 commit into
t3code/codex-turn-mappingfrom
v2/retire-legacy-orchestration-schemas

Conversation

@juliusmarminge

@juliusmarminge juliusmarminge commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Stacked on #14018.

packages/contracts/src/orchestration.ts (1.7k lines) still held the whole V1 command, event and read-model vocabulary. It was exported twice from the index and again as @t3tools/contracts/legacy-orchestration, but after #13960–#14018 nothing on the server uses V1 commands or events. Only a handful of its schemas are still on the wire.

What changed

  • Still-used wire schemas moved, byte for byte, into their own modules. A script compared each declaration against the original and all 15 are identical, so the wire does not change:
    • threadPullRequest.ts: ThreadPullRequestLink, …Key, …LinkSource, …Snapshot, …Stack, …StackLayer, ThreadLinkedPullRequest
    • threadSearch.ts: search input, match, result, source, and OrchestrationSearchThreadsError
    • orchestrationDispatch.ts: OrchestrationDispatchCommandError, still in the project-clone RPC and read by wasBootstrapThread*
    • threadTitle.ts: ThreadTitleRegeneration, used by the MCP thread metadata
    • ProjectFaviconPath joins project.ts
  • Deleted: orchestration.ts, the ./legacy-orchestration export and the duplicate export * in the index.
  • Server. The command-receipt row keeps its project | thread and accepted | rejected literals locally, and so does the provider-runtime status. These are database row shapes, not wire types.
  • Clients and tests that borrowed V1 types for local shapes now name only the fields they read:
    • derivePendingRequests, foldSubagentActivities and web's latestWorkspaceMutationId take { kind, payload, createdAt }-style structural inputs.
    • codexFeedbackMessage returns a LocalChatMessage.
    • Mobile's feed takes a LocalThreadMessage; the pending-creation row drops the V1 turnId, which the feed never read.
    • Server PR tests build a small PullRequestTestThread for v2PullRequestThread instead of a V1 shell.
  • Tests. The contracts tests of still-live schemas moved next to them: modelSelection, checkpointDiff, chatAttachment (unknown and malformed attachment types, accessibility cap), orchestrationDispatch, threadPullRequest, and the project icon, monogram and favicon cases in project.test.ts. Icon compatibility is now checked through the V2 ProjectUpdatePayload instead of a V1 command. The composer-context test now uses the V2 conversation message and message.dispatch. Tests of V1 commands, events, shells, sessions and proposed plans were deleted along with the schemas.
  • Docs. docs/orchestration-v2/README.md no longer describes V1 as "still present".

Dead code found (follow-up)

None of this is deleted here; each item only lost its V1 type:

  • packages/client-runtime/src/pendingRequests.ts: derivePendingRequests has no production caller, and the ./pending-requests subpath export in packages/client-runtime/package.json is never imported.
  • packages/client-runtime/src/state/subagentRuntime.ts: foldSubagentActivities (and its helpers) has no production caller; the UI uses projectedSubagentsToRuntime.
  • apps/web/src/hooks/useWorkspaceMutationRefresh.ts: latestWorkspaceMutationId is only called from its test. ChatView derives the mutation id from turn items itself.
  • apps/mobile/src/lib/threadActivity.ts: the localMessages option of buildThreadFeed is only passed by tests (anchoredMessages is live).
  • packages/client-runtime/src/state/threadSettled.ts: SettlementThreadShell is declared and never used (it predates this PR; lint flags it now that the file is touched). The unused OrchestrationThreadShell import in the same file was removed here because the type no longer exists.

Verification

  • vp exec tsc --noEmit -p . in packages/contracts, packages/client-runtime, packages/shared, apps/web, apps/mobile, apps/server: 0 error TS / warning TS.
  • vpr knip:check: clean.
  • vp lint on touched files: no new warnings. The remaining ones (SettlementThreadShell above, two _ params in PullRequestSyncReactor.test.ts) predate this PR.
  • vp test run, in small groups, all passing:
    • contracts: modelSelection, orchestrationDispatch, checkpointDiff, chatAttachment, project, threadPullRequest (new or moved), composerContext, applicationEvent, rpc, orchestrationV2, assets
    • client-runtime: pendingRequests, state/subagentRuntime, state/threadFeedback, state/threadSnoozed, errors/orchestration, state/threadSearch
    • web: hooks/useWorkspaceMutationRefresh
    • mobile: lib/threadActivity, state/thread-outbox, state/pending-thread-creation
    • server: PullRequestSyncReactor, MCP pullRequests/handlers, linkCreatedPullRequest, ThreadSearch, ProjectService, ws, runtimeLayer, V1ImportBoundary, legacy/*, 055_* (3 files), 056_*, and replay (OrchestratorReplayFixtures.integration + .contract, OrchestratorReplayRecovery)
  • Not run: the repo-wide suite, and a real client. The UI change is type-only, and the wire is identical by construction.

Model: Claude Opus 5.5 (Claude Code)

🤖 Generated with Claude Code


Devin Review

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL 1,000+ changed lines (additions + deletions). labels Sep 28, 2026
@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

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

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire — 4.9 KiB — 6.8 KiB ✅
Codex Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Codex Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Codex Live turn WebSocket decoded — 20.4 KiB — 29.3 KiB ✅
Codex Live turn messages — 2 — 8 ✅
Claude Total thread wire — 4.9 KiB — 6.8 KiB ✅
Claude Thread snapshot wire — 3.7 KiB — 4.9 KiB ✅
Claude Live turn WebSocket wire — 1.2 KiB — 2.0 KiB ✅
Claude Live turn WebSocket decoded — 20.7 KiB — 29.3 KiB ✅
Claude Live turn messages — 1 — 8 ✅

Baseline: unavailable · PR result: 1fe16e5 · 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: 106.1 KiB
  • Claude decoded thread snapshot: 106.4 KiB

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

@macroscopeapp

macroscopeapp Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — The PR removes a large exported V1 orchestration contract and restructures shared contract modules across server and client packages. The retained wire schemas appear unchanged, but the public API removal and broad shared-infrastructure refactor merit human compatibility review.

No code changes detected at 1fe16e5. Prior analysis still applies.

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

@juliusmarminge
juliusmarminge force-pushed the v2/quarantine-v1-importer branch from c3ed758 to 561a1d1 Compare September 28, 2026 17:40
Base automatically changed from v2/quarantine-v1-importer to t3code/codex-turn-mapping September 28, 2026 17:46
The still-used wire schemas move, byte for byte, into their own modules:
thread pull request links, thread search, the dispatch error and title
regeneration. ProjectFaviconPath joins project.ts. The wire is identical.
The ./legacy-orchestration export and the duplicate index export go away
with orchestration.ts.

Server persistence keeps its receipt and runtime status literals locally.
Client and test code that only borrowed V1 types for local shapes now
names the fields it reads. Tests of still-live schemas move next to them;
tests of V1 commands, events and read models go with the schemas.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@juliusmarminge
juliusmarminge force-pushed the v2/retire-legacy-orchestration-schemas branch from 2cd8372 to 1fe16e5 Compare September 28, 2026 17:49
@juliusmarminge
juliusmarminge merged commit f9ff8e2 into t3code/codex-turn-mapping Sep 28, 2026
23 checks passed
@juliusmarminge
juliusmarminge deleted the v2/retire-legacy-orchestration-schemas branch September 28, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 1,000+ changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant