Problem
Pylon's Prime daemon client cannot prove when one submitted prompt becomes the owner of streamed session events. The current connection request can prove rejection or session ownership, and queueIfBusy can retain work, but it does not provide an exact correlated delivery boundary.
Without that boundary, a background heartbeat, autonomous continuation, child completion, bash command, retry, or compaction that races prompt admission can be attributed to the foreground Pylon turn. Text matching is not valid evidence and fails for extension commands, slash commands, templates, images, and duplicate prompts. Session-wide cancellation and cumulative usage also cannot be assigned safely.
Pylon can fail closed by rejecting input while observed background work is active, but seamless safe queuing requires a Prime-native lifecycle contract.
Pylon application tracker: pylon-code/pylon#114
Fork parity tracker: #1
Upstream evidence
Decision: hybridize these upstream primitives behind a Pylon-owned, capability-negotiated daemon contract. Keep the stock-Prime fallback local and fail closed.
Proposed capability
Negotiate an additive correlated_prompt_lifecycle_v1 daemon capability. Do not infer support from a package version.
The exact schema should be finalized in implementation review, but it must provide these semantics:
- Every submitted prompt has an opaque correlation ID independent of prompt content.
- Lifecycle receipts distinguish at least
owned, queued, delivered, completed, cancelled, and failed.
delivered is emitted before any event attributed to that prompt.
- Session events identify their prompt correlation or explicitly remain background/session-scoped.
- Normal model prompts, built-in session commands, extension commands, asynchronously handled inputs, and injected prompts have explicit kinds. A native user transcript message is not the universal admission proof.
- Cancellation is scoped to one correlation ID and reports whether ownership or delivery already crossed the cancellable boundary.
- Reconnect provides a monotonic sequence plus enough retained active and terminal lifecycle state to reconcile without replaying or guessing.
- Usage is either correlated per lifecycle or bounded by exact correlated delivery/completion events. Background usage must not enter a foreground turn.
- Receipts and events expose no prompt text, native paths, private heartbeat instructions, or internal error details.
- Older clients and stock Prime remain compatible. Unsupported behavior degrades locally rather than blocking session attachment.
Acceptance criteria
- A daemon client can submit a prompt while background work is active and prove whether it is queued, delivered, cancelled, or terminal without inspecting content.
- Heartbeat, child-only, compaction, bash, retry, and autonomous events that precede delivery cannot acquire the prompt correlation.
- A new background run racing an older quiescence result cannot make the client observe false idle.
- Stop cancels only the pending prompt when delivery has not occurred; it does not abort an unrelated predecessor run.
- Slash and extension commands receive correct lifecycle receipts without requiring a
MessageCompleted user row.
- Reconnect distinguishes queued, delivered, terminal, unknown, and expired correlations without duplicating input.
- Deterministic tests cover stale, wrong, duplicate, and out-of-order receipts; cancellation races; reconnect; background usage isolation; and event ordering.
- Pylon integrates the capability for seamless safe admission and retains its conservative typed-busy fallback when the capability is absent.
Delivery shape
Implement this as two coordinated PRs:
pylon-code/prime-agent: capability, protocol/schema compatibility, lifecycle state, and focused daemon/connection tests.
pylon-code/pylon: capability negotiation, foreground ownership, projection quarantine, scoped cancellation, reconnect reconciliation, usage isolation, and focused adapter/runtime tests.
Do not merge either side until the cross-repository contract and compatibility tests are reviewed together.
Problem
Pylon's Prime daemon client cannot prove when one submitted prompt becomes the owner of streamed session events. The current connection request can prove rejection or session ownership, and
queueIfBusycan retain work, but it does not provide an exact correlated delivery boundary.Without that boundary, a background heartbeat, autonomous continuation, child completion, bash command, retry, or compaction that races prompt admission can be attributed to the foreground Pylon turn. Text matching is not valid evidence and fails for extension commands, slash commands, templates, images, and duplicate prompts. Session-wide cancellation and cumulative usage also cannot be assigned safely.
Pylon can fail closed by rejecting input while observed background work is active, but seamless safe queuing requires a Prime-native lifecycle contract.
Pylon application tracker: pylon-code/pylon#114
Fork parity tracker: #1
Upstream evidence
promptTurnId, ordered events, response boundaries, and terminal quiescence for ACP.AgentConnectionAPI still exposes no retained, correlated delivery/event-ownership receipt.Decision: hybridize these upstream primitives behind a Pylon-owned, capability-negotiated daemon contract. Keep the stock-Prime fallback local and fail closed.
Proposed capability
Negotiate an additive
correlated_prompt_lifecycle_v1daemon capability. Do not infer support from a package version.The exact schema should be finalized in implementation review, but it must provide these semantics:
owned,queued,delivered,completed,cancelled, andfailed.deliveredis emitted before any event attributed to that prompt.Acceptance criteria
MessageCompleteduser row.Delivery shape
Implement this as two coordinated PRs:
pylon-code/prime-agent: capability, protocol/schema compatibility, lifecycle state, and focused daemon/connection tests.pylon-code/pylon: capability negotiation, foreground ownership, projection quarantine, scoped cancellation, reconnect reconciliation, usage isolation, and focused adapter/runtime tests.Do not merge either side until the cross-repository contract and compatibility tests are reviewed together.