Repository navigation
feat(cli): soft interrupt entry points — serve and MCP (#377, 2/2) - #393
Merged
Merged
Conversation
…t and tole_session_interrupt (#377, 2/2)
🔍 Cora AI Code Review✅ No issues found. Code looks good! Review powered by cora-code · BYOK · MIT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Part 2 of 2 of soft interrupts: the host entry points. Builds on the core merged in #391.
Why
#377. The owner needs a second client that can steer a running
serve/MCP-driven session without cancelling it.Changes
session_host.rs:interrupt_sessionshared by both faces. It refuses withNotBusywhen no turn is running (a stale message must not wait around and hijack the next, unrelated turn) and maps the queue's bounds (blank, oversized, 16 pending) toInvalid.serve.rs:POST /sessions/{id}/interruptwith{text, urgent?}—202queued,404unknown session,409no turn running,400bad JSON / missing, blank or oversized text.session_tools.rs:tole_session_interruptMCP tool (same ReadOnly classification astole_session_cancel; the steered turn's tools still pass the session approver, so no new authority).chathas no second client on stdin, so it is not wired; ACP has no interrupt method either. Both are out of scope here.Testing
tole servebinary against a scripted OpenAI-compatible server: a prompt whose first provider call takes ~2 s is interrupted at 500 ms (202); the stale answer is superseded, the next provider call carries the attributed interrupt, and the prompt returns the steered answer. Also covers 404 / 409 / 400 refusals.Refs #377