Skip to content

Commit 5177da3

Browse files
committed
📝 docs
1 parent a0f013f commit 5177da3

2 files changed

Lines changed: 13 additions & 6 deletions

File tree

apps/vscode/src/extension/conversation/conversation-projection.SPEC.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ scope:
55
- /apps/vscode/src/extension/conversation/**
66
- /apps/vscode/src/extension/sessions/SessionEntryState.ts
77
- /apps/vscode/src/shared/model/conversationModel.ts
8-
updated: 2026-08-01
8+
updated: 2026-08-08
99
---
1010

1111
# Conversation Projection
@@ -22,8 +22,7 @@ The Host emits one ordered `conversationItems` collection. A visual turn has its
2222

2323
- A user `message` opens a visual turn and supplies its stable `sourceEntryId`.
2424
- Assistant content becomes reasoning, response, and tool activities in protocol order. The persisted assistant identity is the session entry ID; a Pi message ID or timestamp is only a live-to-persisted correlation clue and never merges two persisted entries.
25-
- A tool result updates the activity identified by `toolCallId`; it is not a second visible activity. Assistant takeover relocates all reasoning, response, and embedded tool-call parts as one ownership unit, including the tool location. Once a persisted tool result arrives, delayed live tool events cannot replace its stable content.
26-
- A complete history replacement finalizes every tool still marked `running` as `cancelled`: FrostPi no longer has live tracking and did not receive a final result. This local status preserves partial output and may be replaced by a later persisted tool result.
25+
- A tool result updates the activity identified by `toolCallId`; it is not a second visible activity. Assistant takeover relocates all reasoning, response, and embedded tool-call parts as one ownership unit, including the tool location.
2726
- `compaction`, `branch_summary`, and `custom_message` are independent items at their active-path positions.
2827
- Compaction never removes or hides earlier active-path items. Nested `retainedTail` values are LLM-context metadata and are not expanded into transcript items.
2928
- Every `custom_message` with `display: true` renders generic text and image blocks. `display: false` messages and plain `custom` state entries are omitted.
@@ -41,13 +40,21 @@ Incremental ownership is preflighted before branch controls or conversation item
4140

4241
Incremental entries are accepted only when the reported leaf connects to the previous active leaf through the returned batch. Branch movement, an incomplete connecting chain, a correlation conflict, or a newly discovered control whose edge belongs before the appended segment requires a complete reload.
4342

43+
## Unresolved tool results
44+
45+
A tool is `running` only while FrostPi can still receive live execution updates. A persisted assistant `toolCall` records that an invocation exists; it does not prove that the invocation is still running or provide its final outcome.
46+
47+
Incremental assistant takeover therefore preserves the existing execution state and partial output for the same `toolCallId` while adopting persisted assistant ownership and placement. Only a matching persisted `toolResult` is authoritative for replacing that state with `complete` or `error`; delayed live tool events cannot replace content already owned by a persisted result.
48+
49+
A complete history replacement, `agent_settled`, process stop, or connection failure finalizes every still-running tool as `cancelled`. Here `cancelled` means live tracking ended before FrostPi received a final result. It preserves arguments and partial output, does not synthesize output, error, or end time, and does not alter the containing turn status. Incremental entry reconciliation alone is not a finalization boundary because the current Pi process may still be executing the tool.
50+
4451
## Turn lifecycle
4552

4653
A persisted user message closes the preceding visual turn and opens a user-anchored turn. Assistant `toolUse` keeps it active; an assistant error keeps an `error-awaiting-continuation` anchor so provider retry or context-overflow compaction continuation remains in that turn. A later success or abort closes it. A replacement, a new user entry, or the refresh after `agent_settled` finalizes an error that received no continuation.
4754

4855
Live `message_end(error)` displays the error activity but leaves the turn running until `agent_end` decides whether Pi will retry. `agent_end(willRetry: true)` keeps the running turn and `auto_retry_start` adds a notice; `willRetry: false` commits the pending error. This uses the existing turn statuses and does not persist retry notices.
4956

50-
While an agent run is active, queued follow-ups remain outside persisted conversation order. Pi may emit a follow-up user message without another `agent_start`; promotion follows protocol FIFO order and closes the prior visual turn. Abort, process stop, and process failure clear the local queue. `agent_settled`, process stop, and process failure also finalize unresolved running tools as `cancelled`; they do not infer a tool error or alter the turn status.
57+
While an agent run is active, queued follow-ups remain outside persisted conversation order. Pi may emit a follow-up user message without another `agent_start`; promotion follows protocol FIFO order and closes the prior visual turn. Abort, process stop, and process failure clear the local queue. Tool tracking at these lifecycle boundaries follows [Unresolved tool results](#unresolved-tool-results).
5158

5259
Live activity updates replace existing view objects instead of mutating them. This is required for bridge deltas and Webview-owned disclosure state. Documented assistant events provide an ID or timestamp correlation clue; a malformed live assistant without either is omitted until persisted refresh rather than emitted as an uncorrelatable duplicate. Notices emitted during an active turn remain inside its ordered items; idle notices are top-level conversation items.
5360

apps/vscode/src/extension/sessions/session-lifecycle.SPEC.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ scope:
55
- /apps/vscode/src/extension/sessions/**
66
- /apps/vscode/src/extension/conversation/**
77
- /apps/vscode/src/extension/extension-ui/**
8-
updated: 2026-08-01
8+
updated: 2026-08-08
99
---
1010

1111
# Pi Session Lifecycle
@@ -34,7 +34,7 @@ stopped ─ request ─> queued ─> starting ─ handshake ─> ready ─ agent
3434

3535
`failed` ends the current child process but leaves retryable metadata. Queued/starting sessions reject submission and model mutation while retaining session actions; running sessions keep the Composer editable and expose Stop. Prompt RPC success means accepted, not completed; only `agent_settled` returns a running session to ready.
3636

37-
`agent_end` closes one model attempt, not necessarily the user turn. With `willRetry: true`, the session remains running and conversation projection keeps the pending assistant error in the same user turn; `auto_retry_start` supplies the transient retry notice. With `willRetry: false`, the pending error may become final. `agent_settled` is the completion boundary: Runtime returns the session to ready, refreshes persisted entries, and may issue the one normal-completion notification. Assistant protocol errors remain errors when no continuation succeeds, while a tool failure remains visible without by itself failing the whole turn.
37+
`agent_end` closes one model attempt, not necessarily the user turn. With `willRetry: true`, the session remains running and conversation projection keeps the pending assistant error in the same user turn; `auto_retry_start` supplies the transient retry notice. With `willRetry: false`, the pending error may become final. `agent_settled` is the completion boundary: Runtime returns the session to ready, refreshes persisted entries, and may issue the one normal-completion notification. Assistant protocol errors remain errors when no continuation succeeds, while a tool failure remains visible without by itself failing the whole turn. Unresolved tool semantics and finalization boundaries belong to [`conversation-projection.SPEC.md`](../conversation/conversation-projection.SPEC.md#unresolved-tool-results).
3838

3939
`abort` stops the current run and keeps the process. A restart cancels pending extension UI, stops the child, and starts Pi with the recorded session file; active streams, tools, and pending requests do not survive. Disruptive explicit restart requires confirmation.
4040

0 commit comments

Comments
 (0)