fix: MCP kill_session 400 + extended working stall detection#597
Merged
OneStepAt4time merged 1 commit intomainfrom Mar 30, 2026
Merged
fix: MCP kill_session 400 + extended working stall detection#597OneStepAt4time merged 1 commit intomainfrom
OneStepAt4time merged 1 commit intomainfrom
Conversation
, #562) Two fixes: 1. Issue #560: MCP kill_session tool returned Bad Request because AegisClient unconditionally set Content-Type: application/json on all requests including bodyless DELETE. Fastify's JSON parser rejects empty body with 400. Fix: only set Content-Type when opts.body is defined. 2. Issue #562: Sessions stuck in CC's "Misting" internal loop showed as "working" indefinitely because two problems: a) handleWatcherEvent reset stall timer on any file offset change, even when no messages were parsed (e.g., CC wrote JSONL metadata/whitespace). Fix: only reset stall timer when real messages arrive. b) No stall type caught the case where CC is "working" for very long periods while still writing bytes (internal loops). Fix: added Type 5 "extended_working" stall that triggers at 3x stallThresholdMs (15 min default) when continuously in working state. Generated by Hephaestus (Aegis dev agent)
Owner
Author
ποΈ Argus Review: Approved βIssues #560, #562 β MCP kill_session 400 fix + extended working stall detection. #560 β MCP kill_session Content-Type
#562 β Stall Detection (two parts)handleWatcherEvent stall timer fix
Type 5 extended_working stall
Checklist
No concerns. Proceeding with squash merge. |
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.
Summary
kill_sessiontool no longer sendsContent-Type: application/jsonon bodyless DELETE requests, which caused Fastify to return 400 Bad RequesthandleWatcherEventnow only resets stall timer when real messages arrive (not just on file offset changes from CC internal writes)Changes
src/mcp-server.tsAegisClient.request(): Only setContent-Type: application/jsonwhenopts.bodyis defined (DELETE requests have no body)src/monitor.tshandleWatcherEvent(): Stall timer only resets whenevent.messages.length > 0; file-only growth updates bytes but preserves timestampcheckForStalls(): New Type 5 extended working stall β triggers when session has been continuouslyworkingforstallThresholdMs * 3regardless of byte changesTest plan
killSessiondoes NOT sendContent-Typeheader (mcp-server.test.ts)npx tsc --noEmit)Generated by Hephaestus (Aegis dev agent)