refactor: clear readability pauses in the client, orchestrator, and entrypoint - #121
Merged
Merged
Conversation
aliasunder
added this pull request to stack #122
September 30, 2026 18:12
Contributor
|
umm-actually re-reviewed at 1 new finding(s) posted (6 tracked finding(s) across all runs). umm-actually · deepseek/deepseek-v4.1-flash |
…ntrypoint - client.ts: define the ladder on ModelAttempt.model, rename the failed attempt's `abort` flag to `keyRejected` (and its status set to match), compute the call deadline and its timeout summary once, debug-log the two skipped cost-lookup paths, rename the per-model attempt counter to `modelAttemptNumber`, and state why a context overflow continues. - orchestrate.ts: replace step-numbered comments with sentences, make the rename check an early return, use sumBy, name the cost-summary flag for what it gates, and state the identity check and the 422 logging owner. - config.ts: an empty fallback_model parses to null once; main.ts and the settings log read it as is. - main.ts: use describeError and name what keeps the cancellation cleanup from throwing. Log output changes: "review attempt failed" reports `modelAttemptNumber` instead of `attemptNumber`, and a skipped cost lookup logs at debug. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s match the code - ReviewRequestError.aborted becomes keyRejected, matching SingleAttempt; run-stages reads it through isKeyRejected - getCallDeadline becomes getCallTimeout, and its doc states the tie - The success log's attemptCount becomes totalAttemptCount beside the failure log's modelAttemptNumber, in the client and the stage runner - Issue-comment posting names its group for both members (beyond-diff and rerouted findings), and its log lines say issue comment - The diff-budget, dedup, deleted-path, cancellation, and empty-input comments state what the code does - The cancellation warning reports whether a check run was open Ship-Check: code-quality · claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The fetchBotIssueComments and renderStandaloneFinding docs called every issue-comment finding beyond-diff, but in-diff findings whose inline anchors GitHub rejected post the same way. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The real @openrouter/sdk always exposes generations, so the optional member and the no-client skip existed only for test stubs. Stubs now provide it, the skip branch and its debug line are gone, and the test that covered only that branch is removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…jected skip - readChangedFiles gets its whole changedPaths list, so a dropped rename path, an added /dev/null, or a deleted file's path fails a dedicated test. - The "findings posted as issue comments" info line is asserted with a count that leaves out a failed post, and it stays silent when no post lands. - runStages skips later stages only when keyRejected is true. A failure carrying keyRejected: false runs them, and the skip warning names the skipped phases. Ship-Check: test-audit · claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
aliasunder
force-pushed
the
refactor/pr120-readability-cleanup
branch
from
September 30, 2026 18:36
470b2d7 to
9a7935d
Compare
GitHub rejects the inline review whole on a 422, so every in-diff finding in it posts as an issue comment, not only the one with the bad anchor. The renderStandaloneFinding doc, the rerouted field, and the issue-comment group comment now say so. The diff-exclusion comment names every excluded file, not only generated ones, and ModelAttempt.model points at where the routed model is actually reported. Ship-Check: bug-check · claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Every failure-path test ran with cost_summary on, so dropping describePipelineFailure's includeCostSummary guard left the suite green. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The inline-review and issue-comment summary lines logged only counts, so an operator could not tell which findings went where without diffing the PR against the model output. Both now carry file:line locations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A finding re-posted as an issue comment after GitHub rejects the inline review rendered the beyond-diff location note, which misstated a finding on a changed line. Beyond-diff and re-routed findings now render through separate functions that share one body, and the orchestrator pairs each finding with its renderer where it builds the post list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Summary
Two stranger reads of
src/openrouter/client.ts,src/orchestrate.ts, andsrc/main.tsfound places where a reader new to the code had to stop and trace. This PR fixes the ones in code these files own: comments that didn't match the code, names that meant two things, duplicated logic, silent branches, and a production branch that existed only for test stubs.One review output changes: a finding re-posted after GitHub rejects the inline review no longer says it sits beyond the diff. Log output changes are listed below.
Changes
src/openrouter/client.tsModelAttempt.modeldoc. It defines the ladder (the primary model, then the fallback), and says the routed model is reported only for the accepted attempt, asStructuredReviewResult.modelUsed.keyRejectedeverywhere:abort)ReviewRequestError's field (wasaborted)KEY_REJECTED_STATUSESisKeyRejected(wasisAbortedRequest)getCallTimeout. It computes a call's timeout and its timeout summary once. The chat request and the cost lookup used to compute both separately.lookupGenerationCostlogs at debug when the review deadline has already passed, where it used to return silently.OpenRouterLike.generationsis required. The real SDK always has it, so the optional member and its no-client skip existed only for test stubs.modelAttemptNumber, and the total across the ladder is nowtotalAttemptCount. Before,attemptNumberandattemptCountsat side by side and were easy to confuse.Promise.tryforwards the abort signal tostartrequestReviewchecks the review budget before each attemptsrc/orchestrate.tsbudgetHalfis nowdiffTokenLimit.changedPaths. A deleted file returns nothing, instead of anullthat a later filter removed. A rename returns its new and old paths.issueCommentPosts, which pairs each finding with its rendered body, and the log text matches.sumBy.describePipelineFailuretakesincludeCostSummary.renderCostSummarysits beside the other return values.src/config.tsandsrc/main.tsfallback_modelparses tonullinconfig.ts. It used to be normalized in two different ways, inmain.tsand in the settings log.main.tsusesdescribeErrorfor unhandled rejections.priority_docsexception to "empty selects the default".src/github/client.ts: its doc for the issue-comment group now names both members.src/review/comment-mapping.tsrenderBeyondDiffFindingandrenderReroutedFindingreplacerenderStandaloneFinding. They share one body and differ only in the location line.Log output changes
review attempt failedattemptNumbermodelAttemptNumberreview response accepted,review phase completedattemptCounttotalAttemptCountbeyond-diff findings postedfindings posted as issue comments, withlocationsfindings review postedwithinlineCount,reviewUrllocationsfailed to post beyond-diff finding — …failed to post finding as an issue comment — …cancellation signal received — closing the check runcancellation signal received — closing any open check run before exit, withcheckRunOpengeneration cost lookup skippedat debug, withreasonTests
changedPathsis asserted as the exact ordered path list, which catches a dropped rename path or a dropped/dev/nullguard.keyRejectedistrue.fallback_modelkeeps its value, and an empty one parses tonull.cost_summaryis off.locations.Verification
npm test: 810 passednpm run lintandnpm run buildare clean.🤖 Generated with Claude Code