local models: make max output tokens configurable (#246)#305
Open
praxstack wants to merge 2 commits into
Open
Conversation
praxstack
force-pushed
the
fix/246-configurable-local-max-tokens
branch
from
July 7, 2026 03:55
82aec8b to
627395d
Compare
Follow-up hardening pass. Adds 4 tests covering gaps in the original suite: - minimum positive override (exactly 1) pins the `configured > 0` exclusive- zero guard against a future `>= 0` regression - large reasoning-model override (131072) passes through unclamped, both via configuredMaxOutputTokens and into the ChatRequest — the JerryZLiu#246 use case - default constant matches the unset fallback (catches drift if one changes) All 8 tests pass (4 original + 4 new); no production code changed.
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.
Reasoning models like qwen3.5-35b-a3b burn through the hardcoded 4000-token cap on thinking tokens before emitting any content, so titles come back empty with finish_reason length. This adds a
llmLocalMaxOutputTokensUserDefaults key that overrides the cap for all local provider calls (chat requests, callTextAPI, generateText); unset, zero, or negative values keep the existing 4000 default so current local setups are unaffected.Users can bump it with
defaults write teleportlabs.com.Dayflow llmLocalMaxOutputTokens -int 32000. Kept it defaults-key-only for now; happy to add a settings row next to the local model options if you'd like it surfaced in the UI.Fixes #246
Tested with the new OllamaProviderMaxTokensTests plus the existing suite:
Follow-up hardening pass (2026-07-08)
Ran an internal hardening pass (independent code review + fresh-context verification) on this branch — no additional issues found. Independently rebuilt (
xcodebuild ... build→ BUILD SUCCEEDED, clean derived data) and re-ran the full DayflowTests suite from the xcresult bundle: 10/10 passed (6 pre-existing + the 4 OllamaProviderMaxTokensTests above). Also re-traced all 6callTextAPIcall sites and confirmed none passes an explicitmaxTokens, so the configured default reaches every local-provider call path; no hardcoded 4000 caps remain inCore/AI/.Follow-up hardening pass (2026-07-08)
Added 4 edge-case tests (no production code change): minimum positive override (exactly 1, pins the exclusive-zero guard), large reasoning-model override (131072 passes through unclamped into ChatRequest — the #246 case), and a default-constant-matches-fallback consistency check. Full suite: 8/8 pass.