Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
200 commits
Select commit Hold shift + click to select a range
e3f813b
Integrate Codex app-server support
juliusmarminge Apr 18, 2026
38e8782
nit
juliusmarminge Apr 18, 2026
329c5a7
revert more
juliusmarminge Apr 18, 2026
c0bd0a7
resynclock
juliusmarminge Apr 18, 2026
93c8304
Delay Codex provider availability until checked
juliusmarminge Apr 18, 2026
4082126
Return Cursor ACP runtime with explicit scope
juliusmarminge Apr 18, 2026
ec34774
Normalize Codex IDs and preserve streamed stdout decoding
juliusmarminge Apr 18, 2026
9a0f61c
Scope Codex session runtime lifetimes
juliusmarminge Apr 18, 2026
4cd90d5
decoders
juliusmarminge Apr 18, 2026
3c1438b
Flush native logs on adapter shutdown
juliusmarminge Apr 18, 2026
5ba1669
Switch Codex provider checks to app-server probe
juliusmarminge Apr 18, 2026
7277a13
Address Codex review feedback
juliusmarminge Apr 18, 2026
fae2f67
Fix Codex provider status test expectations
juliusmarminge Apr 18, 2026
c0b3f55
Add orchestration v2 docs and probe fixtures
juliusmarminge Apr 20, 2026
1428a6b
Add orchestration v2 replay and service contracts
juliusmarminge Apr 21, 2026
730a90d
Map Codex turns into orchestration v2
juliusmarminge Apr 21, 2026
0151fac
Implement orchestration v2 runtime
juliusmarminge Apr 24, 2026
fd06894
Add thread fork lineage and lazy context transfer
juliusmarminge Apr 29, 2026
d4bb99c
Add orchestration V2 backend checklist
juliusmarminge Apr 29, 2026
2ffe583
Add merge-back context handoff support
juliusmarminge May 2, 2026
232b900
Add V2 command capability policy
juliusmarminge May 4, 2026
eefe22f
Add Claude replay fixture recorder
juliusmarminge May 6, 2026
b9387ed
Extract Claude SDK query runner from provider adapter
juliusmarminge May 6, 2026
5723e03
Add model selection to orchestration runs
juliusmarminge May 6, 2026
0cc1566
Map Claude replay fixtures to multi-turn turns
juliusmarminge May 7, 2026
f1daadd
Map Claude turns to runtime query policies
juliusmarminge May 7, 2026
11941b0
Support active Claude steering and turn replay mapping
juliusmarminge May 7, 2026
cfab802
Add turn-interrupt replay coverage and protocol logging
juliusmarminge May 7, 2026
43775c7
Document Cursor SDK MCP projection for V2
juliusmarminge May 7, 2026
493c6b8
feat(orchestration-v2): wire claude adapter primitives
juliusmarminge May 27, 2026
ac5c3c2
feat(orchestration-v2): support cross-provider handoff
juliusmarminge Jun 8, 2026
7c8e541
fix(orchestration-v2): resolve cross-provider forks
juliusmarminge Jun 8, 2026
d00742c
feat(orchestration-v2): add merge-back replay coverage
juliusmarminge Jun 9, 2026
bb94196
fix(orchestration-v2): compose provider switch merge context
juliusmarminge Jun 9, 2026
b05f9d5
fix(orchestration-v2): preserve source history on merged switch
juliusmarminge Jun 9, 2026
535d570
Map orchestration v2 WS methods to auth scopes
juliusmarminge Jun 9, 2026
0d4b4cb
feat(orchestration-v2): model native subagents
juliusmarminge Jun 9, 2026
50519b9
wip
juliusmarminge Jun 14, 2026
75a9244
refactor(orchestration-v2): adopt host process spawn policy
juliusmarminge Jun 14, 2026
cefbec6
Add orchestration MCP toolkit
juliusmarminge Jun 17, 2026
db63a4f
Add Cursor SDK orchestration replay support
juliusmarminge Jun 17, 2026
c5f1d3e
Handle segmented Cursor turns and stable visible timelines
juliusmarminge Jun 18, 2026
a4b3d19
Add ACP replay harness and session lifecycle support
juliusmarminge Jun 19, 2026
fda8395
Add MCP thread management and Codex turn mapping
Jun 19, 2026
1eb8a68
Add Orchestration V2 application integration plan
Jun 20, 2026
d3345b8
Map orchestration turns to provider instances
Jun 20, 2026
30747b2
Share Codex sessions across orchestration threads
Jun 21, 2026
6d06a74
Align orchestration V2 with Effect service conventions
Jun 21, 2026
2dff627
Start orchestration V2 application services
Jun 21, 2026
beb7e83
Complete orchestration V2 application services
Jun 21, 2026
7be1216
Require MCP registry for V2 provider sessions
Jun 21, 2026
a7142cc
Remove MCP credential expiration
Jun 21, 2026
f67e22b
Guarantee MCP revocation during session release
Jun 21, 2026
c8448c4
Integrate orchestration v2 with the application runtime
Jun 21, 2026
b672bda
Split the V2 frontend plan into parity and enrichment phases
Jun 21, 2026
fd01fc7
Complete orchestration V2 frontend cutover
Jun 22, 2026
1ae8af3
Integrate orchestration V2 controls and process recovery
Jun 22, 2026
b5b2427
Handle preparing turns across provider orchestration
juliusmarminge Jun 23, 2026
b9baf23
Record created threads and subagent progress
juliusmarminge Jun 23, 2026
a852f35
Map thread panel into title bar and sidebar
juliusmarminge Jun 24, 2026
ffb9158
Reserve space for inline thread details panel
juliusmarminge Jun 25, 2026
8983c2d
Split open-in editor controls into panel and toolbar variants
juliusmarminge Jun 25, 2026
407e046
Hide subagent threads and simplify thread controls
juliusmarminge Jun 25, 2026
49550a6
Render mobile timelines from V2 turn items
juliusmarminge Jun 25, 2026
f446a5b
Enrich mobile V2 execution items
juliusmarminge Jun 25, 2026
01cd645
Expose V2 thread workflows on mobile
juliusmarminge Jun 25, 2026
e5ee276
Retire V1 client orchestration parity
juliusmarminge Jun 25, 2026
9ac2fd3
Add iOS associated domains for Clerk
juliusmarminge Jun 25, 2026
c7fcc74
Map Grok task envelopes to subagent lineage
juliusmarminge Jun 26, 2026
6e1a750
Adopt userdata-v2 and subagent activity mapping
juliusmarminge Jun 29, 2026
6c93cc2
Map nested Codex subagent threads correctly
juliusmarminge Jun 29, 2026
be00c9b
Clarify thread relationship icons and ordering
juliusmarminge Jun 29, 2026
e8d1586
Keep persistent cards visible in folded turns
juliusmarminge Jun 29, 2026
65c1675
Require Cursor API key for provider checks
juliusmarminge Jun 29, 2026
e2fa3cd
fix(web): align thread details panel controls and menus (#3606)
maria-rcks Jun 30, 2026
95b5089
Switch Cursor provider to the official SDK
juliusmarminge Jun 30, 2026
f684db1
Remove early access badges from Cursor and Grok
juliusmarminge Jun 30, 2026
e47f3d7
Allow provider switching via handoff in chat threads
juliusmarminge Jul 1, 2026
35ce26f
Fix Claude task turn mapping
juliusmarminge Jul 1, 2026
b804ade
feat: scheduled tasks (automations) (#3638)
juliusmarminge Jul 1, 2026
907b8e3
feat(orchestrator): Add shared provider continuation and background i…
mwolson Jul 9, 2026
89af90a
[orchestrator-v2] fix(orchestrator): Restore Claude session continuit…
mwolson Jul 12, 2026
0fd265b
[orchestrator-v2] fix(orchestrator): Codex background command complet…
mwolson Jul 12, 2026
e9518ad
fix(orchestrator): scope Claude MCP tool pre-approval (#3862)
PixPMusic Jul 20, 2026
7f6b5aa
feat(orchestrator): pass model options through MCP thread targets (#3…
PixPMusic Jul 20, 2026
edf1018
fix(orchestrator): align Claude permission replay with SDK
juliusmarminge Jul 20, 2026
226e73f
fix(ci): restore Claude permission request identity
juliusmarminge Jul 20, 2026
7adb940
test(desktop): expect orchestrator v2 state directory
juliusmarminge Jul 20, 2026
7fd9563
fix(claude): redact launch arguments from protocol logs
juliusmarminge Jul 20, 2026
e253ce1
fix(claude): preserve approvals with full-access sandbox
juliusmarminge Jul 20, 2026
69a150d
fix(claude): allow questions during plan mode
juliusmarminge Jul 20, 2026
fa0edcd
fix(claude): honor never-approval runtime policies
juliusmarminge Jul 20, 2026
fbddc55
fix(claude): enforce read-only tool availability
juliusmarminge Jul 20, 2026
e9db884
fix(claude): reopen queries after MCP credential rotation
juliusmarminge Jul 20, 2026
49b249a
fix(acp): release turns after interrupt timeout
juliusmarminge Jul 20, 2026
0f999f7
fix(acp): bind MCP credentials to activated threads
juliusmarminge Jul 20, 2026
6b6ac64
fix(orchestrator): harden Grok v2 lifecycle (#3578)
mwolson Jul 20, 2026
ed6c09a
fix(orchestrator): dedupe Grok continuation dispatch
juliusmarminge Jul 20, 2026
e4da2f2
fix(orchestrator): Harden Grok v2 runtime lifecycle
mwolson Jul 20, 2026
548feba
test(orchestrator): align integration fixtures
juliusmarminge Jul 20, 2026
a38db1a
fix(mobile): support Hermes collection sorting
juliusmarminge Jul 20, 2026
963d7c1
fix(grok): align ACP extensions with open source runtime
juliusmarminge Jul 20, 2026
67952a7
Render T3 MCP tools with branded timeline labels
juliusmarminge Jul 21, 2026
55fb867
Unify T3 MCP tool presentation across clients
juliusmarminge Jul 21, 2026
9493357
fix(orchestration): clarify agent delegation and scheduling
juliusmarminge Jul 22, 2026
ec8952f
fix(server): preserve released migration ordering
juliusmarminge Jul 24, 2026
606f26c
fix(web): restore v2 composer chrome
juliusmarminge Jul 24, 2026
99a3e7f
fix(web): remove stacked composer shadows
juliusmarminge Jul 24, 2026
b54148c
refactor(web): use shared glass surfaces
juliusmarminge Jul 24, 2026
944f162
fix(web): layer nested panel popups correctly
juliusmarminge Jul 24, 2026
8e8731d
fix(web): contain thread details panel effects
juliusmarminge Jul 24, 2026
4fa0818
test(orchestrator): Align post-merge CTM fixtures (#4193)
mwolson Jul 24, 2026
6430c41
fix(orchestrator): Preserve claude/codex post-interrupt recovery stat…
mwolson Jul 24, 2026
0cd29ae
test(orchestrator): align Codex approval reviewer replays (#4457)
juliusmarminge Jul 24, 2026
6f704ad
fix(orchestrator): hydrate shell cache and group multi-environment pr…
mwolson Jul 24, 2026
1e7e897
feat(subagents): disclose projected results consistently (#3866)
PixPMusic Jul 24, 2026
fd7a44e
Add worktree handoff and status tools to the t3-code MCP server (#3754)
nsxdavid Jul 24, 2026
a221a28
fix(mobile): wait for fork shell before navigation
juliusmarminge Jul 24, 2026
004e8a5
fix(server): keep derived threads awake
juliusmarminge Jul 24, 2026
a12f2cb
fix(server): enforce ACP auth and preserve fork provenance
juliusmarminge Jul 24, 2026
68cfbfa
fix(server): clean up Claude replay failures
juliusmarminge Jul 24, 2026
77a945b
test(orchestrator): align merged V2 compatibility checks
juliusmarminge Jul 27, 2026
dfcd73f
fix(grok): Prevent spurious wake run after in-turn monitors
mwolson Jul 21, 2026
91aa5d2
fix(acp): Preserve wake evidence across an app-owned wake
mwolson Jul 25, 2026
40bdeb0
fix(orchestrator): Wake settled parents when delegated children finish
mwolson Jul 25, 2026
b8c6ddf
fix(claude): Settle positive task-notification results
mwolson Jul 27, 2026
7a3d2d9
fix: hide subagent threads from v2 lists
Yusuf007R Jul 25, 2026
7127699
fix: ignore subagents when sorting sidebar projects
Yusuf007R Jul 25, 2026
c316cb0
fix(web): restore checked-in project scripts
juliusmarminge Jul 27, 2026
22a411b
chore(orchestrator): refresh checks after main sync
juliusmarminge Jul 27, 2026
6e4a26f
feat: migrate v1 state into orchestrator v2 (#4400)
juliusmarminge Jul 27, 2026
05aaa60
fix(orchestrator): schedule effects from durable deadlines (#4656)
juliusmarminge Jul 28, 2026
c6a0194
fix(orchestration): harden scheduled task startup
juliusmarminge Jul 28, 2026
d7b48b5
fix(mobile): preserve active thread state
juliusmarminge Jul 28, 2026
fc61935
fix(orchestration): preserve legacy schedule compatibility
juliusmarminge Jul 28, 2026
a01db51
fix(contracts): reject invalid legacy intervals
juliusmarminge Jul 28, 2026
4eb08e6
fix(acp): make xai cancellation reliable
juliusmarminge Jul 28, 2026
ba721ac
fix(orchestration): handle checkpoint-wait runs
juliusmarminge Jul 28, 2026
d00e713
fix(orchestration): cancel queued work on archive
juliusmarminge Jul 28, 2026
928ac7b
fix(mobile): allow archiving post-provider work
juliusmarminge Jul 28, 2026
78fc992
fix(mobile): distinguish queued and waiting archive states
juliusmarminge Jul 28, 2026
d38fa7f
fix(cursor): log close attempts before execution
juliusmarminge Jul 28, 2026
0b844af
fix(acp): discover final teardown descendants
juliusmarminge Jul 28, 2026
ddab872
fix(checkpoints): preserve valid run history
juliusmarminge Jul 28, 2026
9173665
fix(orchestration): preserve imported conversation state
juliusmarminge Jul 28, 2026
80fa117
fix(acp): enforce task and permission invariants
juliusmarminge Jul 28, 2026
cd5b2ff
fix(testkit): harden provider replay recording
juliusmarminge Jul 28, 2026
c8c102e
fix(server): isolate deterministic attachment ids
juliusmarminge Jul 28, 2026
838fd28
fix(claude): preserve explicit model options
juliusmarminge Jul 28, 2026
b7f4ea2
fix(web): enforce secure provider field defaults
juliusmarminge Jul 28, 2026
1d340ab
fix(client): preserve live thread relationships
juliusmarminge Jul 28, 2026
a51ecdc
fix(checkpoints): retain thread-start baseline after failed runs
juliusmarminge Jul 29, 2026
dd19778
fix(mobile): gate thread controls on live runs
juliusmarminge Jul 29, 2026
b21aef3
fix(orchestrator): address late review findings
juliusmarminge Jul 29, 2026
a264485
fix(orchestrator): handle fresh review edge cases
juliusmarminge Jul 29, 2026
d24006e
fix(orchestrator): harden provider edge cases
juliusmarminge Jul 29, 2026
d935d90
fix(orchestrator): execute resolved runtime responses
juliusmarminge Jul 29, 2026
f3a2eab
fix(orchestrator): release stranded effect claims
juliusmarminge Jul 29, 2026
fb509cc
fix(worktrees): make handoff rollback atomic
juliusmarminge Jul 29, 2026
8aaec8b
fix(orchestrator): avoid replaying settled effects
juliusmarminge Jul 29, 2026
7d8792c
fix(orchestrator): preserve retryable effect failures
juliusmarminge Jul 29, 2026
a7c6ad2
fix(orchestrator): preserve terminal effect outcomes
juliusmarminge Jul 29, 2026
26a0c36
fix(orchestrator): validate replay edge cases
juliusmarminge Jul 29, 2026
1881e60
fix(orchestrator): decode direct Claude result blocks
juliusmarminge Jul 29, 2026
4142b11
fix(orchestrator): close cancellation edge cases
juliusmarminge Jul 29, 2026
4c8bea5
fix(orchestrator): validate rollback and search links
juliusmarminge Jul 29, 2026
da08afb
fix(server): preserve project mutation client errors
juliusmarminge Jul 29, 2026
a9fb9c6
fix(orchestrator): preserve migrated and nested history
juliusmarminge Jul 29, 2026
2598610
fix: address orchestration review findings
juliusmarminge Jul 29, 2026
a46493a
fix(mobile): label queued message intent
juliusmarminge Jul 29, 2026
1ca8893
fix: address orchestration review findings
juliusmarminge Jul 29, 2026
c0e8191
fix: preserve orchestration task identity
juliusmarminge Jul 29, 2026
a0679d9
fix: address latest orchestration review findings
juliusmarminge Jul 29, 2026
7e70e34
fix: preserve thread management failure semantics
juliusmarminge Jul 29, 2026
c217050
fix: close failed provider adapter scopes
juliusmarminge Jul 29, 2026
f8b5aca
feat(server): surface legacy thread migration progress
juliusmarminge Jul 29, 2026
33541a8
feat(orchestration): track provider retries and thread visits
juliusmarminge Jul 29, 2026
2372583
[codex] feat(web): show git progress in the commit button (#4963)
juliusmarminge Jul 30, 2026
76f2c5e
perf(orchestration): per-thread shell deltas, visit throttling, event…
juliusmarminge Jul 30, 2026
d31c172
fix(chat): prevent stale timeline scroll and rerenders
juliusmarminge Jul 30, 2026
b3184c1
fix(relay): stop replaying the whole event store into the awareness r…
juliusmarminge Jul 30, 2026
f0a1c81
perf(web): keep timeline minimap animations off the main thread
juliusmarminge Jul 30, 2026
3f3b23b
feat(orchestration): port thread title regeneration to the v2 runtime
juliusmarminge Jul 30, 2026
263ae65
fix(orchestration): thread visits no longer create activity loops (#5…
Yusuf007R Jul 30, 2026
ec6f5bf
fix(orchestration): promoted queued messages keep the queued_turn intent
juliusmarminge Jul 30, 2026
1ce5ff5
refactor(orchestration): split thread-not-sendable into typed errors
juliusmarminge Jul 30, 2026
098b823
fix(web): remove elevated thread details panel styling
juliusmarminge Jul 30, 2026
55b1176
fix(web): keep Git progress title anchored
juliusmarminge Jul 30, 2026
5d34a13
fix: reconcile rebase with latest main
maria-rcks Aug 3, 2026
505fad9
fix(orchestration-v2): restore generated thread titles (#5176)
Yusuf007R Aug 4, 2026
b852b87
fix(orchestrator): Order thread lineage by creation time (#5310)
mwolson Aug 4, 2026
4901034
fix(server): restore worktree branch naming in the v2 orchestrator (#…
juliusmarminge Aug 4, 2026
d2e3b7d
feat(chat): refine V2 conversation UI (#5307)
maria-rcks Aug 4, 2026
749cef6
fix: adopt effect beta.103 APIs in rebased v2 code
juliusmarminge Aug 4, 2026
d36446e
fix: send mcp-protocol-version header in worktree registration test
juliusmarminge Aug 4, 2026
2dd6ade
fix(web): restore compact header sizing for project script controls
juliusmarminge Aug 4, 2026
c5e53c8
test(server): cover v2 thread title regeneration
juliusmarminge Aug 4, 2026
bc39163
perf(orchestration): avoid full history loads in runtime paths
tarik02 Aug 4, 2026
e303735
Merge remote-tracking branch 'upstream/t3code/codex-turn-mapping' int…
tarik02 Aug 4, 2026
41fcc34
fix(orchestration): preserve preparation items in runtime commands
tarik02 Aug 4, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 10 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,16 @@ jobs:
!/.repos/
sparse-checkout-cone-mode: false

# Blacksmith boots GitHub's Ubuntu runner image (gcc is usually present),
# but ACP process-tree live tests compile a small pthread fixture with `cc`
# and soft-skip when it is missing. Install build-essential so that path
# always runs in CI instead of silently no-oping.
- name: Install C toolchain for process-tree fixtures
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential
command -v cc

- name: Setup Vite+
uses: voidzero-dev/setup-vp@v1
with:
Expand Down
246 changes: 246 additions & 0 deletions .plans/19-thread-lineage-context-transfer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
# Plan: Thread Lineage And Lazy Context Transfer

## Summary

Implement the shared backend foundation for forking, provider handoff, merge-back, and future subagents without forcing provider selection at fork time. The first slice should create cheap app-level fork lineage and defer expensive context materialization until a run starts and the target provider is known.

Architecture reference: `docs/orchestration-v2/thread-lineage-and-context-transfer.md`.

## Goals

- Support user-created fork threads for exploration.
- Keep fork creation provider-neutral and cheap.
- Reuse the same source-point/context-transfer model for provider switching, merge-back, and future subagents.
- Prefer native same-provider fork at first dispatch when available.
- Fall back to portable context only when native transfer is unavailable or target provider differs.
- Keep all behavior replayable through V2 events/projections.

## Non-Goals For First Slice

- Full portable context generation quality.
- Cross-provider adapter implementation beyond the data/runtime hook.
- Merge-back UI.
- Native or custom subagent orchestration.
- Forking from actively streaming provider state.
- Backward compatibility with old dev databases.

## Core Data Model

Add schema/contracts for:

```ts
type ContextTransferType =
| "fork"
| "provider_handoff"
| "merge_back"
| "subagent_spawn"
| "subagent_result";

type ContextSourcePoint = {
threadId: ThreadId;
runId?: RunId;
checkpointId?: CheckpointId;
turnItemId?: TurnItemId;
providerThreadRef?: NativeThreadRef;
providerTurnRef?: NativeTurnRef;
};

type ContextTransferStatus =
| "pending"
| "resolved_native"
| "resolved_portable"
| "failed"
| "consumed"
| "superseded";
```

Persist:

- `orchestration_v2_projection_context_transfers`
- optional later portable handoff payload columns/table if the existing context handoff projection is not enough

For the first slice, `ContextTransfer` is required. Materialized `ContextHandoff` payloads can be deferred until portable context is implemented.

## Events

Add V2 events:

- `context-transfer.created`
- `context-transfer.updated`
- possibly `context-handoff.created` later

Do not emit provider-native fork details as app identity. Native fork refs belong in the transfer resolution payload and provider thread refs.

## Commands

Add:

```ts
type ThreadForkCommand = {
type: "thread.fork";
commandId: CommandId;
sourceThreadId: ThreadId;
targetThreadId: ThreadId;
sourcePoint:
| { type: "latest_stable" }
| { type: "run"; runId: RunId }
| { type: "checkpoint"; checkpointId: CheckpointId };
title?: string;
createdAt: string;
};
```

First-slice policy:

- `latest_stable` resolves to latest completed run checkpoint.
- explicit completed run/checkpoint is accepted.
- active run source is rejected or resolved to latest stable checkpoint; choose one policy and test it.
- target thread starts idle.
- no provider session/thread is created by `thread.fork`.

## Runtime Hook

Add a provider-neutral start-context resolver used by run startup:

```ts
resolveStartContext({
threadId,
runId,
provider,
modelSelection,
userMessage,
}): Effect<StartContextResolution, StartContextResolutionError>
```

Resolution order:

1. No pending transfer targeting the thread/run: normal run start.
2. Pending fork transfer and same provider with native fork support: resolve native fork.
3. Pending transfer requiring portable context: return explicit unsupported/stub result in first slice, or build minimal portable context if cheap.
4. Failed resolution: fail command before provider side effects.

The resolver should be called before provider thread creation/startTurn so the adapter can decide whether to create, resume, or native-fork provider state.

## Codex Native Fork Path

Investigate the app-server native fork API in `effect-codex-app-server` and Codex docs/probes.

Implementation target:

- use native fork only when source provider is Codex and source native refs are strong;
- create or bind a new `ProviderThread` for the forked native thread;
- when the source point is an earlier completed Codex provider turn, fork the latest native thread first and then rollback the forked native thread by later terminal provider turns;
- mark `ContextTransfer.status = resolved_native` and then `consumed` when the first run starts;
- preserve source app thread lineage separately from native thread refs.

If native API details are not clean, land the data model and resolver first with native fork marked unsupported, then add Codex native fork in a follow-up.

## Portable Context Fallback

The first slice should define the fallback boundary even if it does not fully implement high-quality summarization.

Minimum viable fallback:

- detect cross-provider fork/handoff need;
- create failed/unsupported transfer resolution with a clear command error, or
- generate a deterministic minimal context handoff from app projection if we want a usable MVP.

Do not silently concatenate hidden summaries into the user message without a `ContextTransfer`/`ContextHandoff` record.

## Merge-Back Preparation

Do not implement merge-back in the first slice, but keep model support:

- `ContextTransfer.type = "merge_back"`
- `basePoint` on transfer
- source thread may differ from target thread

The later merge-back command should create a transfer from fork latest stable point back to source thread and consume it with the next user message.

## Subagent Preparation

Do not implement subagents in this slice, but keep model support:

- `createdBy: "agent"`
- `type: "subagent_spawn"` and `"subagent_result"`
- source/target thread relationship fields

Native subagent ingestion can later map provider-native child refs into the same graph. Cross-provider app-owned subagents can later create child app threads using the same transfer primitive.

## Projection And Debugger

Backend projection first:

- expose thread lineage in thread projection;
- expose context transfers in debug projection;
- expose transfer status and resolution strategy.

Debugger after backend:

- fork button/control from stable source point;
- show thread lineage/source point;
- show pending/resolved/failed transfers;
- show native vs portable resolution.

Do not build debugger controls before the backend projection is authoritative.

## Tests

Use `bun run test`, not `bun test`.

Required backend tests:

- `thread.fork` from latest completed checkpoint creates target thread and pending transfer.
- fork command is idempotent through command receipts.
- fork does not create provider session/thread eagerly.
- first run on same-provider fork invokes native resolution path when capability exists.
- unsupported native fork falls back or fails according to explicit policy.
- active-run fork policy is deterministic.
- replay/recovery preserves target thread lineage and pending transfer.

Add test provider layers only at external service boundaries. Do not mock core orchestration policy.

## Implementation Order

1. Add contract schemas and ids for context transfers/source points.
2. Add migration/projection table for context transfers.
3. Add event store/projection handling for transfer events.
4. Add `thread.fork` command policy and orchestrator path.
5. Add tests for cheap idle fork creation and recovery.
6. Add start-context resolver interface.
7. Wire resolver into run startup with no-op behavior.
8. Add Codex native fork capability investigation and adapter path.
9. Add tests for same-provider native fork resolution.
10. Add debug projection surface after backend behavior is stable.

## Validation

Before considering the slice complete:

- `bun fmt`
- `bun lint`
- `bun typecheck`
- targeted backend tests with `bun run test`

If backend code changes are included, tests must cover the new orchestration behavior before the task is considered done.

## Implementation Status

Implemented in this slice:

- context transfer ids, schemas, JSON codecs, events, and projection storage
- app-thread lineage on thread creation and fork creation
- `thread.fork` command using `latest_stable`, explicit run, or explicit checkpoint source points
- cheap idle fork creation with no eager provider session/thread/run
- Codex same-provider native `thread/fork` resolution on first target dispatch
- Codex native fork-from-earlier-run resolution with `thread/fork` plus fork-local `thread/rollback`
- transfer status progression through `pending`, `resolved_native`, and `consumed`
- command receipt idempotency for duplicate fork commands
- replay-backed integration coverage for lazy fork creation and native Codex fork consumption

Explicitly deferred:

- portable `ContextHandoff` materialization for cross-provider forks/provider handoff
- merge-back command/runtime
- subagent spawn/result runtime
- debugger controls for creating/inspecting transfers
Loading
Loading