Repository navigation
feat(transcript): show cancelled tool calls and conversation optimization - #450
Merged
Merged
Conversation
…tion A ToolCancelled event marks the tool call it names cancelled, a new tool state the run's end leaves alone, and the tool card renders it muted with a (cancelled) tag. A ConversationOptimized event adds a muted info line with the message counts before and after.
…ities A tool_progress activity with status cancelled maps to ToolCancelled for its tool call id, and optimization_status to ConversationOptimized with the message and both counts. Every other tool_progress status stays ignored.
A tool call that still has no result when the user stops the run never ran - the CLI drops it with the run, and its approval expires. The transcript showed it as done. It now ends cancelled, and a run that ends on its own still finalizes its open calls as done. The stop-pending-tool e2e test stops a run at a Write approval and waits for the card to read (cancelled).
Contributor
|
🎉 This PR is included in version 0.55.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
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.
Resolves #442
Summary
The transcript now shows a cancelled tool call as cancelled and notes when the CLI optimized the conversation. The CLI sends both as
ACTIVITY_SNAPSHOTevents since inference-gateway/cli#1722 (infer v0.246.0):tool_progresswith statuscancelled, andoptimization_status. A run you stop also marks its unfinished tool calls cancelled instead of done.Changes
backend/src/agent.rs:activity()maps atool_progresswith statuscancelledtoToolCancelled { tool_call_id }, andoptimization_statustoConversationOptimized { message, original_count, optimized_count }. Every othertool_progressstatus stays ignored. Parser tests cover both.frontend/lib/tauri.ts: the two newAgentEventkinds.frontend/lib/transcript.ts:ToolStategainscancelled, and the transcript gains aninfoitem.ToolCancelledmarks that call cancelled, even one an earlier run already finalized.finalizeToolsonly changes tools stillrunning, and on a stopped run it marks themcancelled.frontend/components/Transcript.tsx: the tool card's colours come from a per-state lookup. A cancelled card is grey with a muted name and a(cancelled)tag, distinct from done and failed. The optimization renders as a muted centred line, "Conversation optimized - 40 to 12 messages".bun testcases (a cancelled call, a cancel after the run finished, a stopped run, the optimization line), thewrite-stoppedscenario ande2e/tests/stop-pending-tool.yaml.Verification
bun run build,cargo fmt --check,cargo clippy -- -D warnings,cargo check,cargo test(216 passed).bun test208 passed,cargo test -p desktop-e2epasses.stop-pending-tool.yaml6/6, plusapproval-approve.yaml,approval-deny.yamlandmulti-tool.yamlfor the tool cards around it.Notes for review
cancelledactivity. The CLI emits it only when a message queued mid-run is drained while the conversation still holds a tool call without a result (ensureConversationIntegrityfrombatchDrainQueueininternal/agent/loop/agent.go). The desktop cannot reach that deterministically. A Stop cancels before any drain, a stopped Bash returns a failed result, and the desktop queues prompts itself while a tool runs. The parser and reducer paths for the activity are covered by unit tests.cancelled, where it read asdonebefore - for example a Write stopped at its approval, which never ran. A run that ends on its own still marks open callsdone. This is what the e2e demos, and reverting that commit drops it.compact.enabled, a known context window, pastcompact.auto_at), so it has no e2e.Docs ticket
inference-gateway/docs#1119