Skip to content

feat(server): orchestrator v2 core fixes (upstream G1) - #1002

Merged
rynfar merged 9 commits into
pylonfrom
upstream/2026-10-03-g1-orchestrator-core
Oct 3, 2026
Merged

rynfar merged 9 commits into
pylonfrom
upstream/2026-10-03-g1-orchestrator-core

Conversation

@rynfar

@rynfar rynfar commented Oct 3, 2026 •

Copy link
Copy Markdown
Collaborator

Ports upstream group G1, orchestrator v2 core fixes, onto pylon in upstream order. Pylon adopted v2 from upstream de34391427. Pylon's own v2 changes are kept: the #989 test exceptions, the #990 Codex reopen fix, and the ThreadLaunchService delta.

Sources

Upstream Outcome How
fd7ee2c30a lint: forbid tests in for loops (#14921) Adapted Adds t3code/no-test-in-loop and rewrites every flagged loop to .each. Where Pylon's file differed from upstream, Pylon's content stays and only the flagged loops changed. Pylon-only suites the rule flags were rewritten the same way: Prime daemon, legacy v2 bridge, Codex absolute history, provider, MCP, desktop, client-runtime and the vcs/settings tests. Test counts and names are unchanged. Upstream's reconcileV2PreviewMigration.test.ts does not exist in Pylon and is dropped.
ca7df394ed steers keep the newest next-turn selection (#14725) Adopted Clean.
736130c2fd working timers no longer reset on background wakes (#15029) Adapted The Sidebar.logic.ts conflict keeps the Working section helpers (#991) and takes only the updated resolveWorkingStartedAt doc comment. The timer value reaches web and mobile through client-runtime.
ca4f84e702 threads settle when an agent merges their PR (#15024) Adapted Clean, with "T3" changed to "Pylon" in overview.md. The reactor only re-reads open PR snapshots. ThreadSettlementService still decides settlement, so sidebarAutoSettleOnMerge and the per-thread auto-settle opt-out still apply; its tests pass.
6108ef3d3d runs no longer get stuck (#15048) Adopted, plus Pylon tests Clean. New LegacyAdapterV2SessionManager.test.ts covers the Prime bridge going through the new session-manager release path, listed below.
ddcd310282 docs, dev scripts and CI catch up with V2 (#15041) Partial Adopted: the migrate-dev-db V2 rewrite (default source ~/.pylon-code/userdata/statev2.sqlite, never ~/.t3), removal of the Orchestrator interrupt TODO and TODO.md, the stale comments, the vite manual-runtime debt list for deleted V1 tests, the mobile-showcase seed, and the devices link. Adapted: glossary and providers docs, in Pylon wording. Skipped: migration comment renumbering (Pylon numbers V2 as 68/69), T3 AGENTS.md/CONTRIBUTING.md/test-t3-app fixture docs, shardWeights.json, the CI gate requiring transfer-report, and the composer-context doc hunk (Pylon's doc has no stale reference).

Pylon adaptations

  • Prime bridge tests (apps/server/src/provider/legacy/LegacyAdapterV2SessionManager.test.ts). Three tests open the real bridge through ProviderSessionManager and wait on events and drain receipts, not sleeps:
    • Closing a session stops the legacy runtime and publishes the maintenance drain; the same test asserts a maintenance reservation fences new admission through the manager.
    • A release whose stopped record fails to commit still stops and drains, and the upstream retry records stopped once the store recovers.
    • A failed Prime daemon stream releases the session as error and drains.
  • Local development reference: .agents/references/local-development.md now snapshots statev2.sqlite, noting that pre-v2 installs may only have state.sqlite (migrate-dev-db then fails safely with source-missing; pass --source).
  • Codex reopen (fix(server): reopen Codex sessions whose app-server exited #990): OrchestratorReplayRecovery.integration.test.ts, the Codex adapter suite and the session-manager suite pass with the new release-record retries and ownership-read changes.
  • Glossary: the orchestration table takes the V2 terms but keeps "Reactor" and "Runtime receipt", which Pylon's AGENTS.md still uses.
  • migrate-dev-db: the doc and the test assertion now name statev2.sqlite.
  • Typing: PrimeAgentDaemonEvents.test.ts imports an untyped Vitest runner, so its .each callbacks got explicit case types.

Verification

  • vp test run src/orchestration-v2 src/provider/legacy scripts/migrate-dev-db.test.ts in apps/server: 1657 passed, 13 skipped, 1 environment failure. claude_result_is_error/claudeAgent fails only because this machine sets CLAUDE_CONFIG_DIR. It passes with env -u CLAUDE_CONFIG_DIR, as fix(server): reopen Codex sessions whose app-server exited #990 also noted.
  • The new bridge suite passed three times in a row.
  • Focused suites per source all pass: steering; ProjectionStore/runtimeLayer/threadExecution/Sidebar.logic; PullRequestSyncReactor/ProjectionSettlement/ThreadSettlementService; ProviderSessionManager/RunExecution/ProviderTurnStart/FoundationPersistence/Codex adapter/replay recovery; migrate-dev-db; mobile-showcase.
  • Every test file the lint commit changed passes, across server, desktop, client-runtime, contracts, shared, web, relay, mobile and scripts. The lint rule's own test passes, 8/8.
  • vp lint on every test file containing a loop reports no no-test-in-loop errors. vp fmt --check and vp lint on the changed files are clean apart from one existing warning in Orchestrator.ts.
  • Typechecks report no error TS: vp run -F t3, @t3tools/web, @t3tools/desktop, @t3tools/client-runtime, @t3tools/contracts, @t3tools/shared, @t3tools/mobile, t3code-relay, effect-acp.

Not verified

  • No UI capture. The only web change is a doc comment. The working-timer change is server and client-runtime data, checked by unit tests.
  • migrate-dev-db was not run against a real database. Only its isolated tests ran.
  • The full repository test suite was not run; CI covers it.

Part of upstream cycle #996.

🤖 Generated with Claude Code

juliusmarminge and others added 8 commits October 3, 2026 13:37
Adds the upstream t3code/no-test-in-loop oxlint rule and rewrites every
loop-declared test in Pylon to the .each form.

Pylon adaptation: files whose Pylon content diverged from upstream keep
their Pylon content (branding, extra tests, numbering) and only the flagged
loops were rewritten. Pylon-only test files that the rule flags (Prime
daemon, legacy v2 bridge, Codex absolute history, provider, MCP, desktop
and client-runtime tests) were rewritten the same way with unchanged test
counts and names. The upstream-only reconcileV2PreviewMigration test is not
present in Pylon and is dropped. Pylon's approved v2 test exceptions from
#989 (branding and migration-numbering assertions) are preserved.

(cherry picked from commit fd7ee2c30a7eeef910c99e7bc92e944526555db7)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adopted unchanged; the touched v2 files match Pylon's adopted baseline.

(cherry picked from commit ca7df394ed8151fa77f856beefa90bc60a785d60)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…(#15029)

Pylon adaptation: the Sidebar.logic conflict keeps Pylon's Working section
(#991) helpers unchanged and takes only the updated resolveWorkingStartedAt
doc comment; the timer value already flows through client-runtime.

(cherry picked from commit 736130c2fd39b85cd515fa2a41cd10c8a8a52630)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The reactor only refreshes open PR snapshots after a run that ran a merge or
close command; the settle decision stays in ThreadSettlementService, so
Pylon's auto-settle-on-merge setting and per-thread auto-settle opt-out
still apply. Pylon adaptation: overview doc says Pylon instead of T3.

(cherry picked from commit ca4f84e702428656665d53635e16251112091657)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Adopted unchanged; the touched v2 files match Pylon's adopted baseline.
Pylon's Codex app-server reopen fix (#990) lives in CodexAdapterV2 and the
replay recovery suite, which pass with the new release-record retries.

(cherry picked from commit 6108ef3d3d0ef2a598088a1bb64980580e935830)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Regression coverage for the upstream ProviderSessionManager release changes
with the Pylon Prime v1->v2 bridge: a closed bridge session stops the legacy
runtime and publishes the maintenance drain receipt, a maintenance
reservation fences new admission through the manager, a release whose
records fail to persist still drains and is recorded by the retry, and a
failed Prime daemon stream releases the session as an error and drains.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…V2 (#15041)

Partial port of upstream ddcd310282.

Adopted: migrate-dev-db prunes the V2 database (statev2.sqlite) by thread
family and recovery state, the Orchestrator interrupt TODO and TODO.md
cleanup, stale comments in storageCleanup and the lint rule, the
mobile-showcase seed keeping V2 projects, the removed manual-runtime debt
list for deleted V1 tests, and the devices.md link fix.

Pylon adaptations: migrate-dev-db defaults its source to
~/.pylon-code/userdata/statev2.sqlite (never ~/.t3); glossary and
providers docs take the V2 terms and the OpenCode 1.x/2.x section in Pylon
wording, keeping Pylon's reactor/runtime-receipt terms used by AGENTS.md.

Skipped: migration comment renumbering (Pylon numbers V2 as 68/69), T3
AGENTS.md, CONTRIBUTING.md and test-t3-app fixture docs, shardWeights.json,
the CI gate change requiring transfer-report, and the composer-context doc
hunk (Pylon's doc has no stale reference).

(cherry picked from commit ddcd3102827f520e3dff53b902111744c0ba2ced)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
The Prime daemon events test imports an untyped Vitest runner, so the
.each callbacks from the no-test-in-loop rewrite need explicit case types.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Oct 3, 2026
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 4.9 KiB 4.9 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.7 KiB 3.7 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 20.4 KiB 20.4 KiB 0 B (0.0%) 29.3 KiB ✅
Codex Live turn messages 2 2 0 (0.0%) 8 ✅
Claude Total thread wire 4.9 KiB 4.9 KiB −41 B (−0.8%) 6.8 KiB ✅
Claude Thread snapshot wire 3.7 KiB 3.7 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB −41 B (−3.4%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 20.8 KiB 20.7 KiB −41 B (−0.2%) 29.3 KiB ✅
Claude Live turn messages 2 1 −1 (−50.0%) 8 ✅

Baseline: 30ec43a · PR result: 660a328 · 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.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@rynfar
rynfar merged commit 8c7dcfc into pylon Oct 3, 2026
23 checks passed
rynfar added a commit that referenced this pull request Oct 3, 2026
Provide ThreadCommandExecutor to the ProviderEventIngestor layer in the
LegacyAdapterV2SessionManager test added by #1002. Expect the `waiting`
flag that #997 added to the pending background work shown for subagent
display names.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL 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.

2 participants