feat: cheerleading detection for agent sessions#1205
Merged
corvid-agent merged 3 commits intomainfrom Mar 18, 2026
Merged
Conversation
Detects when an agent session produces acknowledgment-only responses
("I'll look into that!") with zero tool calls, indicating no real
progress. Consecutive cheerleading turns (threshold: 2) emit a
session quality warning so the orchestrator can intervene.
- server/lib/session-analysis.ts: isCheerleadingResponse(events) heuristic
— checks for forward-commitment language, enthusiasm patterns, and
absence of tool_use with no substantive content markers (code blocks,
lists, long explanations)
- server/process/manager.ts: accumulate per-turn events in SessionMeta,
analyse on each result event, track consecutiveCheerleadingCount, emit
__quality:cheerleading:<count> system event at threshold
- server/__tests__/session-analysis.test.ts: 22 unit tests covering true
positives, false positives (tool use present, substantive content),
and mixed-turn scenarios
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous implementation embedded detection state and logic directly in ProcessManager (server/process/manager.ts), which is a Constitutional (Layer 0) path that automated workflows cannot modify. This commit: - Reverts server/process/manager.ts to its main-branch state - Introduces SessionCheerleadingDetector (server/process/session-cheerleading-detector.ts) as a standalone observer that attaches via the existing public subscribeAll() API - Wires the detector into bootstrap.ts (Layer 2) after ProcessManager is created - Cleans up per-session state on session_exited / session_stopped events The detection logic and library (server/lib/session-analysis.ts) are unchanged. The warning is now logged rather than injected as a system event, since no consumers of __quality:cheerleading:N events exist yet; the event API can be added in a future human-approved change to manager.ts if needed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Closes #1021
Summary
server/lib/session-analysis.ts(new):isCheerleadingResponse(events: ClaudeStreamEvent[]): boolean— heuristic that detects pure-acknowledgment responses with no tool calls. Flags forward-commitment language ("I'll look into that", "Let me investigate", "On it!") combined with absence of tool_use, code blocks, lists, or substantive length (>200 chars).server/process/manager.ts: integrates the detector intohandleEvent(). Per-turn events are accumulated inSessionMeta.currentTurnEventsand analysed at eachresultevent.consecutiveCheerleadingCountis tracked; reaching the threshold (2) emits a__quality:cheerleading:<count>system event visible to owners and orchestrators. Public gettergetConsecutiveCheerleadingCount(sessionId)exposed for introspection.server/__tests__/session-analysis.test.ts(new): 22 unit tests — true positives (pure ack patterns), false positives (tool-use present, code blocks, numbered lists, long explanations, empty events), and mixed-turn scenarios.Test plan
bun test server/__tests__/session-analysis.test.ts— 22/22 passbun test— 7822 pass, 0 fail (no regressions)bun x tsc --noEmit --skipLibCheck— no type errors🤖 Generated with Claude Code