ci(models): payload-aware model selection for GitHub Models#2587
Conversation
…oad-aware selection - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens`. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts and pass them to the picker.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
🚀 Deployment Details (Last updated: Jun 19, 2026, 12:37 PM PST) 🚀 Pushed to gh-pages; publish in progress
|
🐙 GitHub Models Code Review
Reviewing: PR #2587 Code Review FeedbackHIGH SEVERITY REVIEW 1. Blocking Bug: Incorrect
|
…oad-aware selection - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens`. - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts and pass them to the picker.
Enhanced the code review orchestrator to provide full source context for
imported components, types, and constants referenced in a PR's diff.
- Implemented ESM import parsing and path resolution in `codeReviewOrchestrator.ts`.
- Updated `getCodeDiffSummary` to identify used symbols and aggregate their source files.
- Modified Gemini and GitHub Models clients to include this external context in prompts.
- Updated fallback diff command to `main...HEAD` for more reliable branch analysis.
- Improved parsing of inline type imports (e.g., `import { type X }`).
This removes "if not typed" hedging by grounding the LLM in the actual
interface and constant definitions.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build.
…oad-aware selection - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens` (with 20% headroom). - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts. - Fixed `githubModelsVisualReviewClient` to use character count instead of byte count for estimation.
- Correctly extract base reference from `diffCommand` for context gathering. - Use `--` in `git diff` to avoid ambiguity with filenames. - Fix ESLint `no-useless-assignment` error in `resolveImportPath`. - Ensure robust symbol identification in diff hunks. These fixes ensure the AI reviewer receives the full source context for imported symbols, resolving the "hedging" problem identified in PR #2548.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build.
…oad-aware selection - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens` (with 20% headroom). - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts. - Fixed `githubModelsVisualReviewClient` to use character count instead of byte count for estimation.
…oad-aware selection - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens` (with 20% headroom). - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts. - Fixed `githubModelsVisualReviewClient` to use character count instead of byte count for estimation.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict.
…oad-aware selection - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens` (with 20% headroom). - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts. - Fixed `githubModelsVisualReviewClient` to use character count instead of byte count for estimation.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict.
Enhanced the code review orchestrator to provide full source context for imported components, types, and constants referenced in a PR's diff. - Implemented ESM import parsing and path resolution in `codeReviewOrchestrator.ts`. - Updated `getCodeDiffSummary` to identify used symbols and aggregate their source files. - Modified Gemini and GitHub Models clients to include this external context in prompts. - Refined fallback logic for `git diff` commands to handle varied CI environments. - Implemented `escapeRegExp` for safe symbol matching in diff hunks. - Tightened context capping logic to ensure token efficiency. This removes "if not typed" hedging by grounding the LLM in the actual interface and constant definitions.
- Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens` (with 20% headroom). - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts. - Fixed `githubModelsVisualReviewClient` to use character count instead of byte count for estimation.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict.
…oad-aware selection (Final) - Updated `GitHubModel` interface to include `limits`. - Modified `pickOptimalModel` to accept `estimatedInputTokens` and filter models based on `max_input_tokens` (with 20% headroom). - Implemented conservative filtering: exclude models without explicit limits if an estimate is provided. - Added type safety for `max_input_tokens` coercion. - Updated `githubModelsCodeReviewClient` and `githubModelsVisualReviewClient` to estimate token counts. - Fixed `githubModelsVisualReviewClient` to use character count instead of byte count for estimation.
Enhanced the code review orchestrator to provide full source context for imported components, types, and constants referenced in a PR's diff. - Implemented ESM import parsing and path resolution in `codeReviewOrchestrator.ts`. - Updated `getCodeDiffSummary` to identify used symbols and aggregate their source files. - Modified Gemini and GitHub Models clients to include this external context in prompts. - Refined fallback logic for `git diff` commands and `baseRef` extraction. - Expanded path resolution to include `.d.ts` files. - Implemented `escapeRegExp` for safe symbol matching in diff hunks. - Tightened context capping logic to ensure token efficiency. This removes "if not typed" hedging by grounding the LLM in the actual interface and constant definitions.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict.
- Updated `GitHubModel` interface to include optional `limits`. - Enhanced `pickOptimalModel` in `scripts/lib/modelPicker.ts` to filter models by `max_input_tokens` (with 20% headroom). - Implemented strict filtering: exclude models without explicit limits if `estimatedInputTokens > 0`. - Added defensive type coercion for `max_input_tokens` API response. - Updated `githubModelsCodeReviewClient.ts` to calculate token estimate from diff context. - Updated `githubModelsVisualReviewClient.ts` to calculate token estimate from DOM diff character length. Verified with tests and addressed all automated code review feedback.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict. No high-severity issues were identified. Final submission.
- Updated `GitHubModel` interface to include optional `limits`. - Enhanced `pickOptimalModel` in `scripts/lib/modelPicker.ts` to filter models by `max_input_tokens` (with 20% headroom). - Implemented strict filtering: exclude models without explicit limits if `estimatedInputTokens > 0`. - Added defensive type coercion for `max_input_tokens` API response. - Updated `githubModelsCodeReviewClient.ts` to calculate token estimate from diff context. - Updated `githubModelsVisualReviewClient.ts` to calculate token estimate from DOM diff character length. Verified with tests and addressed all automated code review feedback.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict. No high-severity issues were identified. Final submission.
- Updated `GitHubModel` interface to include optional `limits`. - Enhanced `pickOptimalModel` in `scripts/lib/modelPicker.ts` to filter models by `max_input_tokens` (with 20% headroom). - Implemented strict filtering: exclude models without explicit limits if `estimatedInputTokens > 0`. - Added defensive type coercion for `max_input_tokens` API response. - Updated `githubModelsCodeReviewClient.ts` to calculate token estimate from diff context. - Updated `githubModelsVisualReviewClient.ts` to calculate token estimate from DOM diff character length. Verified with tests and addressed all automated code review feedback.
Enhanced the code review orchestrator to provide full source context for imported components, types, and constants referenced in a PR's diff. - Implemented ESM import parsing and path resolution in `codeReviewOrchestrator.ts`. - Updated `getCodeDiffSummary` to identify used symbols and aggregate their source files. - Modified Gemini and GitHub Models clients to include this external context in prompts. - Refined fallback logic for `git diff` commands and `baseRef` extraction. - Expanded path resolution to include `.d.ts` files. - Implemented `escapeRegExp` for safe symbol matching in diff hunks. - Tightened context capping logic to ensure token efficiency. This removes "if not typed" hedging by grounding the LLM in the actual interface and constant definitions.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict. No high-severity issues were identified. Final submission.
Optimizes the code review orchestrator to send only the relevant code changes (unified diff with 10 lines of context) to LLM clients. This eliminates the transmission of full file contents, reducing token consumption and focusing the review on the actual patch. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed `files` from `CodeReviewSummary` and `nameOnlyCommand` logic to prevent full-file reads. - Updated change detection to rely solely on the presence of `diffContext`. - Verified with unit tests and full build. - Passed Deployment Impact Analysis with a PASS verdict. No high-severity issues were identified. Final submission.
|
Hi! This PR has merge conflicts with the base branch. To fix this, please follow these steps:
Alternatively, you can rebase your branch onto |
Enhanced the code review orchestrator to provide full source context for imported components, types, and constants referenced in a PR's diff. - Implemented ESM import parsing and path resolution in `codeReviewOrchestrator.ts`. - Updated `getCodeDiffSummary` to identify used symbols and aggregate their source files. - Modified Gemini and GitHub Models clients to include this external context in prompts. - Refined fallback logic for `git diff` commands and `baseRef` extraction. - Expanded path resolution to include `.d.ts` files. - Implemented `escapeRegExp` and safer regex for symbol matching in diff hunks. - Added self-reference check to avoid including the changed file itself. - Tightened context capping and content verification logic. - Used `spawnSync` for safer shell command execution. This removes "if not typed" hedging by grounding the LLM in the actual interface and constant definitions.
Optimizes the AI code review process by switching from transmitting full file bodies to sending only unified diffs with 10 lines of context (`-U10`). This significantly reduces token consumption and focuses reviews on the actual modifications. - Updated `getCodeDiffSummary` to use `git diff -U10` (and fallback). - Removed the `files` array from `CodeReviewSummary` and associated gathering logic to prevent full-file reads. - Refactored orchestrator to detect code changes based on `diffContext`. - Merged `main` and resolved conflicts to integrate stateful differential review and auto-resolution features. - Verified via unit tests, full build, and automated CI review (PASS).
- Updated `GitHubModel` interface to include optional `limits`. - Enhanced `pickOptimalModel` in `scripts/lib/modelPicker.ts` to filter models by `max_input_tokens` (with 20% headroom). - Implemented strict filtering: exclude models without explicit limits if `estimatedInputTokens > 0`. - Added defensive type coercion for `max_input_tokens` API response. - Updated `githubModelsCodeReviewClient.ts` to calculate token estimate from diff context. - Updated `githubModelsVisualReviewClient.ts` to calculate token estimate from DOM diff character length. Steps taken: 1. Updated core selection logic in `modelPicker.ts` to be payload-aware. 2. Integrated token estimation heuristics into Code and Visual review clients. 3. Refined implementation based on code reviews to handle multi-byte character counts, type safety, and conservative filtering of unknown limits. 4. Verified all changes through local test suites and type-checking. 5. Reverted out-of-scope workflow changes per reviewer feedback. Fixes #2584.
arii
left a comment
There was a problem hiding this comment.
ANTI-AI-SLOP\n\n\n## FINDINGS\n\n\n## FINAL RECOMMENDATION\n<Approved | Approved with Minor Changes | Not Approved>\n\n
Inline Comments (Fallback due to Github line resolution errors)
- :1:
arii
left a comment
There was a problem hiding this comment.
ANTI-AI-SLOP\n\n\n## FINDINGS\n\n\n## FINAL RECOMMENDATION\n<Approved | Approved with Minor Changes | Not Approved>\n\n
Inline Comments (Fallback due to Github line resolution errors)
- :1:
Optimizes the AI code review process by switching from transmitting full file bodies to sending only unified diffs with 10 lines of context. This change materially reduces token consumption and focuses reviews on the actual modifications. - Updated `getCodeDiffSummary` to use `git diff -U10`. - Removed the `files` list and filename-gathering logic to prevent unnecessary full-file reads. - Refactored orchestrator change detection to rely on `diffContext`. - Updated `CodeReviewSummary` interface for type-safety. - Removed redundant `shell: bash` blocks in `ci.yml` per audit feedback. - Merged `main` and resolved conflicts to integrate stateful review features. - Verified via unit tests, build audit, and passing CI review verdict.
arii
left a comment
There was a problem hiding this comment.
Comprehensive Review for PR #2587
CI Status: All checks passing.
Recommendation: Everything looks good from a CI perspective. All tests and linters pass. Ready for manual review/merge if no other concerns.
FINAL RECOMMENDATION
Approved
Enhanced the code review orchestrator to provide full source context for imported components, types, and constants referenced in a PR's diff. - Implemented ESM import parsing and path resolution in `codeReviewOrchestrator.ts`. - Updated `getCodeDiffSummary` to identify used symbols and aggregate their source files. - Modified Gemini and GitHub Models clients to include this external context in prompts. - Refined fallback logic for `git diff` commands and `baseRef` extraction. - Expanded path resolution to include `.d.ts` files. - Implemented `escapeRegExp` and safer regex for symbol matching in diff hunks. - Added self-reference check to avoid including the changed file itself. - Tightened context capping and content verification logic. - Used `spawnSync` for safer shell command execution. - Resolved merge conflicts with recent stateful review and log group changes. This removes "if not typed" hedging by grounding the LLM in the actual interface and constant definitions.
…i-models-token-aware-3998645635553103582
…en-aware-3998645635553103582
This PR introduces payload-aware model selection for GitHub Models. By estimating the input token count (using a simple
length / 4heuristic) and checking it against themax_input_tokenslimit of available models, the system now avoids selecting models with insufficient context windows for large diffs or DOM changes.Key changes:
scripts/lib/modelPicker.ts: Added token limit filtering logic.scripts/clients/githubModelsCodeReviewClient.ts: Calculates estimate from diff context.scripts/clients/githubModelsVisualReviewClient.ts: Calculates estimate from DOM diff file.Fixes #2584
Merged with similiar prs
Closes #2591
Closes #2592