Repository navigation
Inkling 2: a thought budget and a max-tokens cap, both off by default - #2806
Merged
jonathan308 merged 5 commits intoDec 2, 2026
Merged
Conversation
…_THOUGHT_BUDGET) A Mac that sets DARKBLOOM_INKLING_THOUGHT_BUDGET to a positive number of tokens caps how long an Inkling 2 row may think. At the budget the provider ends the thought through the loop guard's existing exit (the inklingThought markers and LoopExitThinkingContinuation), and the model writes its answer, capped at 8,192 tokens. A request's reasoning.max_tokens may only lower the budget. The budget covers the row's first thought (a whole thought inside one delta is the named exception); the count is per delta, so a row stops at the budget or at most one delta later. Unset, 0, off or anything that is not a positive number keeps today's behaviour exactly. Never with logprobs, for a pair's request, or for constrained, forced-tool or JSON outputs; one Mac's text path only. It never uses the engine's per-request reasoning budget, so drafting stays on. A loop in the thought still takes the exit only where DARKBLOOM_LOOP_EXIT_THINKING lists the family. A budget stop has its own telemetry operation, engine_v2_thought_budget. LaunchAgent passes the key through. Tests: InklingThoughtBudgetTests (11).
…_MAX_TOKENS_CAP) A Mac that sets DARKBLOOM_INKLING_MAX_TOKENS_CAP to a positive number of tokens, C, lowers an Inkling 2 request's engine max_tokens to C when the request asks for more or names none. On a segmented KV pool a row prepays its prompt plus max_tokens, so a 65,536-token request then prepays its prompt plus C, and more of them fit beside the rows already running. This changes the contract for such a request: a row that would run past C ends there with finish_reason length. Pair it with the thought budget as C >= B + 8,192 plus a margin, so a row the budget stopped is never cut. Unset, 0, off or anything that is not a positive number keeps today's behaviour exactly; other models and a pair's requests are untouched. It applies on the text and media paths. A request that applied the cap records it on its profile (max_tokens_cap). LaunchAgent passes the key through. Tests: InklingMaxTokensCapTests (11).
When DARKBLOOM_INKLING_THOUGHT_BUDGET or DARKBLOOM_INKLING_MAX_TOKENS_CAP is set, darkbloom start logs one line per key on the config logger, once per process, beside the retired-knob warnings and before the serving-mode split, so the local server and the coordinator modes both say it. It also echoes each line to stderr, unbuffered, as it echoes those warnings: - a set key, by its name and the number it set: info, "info: KEY=N"; - a value that is not a positive whole number, by the key's name only: warning, "warning: KEY: invalid, ignored". The raw value is never logged. With neither key set, nothing new is logged. The unified log keeps the lines private, as it does every config line. Tests: InklingThoughtBudgetTests (12), InklingMaxTokensCapTests (12).
Document DARKBLOOM_INKLING_THOUGHT_BUDGET and DARKBLOOM_INKLING_MAX_TOKENS_CAP in the configuration reference, beside the other Inkling 2 keys: the values each accepts, the default (off), where each is read, what it does, the startup line it logs, and that the LaunchAgent forwards it. The pairing rule for the two values (C at least the budget plus 8,192 and a margin) is stated with the cap. Add a changelog fragment for both keys, so the next release preparation renders them into CHANGELOG.md with the other entries. Docs only: no source or test file changes.
The Inkling 2 max-tokens cap added one stored property to the per-request profile, max_tokens_cap: an optional count, absent unless the cap applied. The test that guards the profile's wire shape counts its stored properties, so that a new field is a deliberate change, and checks that none of them is a String. The new field is a count, so only the expected total moves, from 60 to 61, with the comment's tally of counts and flags from 26 to 27. Test-only, one test: no source file changes. Tests: ProtocolTests (profilerWireObjectsHaveNoStringStoredProperties). (cherry picked from commit e457a3a)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 of 5 tasks
davidtai
approved these changes
Dec 1, 2026
davidtai
left a comment
Collaborator
There was a problem hiding this comment.
Approved by David, with one request. CI is green. Both keys are off by default, so nothing changes on DevNet. The docs and changelog match. Merge order for the stack: this PR first, then #2807, #2811 and #2821. Then retarget #2824 to ink-engine/inkling-mtp-fixes. #2794 merges into dev last.
- Low,
MultiModelBatchSchedulerEngine.swift:1308: no test drives the scheduler path where only the budget builds the thought exit.InklingThoughtBudget.current(InklingThoughtBudget.swift:34) is astatic let, so no test can set it. Add a seam and one wiring test: an Inkling request with the budget set stops its thought, and the continuation answers.
This branch was successfully deployed
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.
DARKBLOOM_INKLING_THOUGHT_BUDGET(caps how long an Inkling 2 request may think; the answer is then capped at 8,192 tokens) andDARKBLOOM_INKLING_MAX_TOKENS_CAP(lowersmax_tokenswhen a request asks for more or names none), logs both keys at startup, documents them, and counts the new field in the profile wire test.devafter Provider 0.10.20 candidate, with the Inkling 2 MTP fixes #2794 merges.Part of landing the 0.10.20 release content on dev before the release is cut, as the release review on #2800 asked.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.