Feat support chat abort method#318
Merged
everettjf merged 4 commits intomicroclaw:mainfrom Apr 1, 2026
Merged
Conversation
- Add `chat_abort` module with global registry of active abort controllers keyed by run_id, using Arc<AtomicBool> for lock-free abort signaling - Add `AgentEvent::Cancelled` variant to explicitly signal cancellation instead of reusing FinalResponse with magic string - Wire chat.abort in ws.rs to call both chat_abort::abort_chat_run_by_id (sets AtomicBool) and run_control::abort_runs (notifies agent loop) - stream.rs registers runs at start, buffers text deltas for partial recovery, detects abort via STOPPED_TEXT return, publishes "aborted" event with partial text - RunHub tracks aborted flag; forward_run_event maps "aborted" to ChatEventPayload with state:"aborted" - Ignore spec/ directory
Log key checkpoints in the chat.abort handling path: - ws.rs: log completed abort with session_key, run_id, chat_id, aborted_count - run_control.rs: log abort_runs firing with run_count and source_ids - agent_engine.rs: log agent loop cancellation via notify - stream.rs: log when stream detects abort response - chat_abort.rs: debug-level logging for edge cases (not found, mismatch)
When MICROCLAW_SKIP_WEB_BUILD is set (e.g. in Docker builds), only verify that the required web assets exist — skip the mtime-based staleness check that can produce false positives due to Docker layer caching timestamp behavior. Fixes Docker Build CI failure. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
- Remove unused fields (started_at_ms, expires_at_ms, owner_conn_id) from ChatAbortControllerEntry. started_at_ms had a bug (Instant::now().elapsed() always ≈ 0) and expires_at_ms was never checked — both were dead code. - Simplify register_chat_run signature (drop unused owner_conn_id param). - Fix flaky tests: use unique keys per test instead of clear_all_runs() to avoid interference when tests run in parallel on the shared global registry. - Remove unrelated spec/ entry from .gitignore. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Contributor
|
Thank you |
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.
fix #317
Add ability to abort ongoing streaming chat runs via WebSocket RPC to give users control over long-running or unwanted agent responses.