[PR #1325] [MERGED] fix(slurp2): accept usable image prompt rewrites, treat a budget skip as off (0.3.25) #1400

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

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Agents/pull/1325
Author: @Gunterlie
Created: 10/12/2026
Status: ✅ Merged
Merged: 10/12/2026
Merged by: @Gunterlie

Base: staging ← Head: fenced-json-prompt-parse


📝 Commits (4)

  • d1035e3 fix(slurp2): accept usable image prompt rewrites, treat a budget skip as off
  • ef4c589 chore(slurp2): rebuild 0.3.25
  • 023d659 fix(slurp2): guard the rewrite parser call and keep the splash note in-universe
  • bcb07b2 chore(slurp2): rebuild 0.3.25

📊 Changes

19 files changed (+377 additions, -337 deletions)

View changed files

➕ artifacts/slurp2-0.3.25.zip (+0 -0)
📝 catalog/catalog.json (+8 -8)
📝 catalog/notes.json (+6 -6)
📝 catalog/v2/catalog.json (+8 -8)
📝 catalog/v2/notes.json (+6 -6)
📝 catalog/v3/catalog.json (+8 -8)
📝 catalog/v3/notes.json (+6 -6)
📝 packages/slurp2/CHANGELOG.md (+5 -0)
📝 packages/slurp2/client.js (+1 -1)
📝 packages/slurp2/manifest.json (+5 -5)
📝 packages/slurp2/server.mjs (+276 -276)
📝 packages/slurp2/src/engine/packages/client/src/slp/features/onboarding/slp-release.ts (+9 -1)
📝 packages/slurp2/src/engine/packages/server/src/slp/base/media/slp-image-prompt-rewrite.ts (+13 -8)
📝 packages/slurp2/src/engine/packages/server/src/slp/features/ads/slp-garnish-image-service.ts (+4 -1)
📝 packages/slurp2/src/engine/packages/server/src/slp/features/media/slp-images-service.ts (+4 -1)
📝 packages/slurp2/src/engine/packages/server/src/slp/features/media/slp-public-images-service.ts (+4 -1)
📝 scripts/build-feature-packages.mjs (+1 -1)
📝 tests/slurp-onboarding-failure-reasons.regression.ts (+1 -0)
📝 tests/slurp2-image-prompt-boundaries.regression.ts (+12 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch to main.

Linked issue

Closes #1324

Why this change

A player reports [slurp] Image prompt rewrite unusable (...) again and again in the Engine log, while the model answer looks valid apart from its ```json fence. The fence was already removed correctly. Two other faults cause the warning:

  • The rewrite answer went through a strict JSON.parse. A line break inside the prompt text, a trailing comma, or text around the object made a usable answer count as "no prompt".
  • A refusal by the AI budget (mode Off, "Enhance image prompts" row off, or its daily limit reached) was treated as a failed rewrite. Each picture logged the warning and its draft was cut to 1,500 characters, although the skip is the player's own setting.

What changed

  • Affected package: slurp2 0.3.24 → 0.3.25 (patch).
  • server/src/slp/base/media/slp-image-prompt-rewrite.ts: parseRecord uses Engine's parseGameJsonish, as every other Slurp model call does. An answer that jsonishLooksTruncated reports as cut off still falls back, so half a prompt is never sent.
  • Same file: new optional onBudgetSkip callback, called when the budget refuses the call.
  • slp-images-service.ts, slp-public-images-service.ts, slp-garnish-image-service.ts: on a budget skip the rewrite no longer counts as attempted. The picture gets the full draft, as with enhancing switched off, and Deep details keeps the rewrite status skipped.
  • A missing text connection, an empty answer, and a cut answer still log the warning. Those are real failures.
  • Changelog and splash note updated.
  • Generated outputs rebuilt by the builder: client.js, server.mjs, manifest.json, artifacts/slurp2-0.3.25.zip, catalogs.

Not covered: an unescaped quotation mark inside the prompt text still fails to parse. The reporter also mentions other log errors; no log lines are available yet. No Slurp release since 2026-09-28 changed a prompt output schema.

Note: draft PR #1321 also uses 0.3.25. It must move to 0.3.26 after this merge.

Package and security impact

  • Affected package IDs: slurp2
  • Engine compatibility impact: none (engine.min 2.4.6 unchanged; both Engine helpers exist since Engine 2.0.0)
  • New or changed permissions/entrypoints: none
  • Restart, storage, update, or uninstall impact: none. The accepted rewrite still passes the same content checks (internal label, private context, guidance block, content level) before it reaches the image provider. On a budget skip the draft is no longer cut to 1,500 characters, which is the existing behavior with enhancing off.

Validation

Agent-run checks (boxes left for human verification):

  • tests/slurp2-image-prompt-boundaries.regression.ts has new assertions: the rewrite uses parseGameJsonish and no JSON.parse, and all three callers clear rewriteAttempted on a budget skip. These are source assertions; the rewrite module imports Engine code that the test tree cannot load.

  • Probe against Engine's real jsonish.ts (not kept in the repo): the old parser failed on a line break in the prompt, a trailing comma, and text around the fenced object; the new logic accepts all three and rejects a cut answer.

  • Pass: slurp-image-prompt-wiring, slurp-image-brief, slurp2-architecture regressions, node scripts/typecheck-packages.mjs slurp2, node scripts/test-catalog-lanes.mjs, node scripts/validate-package-locales.mjs, node scripts/validate-catalog.mjs, node scripts/tests/catalog-release-notes.regression.mjs, Prettier on the changed files, git diff --check.

  • Build: node scripts/build-feature-packages.mjs slurp2. The Engine checkout used for dependencies was on fix/capability-agent-registry-uninstall (079c0ab00) with two unrelated dirty files, not a clean staging.

  • Not done: ESLint and the full Slurp regression suite (the worktree has no node_modules; CI runs both), no install on an Engine, no picture generated with the budget off, no independent review.

  • 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

Documentation impact

  • No documentation changes needed
  • Updated this README catalog and package guidance
  • Updated linked Marinara Engine documentation

Summary by CodeRabbit

  • Bug Fixes
    • Image-prompt enhancement now accepts usable responses containing line breaks, trailing commas, or surrounding text, while still falling back for incomplete responses.
    • When enhancement is unavailable because the AI budget is off, the feature is disabled, or the daily limit is reached, the full image draft is sent instead of a truncated draft.
  • Release
    • Updated Slurp to version 0.3.25.

🔄 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/1325 **Author:** [@Gunterlie](https://github.com/Gunterlie) **Created:** 10/12/2026 **Status:** ✅ Merged **Merged:** 10/12/2026 **Merged by:** [@Gunterlie](https://github.com/Gunterlie) **Base:** `staging` ← **Head:** `fenced-json-prompt-parse` --- ### 📝 Commits (4) - [`d1035e3`](https://github.com/Pasta-Devs/Marinara-Agents/commit/d1035e34f9ebd5f33466c2e2ccf5900c18cb4a4b) fix(slurp2): accept usable image prompt rewrites, treat a budget skip as off - [`ef4c589`](https://github.com/Pasta-Devs/Marinara-Agents/commit/ef4c5897af47185b27384567f20cea970cf3e2ce) chore(slurp2): rebuild 0.3.25 - [`023d659`](https://github.com/Pasta-Devs/Marinara-Agents/commit/023d659f4a5cd9b3d3abdd9eba7f8201b228cfb1) fix(slurp2): guard the rewrite parser call and keep the splash note in-universe - [`bcb07b2`](https://github.com/Pasta-Devs/Marinara-Agents/commit/bcb07b2e9e131891429d0b6935a37ffc8315023a) chore(slurp2): rebuild 0.3.25 ### 📊 Changes **19 files changed** (+377 additions, -337 deletions) <details> <summary>View changed files</summary> ➕ `artifacts/slurp2-0.3.25.zip` (+0 -0) 📝 `catalog/catalog.json` (+8 -8) 📝 `catalog/notes.json` (+6 -6) 📝 `catalog/v2/catalog.json` (+8 -8) 📝 `catalog/v2/notes.json` (+6 -6) 📝 `catalog/v3/catalog.json` (+8 -8) 📝 `catalog/v3/notes.json` (+6 -6) 📝 `packages/slurp2/CHANGELOG.md` (+5 -0) 📝 `packages/slurp2/client.js` (+1 -1) 📝 `packages/slurp2/manifest.json` (+5 -5) 📝 `packages/slurp2/server.mjs` (+276 -276) 📝 `packages/slurp2/src/engine/packages/client/src/slp/features/onboarding/slp-release.ts` (+9 -1) 📝 `packages/slurp2/src/engine/packages/server/src/slp/base/media/slp-image-prompt-rewrite.ts` (+13 -8) 📝 `packages/slurp2/src/engine/packages/server/src/slp/features/ads/slp-garnish-image-service.ts` (+4 -1) 📝 `packages/slurp2/src/engine/packages/server/src/slp/features/media/slp-images-service.ts` (+4 -1) 📝 `packages/slurp2/src/engine/packages/server/src/slp/features/media/slp-public-images-service.ts` (+4 -1) 📝 `scripts/build-feature-packages.mjs` (+1 -1) 📝 `tests/slurp-onboarding-failure-reasons.regression.ts` (+1 -0) 📝 `tests/slurp2-image-prompt-boundaries.regression.ts` (+12 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch to `main`. ## Linked issue Closes #1324 ## Why this change A player reports `[slurp] Image prompt rewrite unusable (...)` again and again in the Engine log, while the model answer looks valid apart from its ```` ```json ```` fence. The fence was already removed correctly. Two other faults cause the warning: - The rewrite answer went through a strict `JSON.parse`. A line break inside the prompt text, a trailing comma, or text around the object made a usable answer count as "no prompt". - A refusal by the AI budget (mode Off, "Enhance image prompts" row off, or its daily limit reached) was treated as a failed rewrite. Each picture logged the warning and its draft was cut to 1,500 characters, although the skip is the player's own setting. ## What changed - **Affected package:** `slurp2` 0.3.24 → 0.3.25 (patch). - `server/src/slp/base/media/slp-image-prompt-rewrite.ts`: `parseRecord` uses Engine's `parseGameJsonish`, as every other Slurp model call does. An answer that `jsonishLooksTruncated` reports as cut off still falls back, so half a prompt is never sent. - Same file: new optional `onBudgetSkip` callback, called when the budget refuses the call. - `slp-images-service.ts`, `slp-public-images-service.ts`, `slp-garnish-image-service.ts`: on a budget skip the rewrite no longer counts as attempted. The picture gets the full draft, as with enhancing switched off, and Deep details keeps the rewrite status `skipped`. - A missing text connection, an empty answer, and a cut answer still log the warning. Those are real failures. - Changelog and splash note updated. - Generated outputs rebuilt by the builder: `client.js`, `server.mjs`, `manifest.json`, `artifacts/slurp2-0.3.25.zip`, catalogs. Not covered: an unescaped quotation mark inside the prompt text still fails to parse. The reporter also mentions other log errors; no log lines are available yet. No Slurp release since 2026-09-28 changed a prompt output schema. Note: draft PR #1321 also uses 0.3.25. It must move to 0.3.26 after this merge. ## Package and security impact - Affected package IDs: `slurp2` - Engine compatibility impact: none (`engine.min` 2.4.6 unchanged; both Engine helpers exist since Engine 2.0.0) - New or changed permissions/entrypoints: none - Restart, storage, update, or uninstall impact: none. The accepted rewrite still passes the same content checks (internal label, private context, guidance block, content level) before it reaches the image provider. On a budget skip the draft is no longer cut to 1,500 characters, which is the existing behavior with enhancing off. ## Validation Agent-run checks (boxes left for human verification): - `tests/slurp2-image-prompt-boundaries.regression.ts` has new assertions: the rewrite uses `parseGameJsonish` and no `JSON.parse`, and all three callers clear `rewriteAttempted` on a budget skip. These are source assertions; the rewrite module imports Engine code that the test tree cannot load. - Probe against Engine's real `jsonish.ts` (not kept in the repo): the old parser failed on a line break in the prompt, a trailing comma, and text around the fenced object; the new logic accepts all three and rejects a cut answer. - Pass: `slurp-image-prompt-wiring`, `slurp-image-brief`, `slurp2-architecture` regressions, `node scripts/typecheck-packages.mjs slurp2`, `node scripts/test-catalog-lanes.mjs`, `node scripts/validate-package-locales.mjs`, `node scripts/validate-catalog.mjs`, `node scripts/tests/catalog-release-notes.regression.mjs`, Prettier on the changed files, `git diff --check`. - Build: `node scripts/build-feature-packages.mjs slurp2`. The Engine checkout used for dependencies was on `fix/capability-agent-registry-uninstall` (079c0ab00) with two unrelated dirty files, not a clean `staging`. - Not done: ESLint and the full Slurp regression suite (the worktree has no `node_modules`; CI runs both), no install on an Engine, no picture generated with the budget off, no independent review. - [ ] `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` ## Documentation impact - [ ] No documentation changes needed - [ ] Updated this README catalog and package guidance - [ ] Updated linked Marinara Engine documentation <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Image-prompt enhancement now accepts usable responses containing line breaks, trailing commas, or surrounding text, while still falling back for incomplete responses. * When enhancement is unavailable because the AI budget is off, the feature is disabled, or the daily limit is reached, the full image draft is sent instead of a truncated draft. * **Release** * Updated Slurp to version 0.3.25. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-21 05:10:31 +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#1400
No description provided.