History

rm tmp

Julius Marminge committed 8 months ago

Commit a01aaa31 parent 6df3c4218 files · +0 −5001Browse files

Showing the changes to docs (1 of 18 files). Show all

Unified · Split

docs/adr/0001-provider-runtime-lifecycle-ownership.md+0−40
@@ -1,40 +0,0 @@
1# ADR 0001: Provider Runtime Lifecycle Ownership
2
3## Status
4Accepted
5
6## Context
7Provider runtime streams can include auxiliary work (for example collab/child-agent turns) under the same provider session as a user-visible primary turn.
8
9The previous orchestration ingestion and checkpoint flows keyed lifecycle updates by `providerSessionId` alone. This allowed auxiliary `turn.completed` events to:
10
11- mark thread sessions as `ready` before the primary turn completed
12- clear `activeTurnId` for a still-running primary turn
13- emit checkpoint turn-diff summaries for auxiliary turns in the main thread timeline
14
15## Decision
16Define and enforce a lifecycle ownership invariant:
17
18- Only events in the primary thread/turn lane may mutate thread session lifecycle state (`status`, `activeTurnId`, `providerThreadId`) and checkpoint turn completion.
19- Auxiliary events may still append messages and activities.
20
21Current enforcement is implemented with scope guards:
22
23- Runtime ingestion only applies lifecycle transitions when the event targets the active primary scope (provider thread and active turn checks).
24- Checkpoint capture ignores `turn.completed` events from non-primary provider thread scope, and ignores non-active turn completions while a primary turn is active.
25
26## Consequences
27
28### Positive
29- Prevents premature loss of "working" state from auxiliary turn completion.
30- Prevents auxiliary changed-files/checkpoint cards from appearing as if they were primary turn completion.
31- Keeps useful auxiliary activity/message visibility.
32
33### Negative
34- Runtime events that omit thread/turn identifiers are treated conservatively in lifecycle transitions.
35- Full explicit lane modeling is still desirable in contracts for long-term clarity.
36
37## Follow-up
381. Add explicit runtime lane metadata (`primary` vs `auxiliary`) to canonical provider runtime events.
392. Persist orchestration-to-provider turn binding (`TurnId` <-> `ProviderTurnId`) for stronger reconciliation and replay safety.
403. Promote lifecycle ownership checks from heuristic guards to schema-level invariants once lane metadata is available.