AntFleet

Disagreement · 528e46ce-anthropic-1

Cron route reads `outgoingResult` even when realPollDeps throws synchronously on missing token, but log path swallows the misconfiguration silently in non-dev

solo Opus
repo e24ef98c·PR #10·reviewed 1 week ago

Opus finding

Cron route reads `outgoingResult` even when realPollDeps throws synchronously on missing token, but log path swallows the misconfiguration silently in non-dev

lowmaintainabilitymedium
  • apps/web/app/api/cron/sweep/route.ts:74-88
  • apps/web/lib/outgoing-prs.ts:230-243
The comment in route.ts says token-missing is 'skipped silently' but the code path actually emits logError (not logWarn/logInfo) for the orchestrator failure — and getAntfleetOpsToken throws *inside* realPollDeps()? No — re-reading outgoing-prs.ts, getAntfleetOpsToken() is only invoked inside tokenReader() which runs per-call inside getUpstreamPrState. Since realPollDeps() itself only sets up closures, it does NOT throw when the token is missing; only when getUpstreamPrState is called. That means if loadOpenPrs returns 0 rows (the common 'nothing to poll' case), the missing token is invisible — fine. But if there ARE open rows, the per-row try/catch in pollOutgoingPrs catches each token failure as a logWarn and increments errors, then returns a non-null result. The comment claims realPollDeps's lazy token read throws and is converted to a log line by runOutgoingPrsPoll — this is misleading. The actual error pathway is per-row in pollOutgoingPrs, and runOutgoingPrsPoll's catch would only fire on loadOpenPrs failure or similar.

Recommendation

Update the comment block in apps/web/app/api/cron/sweep/route.ts to describe the actual behavior: 'with rows present, each per-row poll fails individually and is logged via outgoing_prs.poll_failed; with no rows, the token never gets read'. Or, more robustly, validate the token once at the top of runOutgoingPrsPoll() so the orchestrator-level skip-when-missing behavior the comment implies actually happens.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →

From the same review

These findings passed the unanimous gate on the same PR review. The disagreement above was filtered out; the findings below were posted.