Skip to content

fix(acp): derive v2 state from loop lifecycle - #15

Merged
danielkov merged 4 commits into
mainfrom
fix/acp-v2-loop-state-lifecycle
Aug 28, 2026
Merged

fix(acp): derive v2 state from loop lifecycle#15
danielkov merged 4 commits into
mainfrom
fix/acp-v2-loop-state-lifecycle

Conversation

@danielkov

@danielkov danielkov commented Aug 28, 2026

Copy link
Copy Markdown
Owner

Summary

Derive ACP v2 Running and Idle updates from authoritative agent loop lifecycle events instead of host calls to LoopDriver::next. This prevents no-work drives from reporting phantom turns while preserving lifecycle reporting across tools, background suspension, approvals, cancellation, failures, and autonomous background continuations.

Motivation

ACP hosts may call LoopDriver::next after a background task completion even when the result was already consumed by the active loop. Synthesizing state around that call produces an empty RunningIdle cycle, which clients render as an additional zero-duration turn.

Impact

ACP v2 clients now observe session state only when an owned logical turn starts and finishes. Background completion payloads remain available as structured notification content while their human-readable summaries are bounded.

The change releases agentkit-loop 0.10.10, agentkit-task-manager 0.10.7, agentkit-acp and agentkit 0.10.11, agentkit-adapter-completions 0.10.7, and agentkit-provider-anthropic 0.10.8.

Technical details

Paired logical-turn lifecycle

The loop tracks one active logical turn across model tool-call continuations and approval handling. No-work AwaitingInput emits no lifecycle events; terminal completion, background suspension, cancellation, and post-start errors emit one matching TurnFinished. Error cleanup repairs unanswered calls and ensures retries use a fresh turn identity.

ACP prompt ownership and cancellation

ACP maps owned loop start/finish events to Running/Idle and uses owner epochs to linearize prompt admission with terminal state publication. Cancellation checkpoints preserve Cancelled across completion and error races, while autonomous inference remains independently cancellable.

Background delivery

Background suspension appends one synthetic detach result before ending the logical turn. Task-manager wakeups resume pending background work without inventing ACP turns, approved asynchronous tasks preserve their originating task turn, and detached completions carry full structured results with bounded text summaries.

@danielkov
danielkov merged commit db9713c into main Aug 28, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant