refactor: extract tryMiddlePowerFallback helper in model-resolver#3755
Conversation
The same selectMiddlePowerFallback call + log + return pattern was duplicated in two places within resolveModel(). Extract into a shared tryMiddlePowerFallback() helper that both call sites now use. Closes #3613 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Refactors the API proxy’s model resolution flow by extracting the repeated “middle-power fallback” selection + log + return logic into a single helper, reducing duplication inside resolveModel().
Changes:
- Added
tryMiddlePowerFallback()helper to encapsulate the middle-power fallback pattern. - Replaced two duplicated fallback blocks in
resolveModel()with calls to the new helper.
Show a summary per file
| File | Description |
|---|---|
| containers/api-proxy/model-resolver.js | Introduces tryMiddlePowerFallback() and updates both resolveModel() call sites to use it, removing duplicated logic. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 1/1 changed files
- Comments generated: 0
✅ Coverage Check PassedOverall Coverage
📁 Per-file Coverage Changes (1 files)
Coverage comparison generated by |
|
Smoke Test Results GitHub MCP: ✅ Retrieved PR #3704 - "Reduce Documentation Maintainer workflow prompt/tool overhead" Author: @lpcox Overall: FAIL (file test failed)
|
Smoke Test: Claude Engine Validation ✅Results:
Status: PASS
|
BYOK Smoke Test Results✅ MCP GitHub API - PR #3755: refactor: extract tryMiddlePowerFallback helper in model-resolver Status: PARTIAL - BYOK path working, file test failed (may be cross-container)
|
|
Smoke test Codex: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "registry.npmjs.org"See Network Configuration for more information.
|
🏗️ Build Test Suite Results
Overall: 7/8 ecosystems passed — FAIL ❌ Java FailuresBoth Java projects (gson and caffeine) failed with Maven repository permission errors: Root Cause: Maven cannot create the local repository directory due to filesystem permission restrictions in the AWF agent container environment. The Impact: All Java/Maven builds will fail in the current AWF configuration until this permission issue is resolved. ✅ Other EcosystemsAll other ecosystems (Bun, C++, Deno, .NET, Go, Node.js, Rust) passed successfully:
|
|
Smoke Test: FAIL Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "localhost"See Network Configuration for more information.
|
Services Connectivity: ❌ FAIL
Overall: FAIL — AWF sandbox cannot reach service containers via host.docker.internal
|
Chroot Version Comparison Test Results
Overall Result: ❌ FAILED - Not all versions match Analysis
The chroot environment is not using the exact same runtime versions as the host. This could indicate that the selective bind mounts are working as intended (using containerized versions) or that the host runtimes are not being properly exposed.
|
Summary
Extract the duplicated
selectMiddlePowerFallbackcall + log + return pattern into a sharedtryMiddlePowerFallback()helper function.The same 6-line pattern (call, check result, log message, return) appeared in two locations within
resolveModel(). Now both call sites use the shared helper.Verification
Closes #3613