Conversation
Break down two ~100-line methods into focused, single-responsibility helpers while preserving the public API contract. send() (was ~100 lines, now ~40): - _process_assistant_message(): text collection + rate limit detection - _apply_result_message(): cost/token extraction + event publishing - _read_tool_state(): ToolState consumption with reset semantics - _build_success_result(): output assembly + PR URL extraction _build_options() (was ~100 lines, now ~58): - _build_mcp_servers(): MCP server dict construction - _build_allowed_tools(): conditional tool list assembly - _BASE_ALLOWED_TOOLS, _WORKSPACE_TOOLS, _COMM_TOOLS as Final tuples Adds 5 characterization tests covering previously untested contracts: - mailbox/comm branch in _build_options() - tool_state.needs_info_requested consumption/reset in send() - tool_state.proposals consumption/reset in send() - AGENT_OUTPUT event publishing per TextBlock Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR SummaryLow Risk Overview Refactors Adds characterization tests to lock in behavior around Written by Cursor Bugbot for commit 8a22d29. This will update automatically on new commits. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
session_id was written during construction but never read from the tuple. The value is already persisted via self._session_id side effect in _apply_result_message before the tuple is returned. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Summary
AgentSession.send()(~100 lines → ~40) into 4 focused methods:_process_assistant_message(),_apply_result_message(),_read_tool_state(),_build_success_result()AgentRunner._build_options()(~100 lines → ~58) by extracting_build_mcp_servers(),_build_allowed_tools(), and moving hardcoded tool lists intoFinal[tuple]constantsTest plan
test_agent_runner.pytests pass (61 existing + 5 new)ruff check— cleanruff format --check— cleanmypy— no issues🤖 Generated with Claude Code