Skip to content

Resolving 41 Code Review Comments in a Single Session

An AI agent processed 41 code review comments from Greptile's automated review, created individual todos for each, fixed 36, and provided explicit technical justifications for the 5 it intentionally skipped.

OpenCode OpenCode / antigravity-claude-opus-4-5-thinking 3.2M tokens 235 messages ~3 hours 32 files

PR 425 on the feat/mcp-integration branch triggered an automated code review from Greptile. Forty-one comments spread across model files, OAuth utilities, MCP service layer, tool registry, integration endpoints, and frontend components. I dropped the review markdown into the conversation and asked the agent to handle it.

The first thing it did was parse all forty-one comments and create a numbered todo for each one — not to work through blindly, but to have a complete picture before deciding what to fix. Then it grouped them by type to understand the scope: eight type-safety comments, six error handling gaps, four security issues, three performance problems, five consistency violations, five frontend issues, three missing test cases, two missing JSDoc blocks. That accounting told it which areas needed careful reading before touching anything.

The fixes themselves were methodical. The type-safety pass replaced Any with concrete types across the model layer, fixed Optional[str] annotations that were missing in OAuth utilities, and added proper enum types to status fields that had been using raw strings. The error handling pass added try/except blocks around MCP connection calls with proper error propagation, added rollback logic to an endpoint that was modifying two database tables without rolling back the first on failure of the second. The security fixes addressed one endpoint that was logging the full token value in debug output and another that was accepting user input without validation before passing it to a subprocess call. The performance pass removed an N+1 query in the integration list endpoint — it was calling the database once per integration to fetch metadata that could be batch-fetched — and added lazy=True to a heavy import that was slowing module load time.

The more interesting part was the five comments the agent declined to fix. Greptile suggested adding a caching layer to tool loading. The agent’s response: the tool registry already implements caching internally — adding a second cache layer above it would create cache invalidation bugs where stale data from the outer cache survived after the inner cache was cleared. Another comment suggested adding a connection pool for MCP connections. The agent noted that MCP connections are inherently per-request in this architecture; a pool would hold connections open that can’t be safely reused across requests with different authentication contexts. A retry-logic suggestion was declined because retry logic already exists at the transport layer in the MCP client library — duplicating it at the application layer would multiply backoff delays exponentially on failure. Two magic number extractions were declined for opposite reasons: one was a JSONRPC error code defined by the protocol specification where extracting it to a named constant would actually obscure the protocol intent, and one OpenTelemetry instrumentation suggestion was deferred to a dedicated observability PR because adding it inline would obscure the control flow in a PR already touching thirty-two files.

The final delivery was a table: thirty-six completed with file and line references, five skipped with specific technical justifications. Not just “I skipped these” — explanations that demonstrate understanding of the system’s architecture deep enough to know why a superficially reasonable suggestion would cause problems.

Hello, World