Skip to content

refactor: one timing budget and shared candidate checks in pull request reviews - #42

Merged
hyochan merged 3 commits into
mainfrom
refactor/review-structure
Nov 20, 2026
Merged

hyochan merged 3 commits into
mainfrom
refactor/review-structure

Conversation

@hyochan

@hyochan hyochan commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

Summary

A structure cleanup of the review code that changed over the last day (PRs 37–41), from four independent cleanup reviews (reuse, simplification, efficiency, altitude). Behavior is unchanged except where noted.

  • One timing budget in reviewWithContext. The timing constants form one commented timeline at the top of workflow.ts: REQUEST_END_MS, REQUEST_TIMEOUT_MS, the final and late end targets, MIN_SLOW_TIMEOUT_MS, SLOW_REQUEST_MIN_MS and OPTIONAL_PASS_CUTOFF_MS.
    • COVERAGE_REQUEST_CUTOFF_MS is renamed to OPTIONAL_PASS_CUTOFF_MS. It also gates second looks and the second check now, and its old comment cited a two-minute request limit that no longer holds.
    • Three closures replace the scattered arithmetic: beforeOptionalCutoff(), slowRequest(endMs, maxMs) and lateRequest(). They replace three copies of the cutoff test, two hand-written timeout clamps and four timeoutMs/minTimeMs pairs.
    • The timeout verify only passed along is gone: verify times its first check when it is entered, before the guard, as before. The second check now computes its own timeout when sent instead of reusing the first check's. That is the only timing difference, and the end time still caps it.
  • Shared candidate checks. findingPath and validateEach (keep the candidates that validate, return the rest), plus the confidentItems closure (decode, confidence floor, cap), replace three near-copies in coverage passes, second looks and the closing synthesis. Each caller keeps only its own rule for where rejected findings count as not reviewed.
  • Verification reads as control flow.
    • The two instructions are named constants (VERIFY_INSTRUCTION, RECHECK_INSTRUCTION).
    • The request takes one options object instead of seven positional arguments.
    • The trace takes the refuted candidates explicitly, a set replaces repeated scans, and the duplicate comment is gone.
  • Small items:
    • rebuildWithinBudget() replaces three copies of the rebuild-and-trim loop, and the always-true turn-start condition is dropped.
    • CONVERSATION_BYTES replaces the repeated 180 KB literal, and REVIEW_TURNS - 1 replaces the literal 7.
    • withTruncation() replaces four copies of the source mapping.
    • The Claude usage check rejects a bad input count directly. systemPrompt is computed once.
    • EFFORTS is shared, and the stale "stop after two minutes" comment on own-key models is corrected.
    • The trace step count is taken in the same loop.

Left for later

  • Caching verification and second-look critiques, which resend sources at full price (efficiency review). That is a cost change, not a cleanup.
  • An explicit { context, state } split in reviewContextMessage, replacing the TURN_STATE_KEYS allowlist and the way second looks take apart the last request. It changes the context module's interface.
  • One "not reviewed" set replacing doubtfulPaths, coverage's doubtful set and the excludedPaths pushes.
  • A tri-state showRead, one options object for request(), and a single-pass cachedPrefixBytes (findLastIndex is not in the Convex target library).

Verification

🤖 Generated with Claude Code

@gitdogai gitdogai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 potential issue in 82d4367

Not a merge approval. Tests were not run. Gitdog

Comment thread convex/pullRequests/workflow.ts Resolved
@hyochan

hyochan commented Nov 20, 2026

Copy link
Copy Markdown
Member Author

@gitdogai review

@gitdogai gitdogai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found in 20058d1

Reviewed the 1 file changed since 82d4367.

Approved because no issues were found in fully reviewed changes. Tests were not run. Gitdog

@hyochan
hyochan merged commit b9457ff into main Nov 20, 2026
7 checks passed
@hyochan
hyochan deleted the refactor/review-structure branch November 20, 2026 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant