MAI-48: nodemaiass - auto-pick AI commit model by diff size#22
Merged
Conversation
- add pickCommitModel() in lib/commit.js with override > legacy > auto-pick layering - new MAIASS_AI_COMMIT_MODEL env var (commit-only override) takes precedence over MAIASS_AI_MODEL - auto-pick by post-truncation diff length: <30k gpt-4o-mini, 30k-100k gpt-4-turbo, >100k gpt-4o - debug log shows tier + diff size when MAIASS_DEBUG=true - register MAIASS_AI_COMMIT_MODEL in maiass-variables.js and the AI category in config-manager/config-command - add commit-model-picker.test.js (13 cases covering override, legacy, tier boundaries)
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
CLI half of MAI-48 (sibling PR in
maiass-proxyfor the worker half).Replaces the single-source AI commit model picker (
MAIASS_AI_MODEL || 'gpt-3.5-turbo') with a layered resolver inlib/commit.js:MAIASS_AI_COMMIT_MODEL(new env var) wins absolutely. Skips all picker logic.MAIASS_AI_MODEL(unchanged) used when commit override is unset. Preserves prior behaviour for users who configured it explicitly.< 30000 chars->gpt-4o-mini(tier 1, common case given the 8000-char default cap)30000..100000 chars->gpt-4-turbo(tier 2)> 100000 chars->gpt-4o(tier 3)Tiers 2 and 3 only fire when a user raises
MAIASS_AI_MAX_CHARACTERSabove 30000 — the ladder is intentionally forward-compatible with future cap increases.Under
MAIASS_DEBUG=truethe picker logs the chosen tier, diff length, and threshold range.Changes
lib/commit.js— new exportedpickCommitModel(diffLength, env)helper; wired into the commit suggestion flow after diff truncation; debug log addedlib/maiass-variables.js— registerMAIASS_AI_COMMIT_MODELlib/config-manager.js+lib/config-command.js— addMAIASS_AI_COMMIT_MODELto the AI category groupingstest/unit/commit-model-picker.test.js— 13 cases covering override, legacy fallback, tier boundaries (0, 29999, 30000, 100000, 100001, 250000), defensive negative inputOut of scope
maiass-proxy).MAIASS_AI_MAX_CHARACTERSitself — unchanged.lib/changelog-cleanup.js— per MAI-47 thread, cleanup chunks are too small to need the ladder; already has its ownMAIASS_AI_CHANGELOG_MODEL.Jira
https://velvary.atlassian.net/browse/MAI-48
Test plan
npm run test:unit— 92 pass (was 79 before this branch; 13 new tests added)MAIASS_AI_COMMIT_MODEL=gpt-4o MAIASS_DEBUG=true maiass -c— confirm debug log shows "override via MAIASS_AI_COMMIT_MODEL"MAIASS_AI_MODEL=gpt-3.5-turboset andMAIASS_AI_COMMIT_MODELunset, confirm picker logs "legacy MAIASS_AI_MODEL"