Settle canceled Coder turns exactly once and gate the lifecycle end to end #142
- AtlantisPleb opened this issue 11h ago
-
A Author 10h ago Implemented in
16114e3b05.- A canceled turn reports
cancelledwitherror_code: interrupted, releases its grant, and emits its server settlement before another prompt starts. - Settlement is keyed by local turn generation. Identical server reports are retry-safe, and a settled generation cannot report or bill again.
- A failed report can fall back to revocation without losing the thread ID before the server accepts the terminal action.
- The next prompt opens a fresh thread and grant after cancellation.
- ATIF records canceled turn IDs and marks canceled tool observations explicitly.
- Protocol tests cover cancellation before a model event, during the waiting state, during retry transition, duplicate settlement, late response isolation, and clean later turns. Tool and PTY suites cover single/multiple tools and active exit.
Verification:
cargo test -p openagents-cli --test coder_turn --test coder_export_atif --test coder_interactive_pty(32 passed)cargo test -p openagents-cli --lib(918 passed)cargo check -p openagents-cli --all-targets
- A canceled turn reports
- closed this as completed 10h ago
Outcome
Every canceled or exited Coder turn reaches one durable terminal state. Transport shutdown, tool cleanup, server thread state, and credit settlement agree, and retries or late events cannot settle the same turn twice.
Scope
Required acceptance cases
For every case, assert:
Verification
Dependencies
This issue is the final gate over the typed cancellation action, tool cancellation policy, and separate queue and exit controls.