[PR #685] [MERGED] fix(slurp): stop automatic Slurp work overloading image and text connections #1084

Closed
opened 2026-10-21 05:02:20 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/685
Author: @Gunterlie
Created: 9/2/2026
Status: ✅ Merged
Merged: 9/2/2026
Merged by: @Gunterlie

Base: staging ← Head: no-double-dip


📝 Commits (3)

  • a8acccd fix(slurp): stop the schedulers hammering image and text connections
  • b5dbae3 fix(slurp): admit automatic generation so the daily budget is enforced
  • 942ac59 fix(slurp): address CodeRabbit findings on the retry and admission work

📊 Changes

20 files changed (+608 additions, -325 deletions)

View changed files

➕ artifacts/slurp-1.0.26.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v3/catalog.json (+8 -8)
📝 packages/slurp/client.js (+14 -14)
📝 packages/slurp/manifest.json (+5 -5)
📝 packages/slurp/server.mjs (+157 -157)
📝 packages/slurp/src/engine/packages/client/src/components/slurp/SlurpCreatorPostCard.tsx (+18 -0)
📝 packages/slurp/src/engine/packages/client/src/localization/locales/en.json (+1 -0)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-artwork.operation.ts (+6 -0)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-autopost-scheduler.service.ts (+15 -1)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-fan-activity-scheduler.service.ts (+5 -1)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-generation.service.ts (+18 -2)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-image-retry.ts (+18 -0)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-images.service.ts (+164 -116)
➕ packages/slurp/src/engine/packages/server/src/services/slurp/slurp-poll-backoff.ts (+14 -0)
📝 packages/slurp/src/engine/packages/server/src/services/slurp/slurp-public-generation.service.ts (+15 -4)
📝 packages/slurp/src/engine/packages/server/src/services/storage/slurp.storage.ts (+33 -0)
📝 scripts/build-feature-packages.mjs (+1 -1)
➕ tests/slurp-connection-load.regression.ts (+100 -0)

📄 Description

Pull request

Linked issue

Closes #684

Why this change

  • Slurp generates a complete post on every 60-second reserve poll and never stops, because the daily budget is never claimed. Both generation services passed admissionMode to withConnectionFallbackProvider, whose ConnectionFallbackProviderArgs has no such field. Packages bundle with esbuild and this repository has no typecheck gate, so the property was dropped in silence.
  • claimNoodlerAutomaticAttempt is only reachable from admissionMode.beforeAttempt. With the mode discarded the claim never happens, so postsPerDay limits nothing, and the provider is never admitted, so automatic work never yields to the user and never reports a busy connection.
  • Each unbudgeted post also pulls an image-prompt interpretation call (NOODLE_IMAGE_INTERPRET) onto the text connection, which is why one loop bills both the image and the text connection. A user's token log shows both streams running while Slurp is idle: ~22-25k tokens once per poll, and ~1.5k tokens every ~75 seconds.
  • Two failure paths made it worse: the reserve and audience polls re-armed at a flat 60s after any failure (a failed attempt deliberately does not burn budget, so nothing else slowed them), and the creator artwork backfill ran on every poll with no admission mode at all - foreground-priority image work against the user's own connection.
  • A post whose image failed was finalized with imagePrompt: null, so it published without its picture and could never get one; the day's slot was spent on an incomplete post.

What changed

  • slurp package (1.0.25 -> 1.0.26). Admission now wraps the composed provider via withConnectionAdmissionProvider in slurp-generation.service.ts and slurp-public-generation.service.ts, restoring the daily budget and background yielding. The public refresh's text-only retry and correction pass use a { kind: "none" } provider, so they are steps inside the already-admitted attempt rather than new ones.
  • New slurp-poll-backoff.ts: the reserve and audience polls back off exponentially while failing, capped at 30 minutes, reset by the first clean pass.
  • The creator artwork backfill runs as background admission, and a busy connection counts as "try later" rather than a failure.
  • Failed post images keep their prompt and count attempts (limit 3, NaN-safe read shared by the writer and the eligibility filter). One waiting post is redrawn per reserve poll under background admission, skipping posts still awaiting prompt review; the candidate scan is bounded to the newest 200 rows. A Generate image action on the post card gives a manual retry through the existing /noodler/refresh/images route.
  • Generated outputs rebuilt: packages/slurp/manifest.json, server.mjs, client.js, artifacts/slurp-1.0.26.zip, catalog/catalog.json, catalog/v2/catalog.json, catalog/v3/catalog.json. New locale key ui.noodle.noodlepostcard.generateImage.

Package and security impact

  • Affected package IDs: slurp
  • Engine compatibility impact: none. Manifest range unchanged (>=2.4.3 <4.0.0), so lane routing is unchanged.
  • New or changed permissions/entrypoints: none. The manual retry reuses the existing POST /noodler/refresh/images route and its existing claim checks.
  • Restart, storage, update, or uninstall impact: no schema change. Two additive post-metadata behaviours (imageRetryAttempts, and imagePrompt now retained on failure) default safely when absent. Requires the usual package update and Engine restart.

Validation

  • node scripts/validate-catalog.mjs passes locally
  • git diff --check passes locally
  • Rebuilt every affected manifest, payload, artifact, and catalog entry
  • Installed or updated the affected package through Marinara Engine
  • Checked supported modes, restart behavior, and uninstall cleanup
  • Read and followed CONTRIBUTING.md

Manual verification notes

Boxes left unticked deliberately: they are the maintainer's verification list, and the two that matter most here have not been done by me - see the limitation below.

What I actually ran, from a clean rebuild of this branch:

  • node scripts/build-feature-packages.mjs slurp - regenerated manifest, bundles, artifact and catalog entries.
  • npm run check - clean (0 errors; 68 pre-existing warnings, unchanged from base).
  • node scripts/validate-catalog.mjs, node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/validate-package-locale-keys.mjs - all pass.
  • Every tests/slurp-*.regression.ts and tests/noodler-*.regression.ts passes. Four noodle-* tests fail identically on the base commit 692c9b80 (unrelated missing module); I verified that by stashing and re-running.
  • New tests/slurp-connection-load.regression.ts covers the backoff curve, the retry and deferral contract, the NaN-safe counter, the bounded scan, and - most importantly - fails if any call site hands admissionMode to the fallback wrapper again.

Limitation, stated plainly: none of this has been exercised against a running Marinara Engine. The diagnosis comes from reading the admission wiring and from a user's token log, not from a reproduction, and the package has not been installed or updated through the Engine. "The reserve poll now stops at postsPerDay" is an inference, not an observation. The cheapest confirmation is to install 1.0.26 on a dev instance, leave Slurp idle with automatic posting on, and check that generation stops once the daily count is reached.

Documentation impact

  • No documentation changes needed

UI evidence (if applicable)

The only UI change is a Generate image button inside the existing image-prompt panel on the creator post card - the panel that already renders when a post has a prompt but no image. No screenshot captured, since the change was not run against a live Engine.


Follow-up, not in this PR

backfillNextNoodlerCreatorArtwork picks its target with find(p => !p.avatarUrl || !p.bannerUrl). An "open" creator whose source has no banner always resolves to bannerUrl: null and returns idle, so that creator is selected on every poll for ever and no creator behind it is ever filled. Unrelated to connection load; will file separately.

Worth considering separately: a tsc --noEmit gate would have caught the root cause of #684 outright.

Review history

CodeRabbit round one raised four findings on the first two commits; all four were valid and are fixed in 942ac59c, with regression coverage for each. See the discussion below for the detail, including one correction to its reasoning on the admission finding.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Agents/pull/685 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 9/2/2026 **Status:** ✅ Merged **Merged:** 9/2/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `no-double-dip` --- ### 📝 Commits (3) - [`a8acccd`](https://github.com/Pasta-Devs/Marinara-Agents/commit/a8acccd74d9eb7a6c34bf71397338ae2dff51f0b) fix(slurp): stop the schedulers hammering image and text connections - [`b5dbae3`](https://github.com/Pasta-Devs/Marinara-Agents/commit/b5dbae38f99ee8d422dca84c65bfcd83515ecd30) fix(slurp): admit automatic generation so the daily budget is enforced - [`942ac59`](https://github.com/Pasta-Devs/Marinara-Agents/commit/942ac59c55c8914b51d8d08c15951fdb572a9b81) fix(slurp): address CodeRabbit findings on the retry and admission work ### 📊 Changes **20 files changed** (+608 additions, -325 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/slurp-1.0.26.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `packages/slurp/client.js` (+14 -14) 📝 `packages/slurp/manifest.json` (+5 -5) 📝 `packages/slurp/server.mjs` (+157 -157) 📝 `packages/slurp/src/engine/packages/client/src/components/slurp/SlurpCreatorPostCard.tsx` (+18 -0) 📝 `packages/slurp/src/engine/packages/client/src/localization/locales/en.json` (+1 -0) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-artwork.operation.ts` (+6 -0) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-autopost-scheduler.service.ts` (+15 -1) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-fan-activity-scheduler.service.ts` (+5 -1) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-generation.service.ts` (+18 -2) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-image-retry.ts` (+18 -0) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-images.service.ts` (+164 -116) ➕ `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-poll-backoff.ts` (+14 -0) 📝 `packages/slurp/src/engine/packages/server/src/services/slurp/slurp-public-generation.service.ts` (+15 -4) 📝 `packages/slurp/src/engine/packages/server/src/services/storage/slurp.storage.ts` (+33 -0) 📝 `scripts/build-feature-packages.mjs` (+1 -1) ➕ `tests/slurp-connection-load.regression.ts` (+100 -0) </details> ### 📄 Description # Pull request ## Linked issue Closes #684 ## Why this change - Slurp generates a complete post on every 60-second reserve poll and never stops, because the daily budget is never claimed. Both generation services passed `admissionMode` to `withConnectionFallbackProvider`, whose `ConnectionFallbackProviderArgs` has no such field. Packages bundle with esbuild and this repository has no typecheck gate, so the property was dropped in silence. - `claimNoodlerAutomaticAttempt` is only reachable from `admissionMode.beforeAttempt`. With the mode discarded the claim never happens, so `postsPerDay` limits nothing, and the provider is never admitted, so automatic work never yields to the user and never reports a busy connection. - Each unbudgeted post also pulls an image-prompt interpretation call (`NOODLE_IMAGE_INTERPRET`) onto the text connection, which is why one loop bills both the image and the text connection. A user's token log shows both streams running while Slurp is idle: ~22-25k tokens once per poll, and ~1.5k tokens every ~75 seconds. - Two failure paths made it worse: the reserve and audience polls re-armed at a flat 60s after any failure (a failed attempt deliberately does not burn budget, so nothing else slowed them), and the creator artwork backfill ran on every poll with no admission mode at all - foreground-priority image work against the user's own connection. - A post whose image failed was finalized with `imagePrompt: null`, so it published without its picture and could never get one; the day's slot was spent on an incomplete post. ## What changed - `slurp` package (1.0.25 -> 1.0.26). Admission now wraps the composed provider via `withConnectionAdmissionProvider` in `slurp-generation.service.ts` and `slurp-public-generation.service.ts`, restoring the daily budget and background yielding. The public refresh's text-only retry and correction pass use a `{ kind: "none" }` provider, so they are steps inside the already-admitted attempt rather than new ones. - New `slurp-poll-backoff.ts`: the reserve and audience polls back off exponentially while failing, capped at 30 minutes, reset by the first clean pass. - The creator artwork backfill runs as background admission, and a busy connection counts as "try later" rather than a failure. - Failed post images keep their prompt and count attempts (limit 3, NaN-safe read shared by the writer and the eligibility filter). One waiting post is redrawn per reserve poll under background admission, skipping posts still awaiting prompt review; the candidate scan is bounded to the newest 200 rows. A **Generate image** action on the post card gives a manual retry through the existing `/noodler/refresh/images` route. - Generated outputs rebuilt: `packages/slurp/manifest.json`, `server.mjs`, `client.js`, `artifacts/slurp-1.0.26.zip`, `catalog/catalog.json`, `catalog/v2/catalog.json`, `catalog/v3/catalog.json`. New locale key `ui.noodle.noodlepostcard.generateImage`. ## Package and security impact - Affected package IDs: `slurp` - Engine compatibility impact: none. Manifest range unchanged (`>=2.4.3 <4.0.0`), so lane routing is unchanged. - New or changed permissions/entrypoints: none. The manual retry reuses the existing `POST /noodler/refresh/images` route and its existing claim checks. - Restart, storage, update, or uninstall impact: no schema change. Two additive post-metadata behaviours (`imageRetryAttempts`, and `imagePrompt` now retained on failure) default safely when absent. Requires the usual package update and Engine restart. ## Validation - [ ] `node scripts/validate-catalog.mjs` passes locally - [ ] `git diff --check` passes locally - [ ] Rebuilt every affected manifest, payload, artifact, and catalog entry - [ ] Installed or updated the affected package through Marinara Engine - [ ] Checked supported modes, restart behavior, and uninstall cleanup - [ ] Read and followed `CONTRIBUTING.md` ### Manual verification notes Boxes left unticked deliberately: they are the maintainer's verification list, and the two that matter most here have **not** been done by me - see the limitation below. What I actually ran, from a clean rebuild of this branch: - `node scripts/build-feature-packages.mjs slurp` - regenerated manifest, bundles, artifact and catalog entries. - `npm run check` - clean (0 errors; 68 pre-existing warnings, unchanged from base). - `node scripts/validate-catalog.mjs`, `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/validate-package-locale-keys.mjs` - all pass. - Every `tests/slurp-*.regression.ts` and `tests/noodler-*.regression.ts` passes. Four `noodle-*` tests fail identically on the base commit `692c9b80` (unrelated missing module); I verified that by stashing and re-running. - New `tests/slurp-connection-load.regression.ts` covers the backoff curve, the retry and deferral contract, the NaN-safe counter, the bounded scan, and - most importantly - fails if any call site hands `admissionMode` to the fallback wrapper again. **Limitation, stated plainly:** none of this has been exercised against a running Marinara Engine. The diagnosis comes from reading the admission wiring and from a user's token log, not from a reproduction, and the package has not been installed or updated through the Engine. "The reserve poll now stops at `postsPerDay`" is an inference, not an observation. The cheapest confirmation is to install 1.0.26 on a dev instance, leave Slurp idle with automatic posting on, and check that generation stops once the daily count is reached. ## Documentation impact - [x] No documentation changes needed ## UI evidence (if applicable) The only UI change is a **Generate image** button inside the existing image-prompt panel on the creator post card - the panel that already renders when a post has a prompt but no image. No screenshot captured, since the change was not run against a live Engine. --- ### Follow-up, not in this PR `backfillNextNoodlerCreatorArtwork` picks its target with `find(p => !p.avatarUrl || !p.bannerUrl)`. An "open" creator whose source has no banner always resolves to `bannerUrl: null` and returns `idle`, so that creator is selected on every poll for ever and no creator behind it is ever filled. Unrelated to connection load; will file separately. Worth considering separately: a `tsc --noEmit` gate would have caught the root cause of #684 outright. ### Review history CodeRabbit round one raised four findings on the first two commits; all four were valid and are fixed in `942ac59c`, with regression coverage for each. See the discussion below for the detail, including one correction to its reasoning on the admission finding. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:02:20 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Agents#1084
No description provided.