mirror of
https://github.com/Pasta-Devs/Marinara-Agents.git
synced 2026-12-03 18:55:07 +07:00
[PR #1199] [MERGED] fix(noodle): 1.4.1 — keep the timeline prompt whole on small context windows #1340
Labels
No labels
agent: chess
agent: conversation-calls
agent: eightball
agent: haptic
agent: hierarchical-maps
agent: hierarchical-maps
agent: illustrator
agent: poker
agent: rock-paper-scissors
agent: tic-tac-toe
agent: uno
artifacts
bug
bugfix
build
catalog
ci
client
dependencies
docs
documentation
enhancement
feature
fixed-in-staging
in-pr
normal-scope
packages
pull-request
qol
regression
roadmap
scope-risk
server
soup
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Agents#1340
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1199
Author: @SpicyMarinara
Created: 10/2/2026
Status: ✅ Merged
Merged: 10/2/2026
Merged by: @SpicyMarinara
Base:
staging← Head:fix/noodle-timeline-context📝 Commits (5)
22f2373fix(noodle): 1.4.1 — keep the timeline prompt whole on small context windows1011c1cfix(noodle): size only the primary connection and keep slack for the estimate1a3478bMerge branch 'staging' into fix/noodle-timeline-context7db260cMerge remote-tracking branch 'origin/staging' into fix/noodle-timeline-context7e7f35efix(noodle): count only a primary length stop as a lowered-budget cut📊 Changes
15 files changed (+487 additions, -220 deletions)
View changed files
📝
.github/workflows/pull-request-checks.yml(+3 -0)➕
artifacts/noodle-1.4.1.zip(+0 -0)📝
catalog/catalog.json(+6 -6)📝
catalog/notes.json(+6 -0)📝
catalog/v2/catalog.json(+6 -6)📝
catalog/v2/notes.json(+6 -0)📝
catalog/v3/catalog.json(+6 -6)📝
catalog/v3/notes.json(+6 -0)📝
packages/noodle/CHANGELOG.md(+4 -0)📝
packages/noodle/manifest.json(+3 -3)📝
packages/noodle/server.mjs(+187 -187)📝
packages/noodle/src/engine/packages/server/src/services/noodle/noodle-post-target.ts(+32 -0)📝
packages/noodle/src/engine/packages/server/src/services/noodle/noodle-public-generation.service.ts(+101 -11)📝
scripts/build-feature-packages.mjs(+1 -1)➕
tests/noodle-timeline-context-budget.regression.ts(+120 -0)📄 Description
Linked issue
Closes #1201
Refs Pasta-Devs/Marinara-Engine#6973. That report produces exactly this symptom, but it is not yet confirmed to be this bug. The reporter's KoboldCpp runs at 49152 context, where the cut needs a very large prompt; the numbers that would settle it have been requested on the issue.
Why this change
Noodle bundles the vendored
sources/enginecopy of the context fitter (base-provider.ts, unchanged since 2026-07-14). It predates Engine #4124 (85c139a38). When a prompt with no chat history does not fit besidemax_tokens, that fitter deletes the first non-system message. For a timeline refresh that is the entire context body: accounts, handles, character profiles, chats and the timeline. The model gets only the system rules and the JSON template, with the fullmax_tokensstill reserved. It writes a short answer about nobody, and the correction pass is cut the same way. Debug Mode logs the prompt before the cut, so the log still shows the big prompt, which hides the problem.Since Engine 2.4.6 (#6003 / #6007), the Engine reads the real context size from KoboldCpp, llama.cpp, TabbyAPI and ooba on every page load and stores it as the connection's Max Context. Before that, the column usually held the 128000 default. Timeline refreshes reserve 4096 + 1024 tokens per account for the answer, so on a 16k context with four accounts the body is deleted once the prompt passes about 7.7k estimated tokens, under half the window. The small profile prompt still fits, which is why profiles keep working.
What changed
noodle-post-target.ts:noodleTimelineMaxTokensForPrompt()returns the largestmax_tokensthat fits beside the whole prompt. It uses the bundled fitter's own estimate and margin, and keeps 15% of the prompt estimate back as slack, because the characters / 4 estimate undercounts IDs, timestamps and digits on some tokenizers (Gemma spends a token per digit) and KoboldCpp cuts the start of a prompt that overflows. It returns null when less than 1024 tokens (or a smaller budget saved on the connection) would be left.noodle-public-generation.service.ts: a smallNoodleTimelineBudgetProviderfacade (same shape as the vendoredConnectionDefaultProvider) wraps the primary connection's provider for the three timeline calls: first try, text-only vision retry and correction. Because only the primary is wrapped, a configured fallback connection still gets the original request and fits it to its own context. Profile generation keeps the unwrapped provider.tests/noodle-timeline-context-budget.regression.ts. It runs the vendored fitter from source (the code Noodle bundles), checks that the fitter still deletes the body without the guard, and that the guarded budget keeps every message across 8k–128k contexts, 1, 3 and 6 accounts and prompts up to 200k characters. It also pins the call sites: all three timeline calls use the wrapped provider, and only the primary is wrapped. The required "Catalog validation" CI job now runs it.[highlight]changelog entry), rebuiltserver.mjs, manifest,artifacts/noodle-1.4.1.zip, catalog lanes and notes.The guard sits in package-owned code rather than a package-owned copy of
base-provider.ts:sources/engineis frozen by the vendored-Engine baseline, and an override would fork an 800-line file and need a build-script change. Aponytail:comment records the ceiling (the estimate is still characters / 4) and the upgrade path (generate through the Engine's live LLM integration, Capability API 1.31, and count real tokens where the backend can).Package and security impact
noodle(1.4.0 → 1.4.1).engine.min2.4.6, capability API 1.35 and permissions are unchanged.server.mjsonly.client.jsis byte-identical to 1.4.0.Build provenance: rebuilt with
MARINARA_ENGINE_ROOTat Engineead04150a. With that root, an unchanged tree reproduces the published Noodle 1.4.0 byte for byte (zip,server.mjs,client.js, catalogs), so the artifact diff contains only this change. A second rebuild of this branch is byte-identical. Newer Engine staging adds unrelated Engine CSS toclient.js(#6941 and the editor-header fix).Validation
node scripts/validate-catalog.mjspasses locallygit diff --checkpasses locallyCONTRIBUTING.mdManual verification notes
Run by the agent:
npm run check,npm run typecheck:packages,node scripts/test-catalog-lanes.mjs,node scripts/tests/ui-translation-retention.regression.mjs,node scripts/validate-package-locales.mjs,node scripts/validate-package-locale-keys.mjs,node scripts/validate-catalog.mjs,node scripts/tests/catalog-generatedat-determinism.regression.mjs,node scripts/tests/catalog-release-notes.regression.mjs,node scripts/tests/vendored-engine.regression.mjs,npm run test:security,node scripts/validate-pr-triage.mjs,git diff --check.npm run test:noodle:regressionsstops at the first failure:noodle-public-onlyfails on untouched staging. Run one by one, the same 46 Noodle/NoodleR/Slurp regressions fail on untouchedorigin/stagingand on this branch; every other one passes.ead04150a, isolated data dir) with each artifact installed throughinstallPackageBrowserFixture, a fake KoboldCpp backend recording every request, Max Context set to 16384 by the Engine's ownrefresh-local-context, and 4 characters with long cards. 1.4.0 sent only the system prompt and JSON format (max_tokens8192), and so did its correction. 1.4.1 sent all three messages with a loweredmax_tokensand created posts. A prompt too big for the window failed with the new message and sent nothing. At 128k the request was unchanged from 1.4.0. The fallback, image, slack and wording problems that run found are what the second commit fixes.coderabbit review --agent --committed --base staging): 0 findings on the first commit and 0 on the second.Not run by the agent:
Still to verify by hand:
max_tokens, and posts should appear.Documentation impact
No README or Engine documentation change is made here: the 1.4.1 release notes describe the change, and no existing statement in the README or the Engine docs becomes wrong. Pre-existing Engine docs gap for a follow-up:
docs/noodle/settings.mdsays All invited has no cap and never names Accounts per refresh.Summary by CodeRabbit
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.